Open sintrb opened 4 months ago
cores/arduino/api/HardwareSerial.cpp
when "rxBufferTail == rxBufferHead" USART interrupt will be disable. What time to enable USART interrupt. If not no way to read data. make a ring buff is more useful.
extern "C" void USART1_IRQHandler(void) { if(USART1->STATR & USART_FLAG_RXNE) { // Write into buffer rxBuffer[rxBufferTail] = USART1->DATAR & (uint16_t)0x01FF; rxBufferTail = (rxBufferTail + 1) % RX_BUFFER_SIZE; if(rxBufferTail == rxBufferHead) { // Buffer empty, disable USART interrupt USART1->CTLR1 &= ~USART_FLAG_RXNE; // here return; } } }
cores/arduino/api/HardwareSerial.cpp
when "rxBufferTail == rxBufferHead" USART interrupt will be disable. What time to enable USART interrupt. If not no way to read data. make a ring buff is more useful.