complete bufferTXD() for bleuart
- reduce default max connection interval from 40 to 30 ms - finish firmata port
This commit is contained in:
1 parent
2528b45480
commit
b8beb424de
8 files changed
+493
-32
No files matched your search
@@ -71,7 +71,7 @@ BLEUart::BLEUart(uint16_t fifo_depth)
|
||||
{
|
||||
_rx_cb = NULL;
|
||||
|
||||
_tx_buffered = false;
|
||||
_tx_buffered = 0;
|
||||
_buffered_th = NULL;
|
||||
|
||||
_tx_fifo = NULL;
|
||||
@@ -114,7 +114,7 @@ void bleuart_txd_buffered_hdlr(TimerHandle_t timer)
|
||||
// skip if null (unlikely)
|
||||
if ( !svc->_tx_fifo ) return;
|
||||
|
||||
// flush data (send notiication)
|
||||
// flush tx data
|
||||
svc->flush_tx_buffered();
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ void BLEUart::setRxCallback( rx_callback_t fp)
|
||||
* Note: packet is sent right away if it reach MTU bytes
|
||||
* @param enable true or false
|
||||
*/
|
||||
void BLEUart::bufferTXD(bool enable)
|
||||
void BLEUart::bufferTXD(uint8_t enable)
|
||||
{
|
||||
_tx_buffered = enable;
|
||||
|
||||
@@ -206,6 +206,8 @@ void BLEUart::_disconnect_cb(void)
|
||||
{
|
||||
xTimerDelete(_buffered_th, 0);
|
||||
_buffered_th = NULL;
|
||||
|
||||
if (_tx_fifo) _tx_fifo->clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,8 +215,9 @@ void BLEUart::_connect_cb (void)
|
||||
{
|
||||
if ( _tx_buffered)
|
||||
{
|
||||
// create buffered timer with interval = connection interval
|
||||
_buffered_th = xTimerCreate(NULL, (5*ms2tick(Bluefruit.connInterval())) / 4, true, this, bleuart_txd_buffered_hdlr);
|
||||
// create TXD timer TODO take connInterval into account
|
||||
// ((5*ms2tick(Bluefruit.connInterval())) / 4) / 2
|
||||
_buffered_th = xTimerCreate(NULL, ms2tick(10), true, this, bleuart_txd_buffered_hdlr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class BLEUart : public BLEService, public Stream
|
||||
bool notifyEnabled(void);
|
||||
|
||||
void setRxCallback( rx_callback_t fp);
|
||||
void bufferTXD(bool enable);
|
||||
void bufferTXD(uint8_t enable);
|
||||
|
||||
// Stream API
|
||||
virtual int read ( void );
|
||||
@@ -83,10 +83,9 @@ class BLEUart : public BLEService, public Stream
|
||||
Adafruit_FIFO _rx_fifo;
|
||||
rx_callback_t _rx_cb;
|
||||
|
||||
bool _tx_buffered;
|
||||
TimerHandle_t _buffered_th;
|
||||
|
||||
Adafruit_FIFO* _tx_fifo;
|
||||
uint8_t _tx_buffered;
|
||||
TimerHandle_t _buffered_th;
|
||||
Adafruit_FIFO* _tx_fifo;
|
||||
|
||||
bool flush_tx_buffered(void);
|
||||
|
||||
|
||||
Reference in new issue
Block a user