AP_HAL: added UART locking interface

used to gain exclusive access to a UART. This is needed for the BLHeli
MSP protocol to prevent protocol corruption due to console writes
This commit is contained in:
Andrew Tridgell 2018-04-02 16:00:13 +10:00
parent b7bcee69a3
commit 85ae6f60a8

View File

@ -37,6 +37,13 @@ public:
virtual void set_blocking_writes(bool blocking) = 0;
virtual bool tx_pending() = 0;
// lock a port for exclusive use. Use a key of 0 to unlock
virtual bool lock_port(uint32_t key) { return false; }
// write to a locked port. If port is locked and key is not correct then 0 is returned
// and write is discarded
virtual size_t write_locked(const uint8_t *buffer, size_t size, uint32_t key) { return 0; }
enum flow_control {
FLOW_CONTROL_DISABLE=0, FLOW_CONTROL_ENABLE=1, FLOW_CONTROL_AUTO=2
};