From d601d83b4b388337430d12a44de555b9ad6870ef Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 21 Feb 2023 20:35:57 +1100 Subject: [PATCH] AP_HAL_Empty: add and use a "bool read(c)" method to AP_HAL this is much less likely to not work vs the int16_t equivalent --- libraries/AP_HAL_Empty/UARTDriver.cpp | 2 +- libraries/AP_HAL_Empty/UARTDriver.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_HAL_Empty/UARTDriver.cpp b/libraries/AP_HAL_Empty/UARTDriver.cpp index 9241248a84..7acd05d4a9 100644 --- a/libraries/AP_HAL_Empty/UARTDriver.cpp +++ b/libraries/AP_HAL_Empty/UARTDriver.cpp @@ -15,7 +15,7 @@ bool Empty::UARTDriver::tx_pending() { return false; } /* Empty implementations of Stream virtual methods */ uint32_t Empty::UARTDriver::available() { return 0; } uint32_t Empty::UARTDriver::txspace() { return 1; } -int16_t Empty::UARTDriver::read() { return -1; } +bool Empty::UARTDriver::read(uint8_t &b) { return false; } bool Empty::UARTDriver::discard_input() { return false; } /* Empty implementations of Print virtual methods */ diff --git a/libraries/AP_HAL_Empty/UARTDriver.h b/libraries/AP_HAL_Empty/UARTDriver.h index 8aad82b197..adc08b1501 100644 --- a/libraries/AP_HAL_Empty/UARTDriver.h +++ b/libraries/AP_HAL_Empty/UARTDriver.h @@ -17,7 +17,7 @@ public: /* Empty implementations of Stream virtual methods */ uint32_t available() override; uint32_t txspace() override; - int16_t read() override; + bool read(uint8_t &b) override WARN_IF_UNUSED; bool discard_input() override; /* Empty implementations of Print virtual methods */