@@ -370,10 +370,10 @@ void SequansControllerClass::setRetryConfiguration(const uint8_t num_retries,
370370}
371371
372372bool SequansControllerClass::isTxReady (void ) {
373- return ( tx_num_elements != TX_BUFFER_SIZE) ;
373+ return tx_num_elements != TX_BUFFER_SIZE;
374374}
375375
376- bool SequansControllerClass::isRxReady (void ) { return ( rx_num_elements != 0 ) ; }
376+ bool SequansControllerClass::isRxReady (void ) { return rx_num_elements > 0 ; }
377377
378378bool SequansControllerClass::writeByte (const uint8_t data) {
379379
@@ -388,10 +388,9 @@ bool SequansControllerClass::writeByte(const uint8_t data) {
388388 _delay_ms (sleep_between_retries_ms);
389389 }
390390
391+ cli ();
391392 tx_head_index = (tx_head_index + 1 ) & TX_BUFFER_MASK;
392393 tx_buffer[tx_head_index] = data;
393-
394- cli ();
395394 tx_num_elements++;
396395 sei ();
397396
@@ -441,7 +440,7 @@ bool SequansControllerClass::writeBytes(const uint8_t *data,
441440 return writeByte (' \r ' );
442441}
443442
444- int16_t SequansControllerClass::readByte () {
443+ int16_t SequansControllerClass::readByte (void ) {
445444 if (!isRxReady ()) {
446445 return -1 ;
447446 }
@@ -541,6 +540,8 @@ void SequansControllerClass::clearReceiveBuffer(void) {
541540 rx_num_elements = 0 ;
542541 rx_tail_index = rx_head_index;
543542 sei ();
543+
544+ flowControlUpdate ();
544545}
545546
546547bool SequansControllerClass::extractValueFromCommandResponse (
@@ -752,12 +753,12 @@ uint8_t SequansControllerClass::waitForByte(uint8_t byte, uint32_t timeout) {
752753 return SEQUANS_CONTROLLER_READ_BYTE_OK;
753754}
754755
755- void SequansControllerClass::startCriticalSection () {
756+ void SequansControllerClass::startCriticalSection (void ) {
756757 critical_section_enabled = true ;
757758 RTS_PORT.OUTSET = RTS_PIN_bm;
758759}
759760
760- void SequansControllerClass::stopCriticalSection () {
761+ void SequansControllerClass::stopCriticalSection (void ) {
761762 critical_section_enabled = false ;
762763 RTS_PORT.OUTCLR = RTS_PIN_bm;
763764}
0 commit comments