AP_HAL_Linux: add discard_input method on UARTDriver

This commit is contained in:
Peter Barker 2020-05-23 10:22:46 +10:00 committed by Andrew Tridgell
parent b16c1ea647
commit 9a9743e6ba
2 changed files with 11 additions and 0 deletions

View File

@ -293,6 +293,15 @@ int16_t UARTDriver::read()
return byte;
}
bool UARTDriver::discard_input()
{
if (!_initialised) {
return false;
}
_readbuf.empty();
return true;
}
/* Linux implementations of Print virtual methods */
size_t UARTDriver::write(uint8_t c)
{

View File

@ -31,6 +31,8 @@ public:
uint32_t txspace() override;
int16_t read() override;
bool discard_input() override;
/* Linux implementations of Print virtual methods */
size_t write(uint8_t c) override;
size_t write(const uint8_t *buffer, size_t size) override;