Implemented blocking rx

This commit is contained in:
BlackMark 2019-08-02 17:54:34 +02:00
parent 0bfd303a26
commit 95963295e2
3 changed files with 12 additions and 2 deletions

View File

@ -45,6 +45,16 @@ class Hardware {
*Registers::CTRL_STAT_REG_C = controlRegC; *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 static typename cfg::data_t rxByteInterrupt() FORCE_INLINE
{ {
return *Registers::IO_REG; return *Registers::IO_REG;

View File

@ -98,7 +98,7 @@ class Hardware0 {
static bool rxByte(data_t &byte) FORCE_INLINE static bool rxByte(data_t &byte) FORCE_INLINE
{ {
return false; return HardwareImpl::rxByteBlocking(byte);
} }
static data_t peek() FORCE_INLINE {} static data_t peek() FORCE_INLINE {}

View File

@ -102,7 +102,7 @@ class Hardware1 {
static bool rxByte(data_t &byte) FORCE_INLINE static bool rxByte(data_t &byte) FORCE_INLINE
{ {
return false; return HardwareImpl::rxByteBlocking(byte);
} }
static data_t peek() FORCE_INLINE {} static data_t peek() FORCE_INLINE {}