mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-08 22:53:57 -04:00
AP_HAL: add discard_input method on UARTDriver
This commit is contained in:
parent
f199ca54bd
commit
a8d03990ec
@ -38,6 +38,7 @@ public:
|
||||
uint32_t available() override { return 0; }
|
||||
int16_t read() override { return -1; }
|
||||
uint32_t txspace() override { return 0; }
|
||||
bool discard_input() override { return false; }
|
||||
};
|
||||
|
||||
int AP_HAL::Util::snprintf(char* str, size_t size, const char *format, ...)
|
||||
|
@ -43,6 +43,11 @@ public:
|
||||
* -1 if nothing available, uint8_t value otherwise. */
|
||||
virtual int16_t read() = 0;
|
||||
|
||||
// no base-class implementation to force descendants to
|
||||
// do things efficiently. Looping over 2^32-1 bytes would be bad.
|
||||
// returns false if discard failed (e.g. port locked)
|
||||
virtual bool discard_input() = 0; // discard all bytes available for reading
|
||||
|
||||
/* NB txspace was traditionally a member of BetterStream in the
|
||||
* FastSerial library. As far as concerns go, it belongs with available() */
|
||||
virtual uint32_t txspace() = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user