2012-12-14 21:55:38 -04:00
|
|
|
|
|
|
|
#include "UARTDriver.h"
|
2021-06-05 00:50:28 -03:00
|
|
|
#include <AP_Common/ExpandingString.h>
|
2012-12-14 21:55:38 -04:00
|
|
|
|
2018-05-02 09:56:11 -03:00
|
|
|
Empty::UARTDriver::UARTDriver() {}
|
2012-12-14 21:55:38 -04:00
|
|
|
|
2018-05-02 09:56:11 -03:00
|
|
|
void Empty::UARTDriver::begin(uint32_t b) {}
|
|
|
|
void Empty::UARTDriver::begin(uint32_t b, uint16_t rxS, uint16_t txS) {}
|
|
|
|
void Empty::UARTDriver::end() {}
|
|
|
|
void Empty::UARTDriver::flush() {}
|
|
|
|
bool Empty::UARTDriver::is_initialized() { return false; }
|
|
|
|
void Empty::UARTDriver::set_blocking_writes(bool blocking) {}
|
|
|
|
bool Empty::UARTDriver::tx_pending() { return false; }
|
2012-12-14 21:55:38 -04:00
|
|
|
|
|
|
|
/* Empty implementations of Stream virtual methods */
|
2018-05-02 09:56:11 -03:00
|
|
|
uint32_t Empty::UARTDriver::available() { return 0; }
|
|
|
|
uint32_t Empty::UARTDriver::txspace() { return 1; }
|
2023-02-21 05:35:57 -04:00
|
|
|
bool Empty::UARTDriver::read(uint8_t &b) { return false; }
|
2020-05-22 21:22:28 -03:00
|
|
|
bool Empty::UARTDriver::discard_input() { return false; }
|
2012-12-14 21:55:38 -04:00
|
|
|
|
|
|
|
/* Empty implementations of Print virtual methods */
|
2018-05-02 09:56:11 -03:00
|
|
|
size_t Empty::UARTDriver::write(uint8_t c) { return 0; }
|
2013-10-02 04:37:11 -03:00
|
|
|
|
2018-05-02 09:56:11 -03:00
|
|
|
size_t Empty::UARTDriver::write(const uint8_t *buffer, size_t size)
|
2013-10-02 04:37:11 -03:00
|
|
|
{
|
|
|
|
size_t n = 0;
|
|
|
|
while (size--) {
|
|
|
|
n += write(*buffer++);
|
|
|
|
}
|
|
|
|
return n;
|
|
|
|
}
|
2021-06-05 00:50:28 -03:00
|
|
|
|
2022-01-08 06:56:52 -04:00
|
|
|
#if HAL_UART_STATS_ENABLED
|
2021-06-05 00:50:28 -03:00
|
|
|
void Empty::UARTDriver::uart_info(ExpandingString &str)
|
|
|
|
{
|
|
|
|
str.printf("EMPTY\n");
|
|
|
|
}
|
2022-01-08 06:56:52 -04:00
|
|
|
#endif
|