|
|
|
@ -19,6 +19,7 @@
@@ -19,6 +19,7 @@
|
|
|
|
|
#include <AP_HAL.h> |
|
|
|
|
|
|
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_FLYMAPLE |
|
|
|
|
#include <stdlib.h> |
|
|
|
|
|
|
|
|
|
#include "UARTDriver.h" |
|
|
|
|
#include "FlymapleWirish.h" |
|
|
|
@ -28,7 +29,9 @@
@@ -28,7 +29,9 @@
|
|
|
|
|
using namespace AP_HAL_FLYMAPLE_NS; |
|
|
|
|
|
|
|
|
|
FLYMAPLEUARTDriver::FLYMAPLEUARTDriver(HardwareSerial* hws): |
|
|
|
|
_hws(hws) |
|
|
|
|
_hws(hws), |
|
|
|
|
_txBuf(NULL), |
|
|
|
|
_txBufSize(63) // libmaple usart default driver buffer of 63
|
|
|
|
|
{} |
|
|
|
|
|
|
|
|
|
void FLYMAPLEUARTDriver::begin(uint32_t b)
|
|
|
|
@ -38,7 +41,17 @@ void FLYMAPLEUARTDriver::begin(uint32_t b)
@@ -38,7 +41,17 @@ void FLYMAPLEUARTDriver::begin(uint32_t b)
|
|
|
|
|
|
|
|
|
|
void FLYMAPLEUARTDriver::begin(uint32_t b, uint16_t rxS, uint16_t txS)
|
|
|
|
|
{ |
|
|
|
|
begin(b); |
|
|
|
|
// Our private buffer can only grow, never shrink
|
|
|
|
|
if (txS > _txBufSize) |
|
|
|
|
{ |
|
|
|
|
if (_txBuf) |
|
|
|
|
free(_txBuf); // CAUTION: old contents lost
|
|
|
|
|
_txBuf = (uint8_t*)malloc(txS); |
|
|
|
|
_txBufSize = txS; |
|
|
|
|
} |
|
|
|
|
begin(b); // libmaple internal ring buffer reinititalised to defaults here
|
|
|
|
|
if (_txBuf) |
|
|
|
|
rb_init(_hws->c_dev()->rb, _txBufSize, _txBuf); // Get the ring buffer size we want
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void FLYMAPLEUARTDriver::end()
|
|
|
|
|