diff --git a/hardware.hpp b/hardware.hpp index 786abfc..96f3c2e 100644 --- a/hardware.hpp +++ b/hardware.hpp @@ -45,6 +45,16 @@ class Hardware { *Registers::CTRL_STAT_REG_C = controlRegC; } + static bool rxByteBlocking(typename cfg::data_t &byte) FORCE_INLINE + { + if (*Registers::CTRL_STAT_REG_A & (1 << CtrlFlagsA::RECEIVE_COMPLETE)) { + byte = *Registers::IO_REG; + return true; + } + + return false; + } + static typename cfg::data_t rxByteInterrupt() FORCE_INLINE { return *Registers::IO_REG; diff --git a/hardware0.hpp b/hardware0.hpp index 941c190..62ab024 100644 --- a/hardware0.hpp +++ b/hardware0.hpp @@ -98,7 +98,7 @@ class Hardware0 { static bool rxByte(data_t &byte) FORCE_INLINE { - return false; + return HardwareImpl::rxByteBlocking(byte); } static data_t peek() FORCE_INLINE {} diff --git a/hardware1.hpp b/hardware1.hpp index 1cff4f1..0f0f60e 100644 --- a/hardware1.hpp +++ b/hardware1.hpp @@ -102,7 +102,7 @@ class Hardware1 { static bool rxByte(data_t &byte) FORCE_INLINE { - return false; + return HardwareImpl::rxByteBlocking(byte); } static data_t peek() FORCE_INLINE {}