HAL_FLYMAPLE: implement a dummy buffered write

This commit is contained in:
Andrew Tridgell 2013-10-02 17:37:27 +10:00
parent a8c97f99d1
commit 9624821493
4 changed files with 15 additions and 0 deletions

View File

@ -72,4 +72,8 @@ size_t FLYMAPLEConsoleDriver::write(uint8_t c) {
return _base_uart->write(c);
}
size_t FLYMAPLEConsoleDriver::write(const uint8_t *buffer, size_t size) {
return _base_uart->write(buffer, size);
}
#endif

View File

@ -18,6 +18,7 @@ public:
int16_t read();
size_t write(uint8_t c);
size_t write(const uint8_t *buffer, size_t size);
private:
AP_HAL::UARTDriver* _base_uart;
};

View File

@ -98,4 +98,13 @@ size_t FLYMAPLEUARTDriver::write(uint8_t c)
return 1;
}
size_t FLYMAPLEUARTDriver::write(const uint8_t *buffer, size_t size)
{
size_t n = 0;
while (size--) {
n += write(*buffer++);
}
return n;
}
#endif

View File

@ -43,6 +43,7 @@ public:
/* FLYMAPLE implementations of Print virtual methods */
size_t write(uint8_t c);
size_t write(const uint8_t *buffer, size_t size);
private:
HardwareSerial* _hws;
uint8_t* _txBuf; // If need more than libmaple usart driver buffer of 63