Implemented interrupt driven tx

This commit is contained in:
2019-08-02 16:41:53 +02:00
parent 496bb3d4d1
commit 51a9d30c0a
3 changed files with 77 additions and 10 deletions

View File

@@ -45,7 +45,7 @@ class Hardware {
*Registers::CTRL_STAT_REG_C = controlRegC;
}
static void txByteBlocking(typename cfg::data_t byte) FORCE_INLINE
static void txByteBlocking(const typename cfg::data_t &byte) FORCE_INLINE
{
while (!(*Registers::CTRL_STAT_REG_A & (1 << CtrlFlagsA::DATA_REG_EMPTY)))
;
@@ -53,6 +53,21 @@ class Hardware {
*Registers::IO_REG = byte;
}
static void txByteInterrupt(volatile const typename cfg::data_t &byte) FORCE_INLINE
{
*Registers::IO_REG = byte;
}
static void enableDataRegEmptyInt() FORCE_INLINE
{
*Registers::CTRL_STAT_REG_B |= (1 << CtrlFlagsB::DATA_REG_EMPTY_INT_ENABLE);
}
static void disableDataRegEmptyInt() FORCE_INLINE
{
*Registers::CTRL_STAT_REG_B &= ~(1 << CtrlFlagsB::DATA_REG_EMPTY_INT_ENABLE);
}
private:
struct DataBitsVal {
uint8_t regCVal = 0;