Implemented blocking rx

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

No files matched your search

+10
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;
+1 -1
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 {}
+1 -1
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 {}