Fixed blocking on full rx buffer and implemented support for ATmega328P
This commit is contained in:
@@ -84,8 +84,6 @@ extern void (*fnDataReg1EmptyIntHandler)();
|
||||
|
||||
#define HAS_UART1
|
||||
|
||||
#else
|
||||
#error "This chip is not supported"
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
@@ -217,11 +215,15 @@ class Hardware1<cfg, Driven::INTERRUPT, mode> {
|
||||
|
||||
static void rxIntHandler()
|
||||
{
|
||||
auto data = HardwareImpl::rxByteInterrupt();
|
||||
|
||||
uint8_t tmpHead = (sm_rxBuf.head + 1) % RX_BUFFER_SIZE;
|
||||
|
||||
if (tmpHead != sm_rxBuf.tail) {
|
||||
sm_rxBuf.head = tmpHead;
|
||||
sm_rxBuf.buf[tmpHead] = HardwareImpl::rxByteInterrupt();
|
||||
sm_rxBuf.buf[tmpHead] = data;
|
||||
} else {
|
||||
// TODO: Handle overflow
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user