Fixed blocking on full rx buffer and implemented support for ATmega328P
This commit is contained in:
@@ -15,7 +15,7 @@ namespace uart {
|
||||
|
||||
namespace detail {
|
||||
|
||||
#if defined(__AVR_ATmega1284P__)
|
||||
#if defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega328P__)
|
||||
|
||||
/*
|
||||
The following works in avr-gcc 5.4.0, but is not legal C++, because ptr's are not legal constexpr's
|
||||
@@ -213,11 +213,15 @@ class Hardware0<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