void PeriodicProcessing( uint32_t timestamp, uint8_t inputValue, uint8_t& outputValue ) { switch(bitNumber) { case 0: // START SetTxLow( outputValue ); break; case 1: // D0 SetTx( currentByte & 0x01, outputValue ); break; case 2: // D1 SetTx( currentByte & 0x02, outputValue ); break; case 3: // D2 SetTx( currentByte & 0x04, outputValue ); break; case 4: // D3 SetTx( currentByte & 0x08, outputValue ); break; case 5: // D4 SetTx( currentByte & 0x10, outputValue ); break; case 6: // D5 SetTx( currentByte & 0x20, outputValue ); break; case 7: // D6 SetTx( currentByte & 0x40, outputValue ); break; case 8: // D7 SetTx( currentByte & 0x80, outputValue ); break; case 9: // STOP SetTxHigh( outputValue ); currentByte = fifo[fifoTail]; fifoTail++; byteStartTimestamp = timestamp; break; } bitNumber = (bitNumber+1) & 0x7; }
void PeriodicProcessing( uint8_t inputValue, uint8_t& outputValue ) { bool dataAvailable = false; uint8_t currentCmd = cmdFIFO.NonBlockingGet(dataAvailable); if( (bitNumber&0x01) == 0 ) { SetTxLow( outputValue ); } else { SetTxHigh( outputValue ); } bitNumber++; }
void PeriodicProcessing( uint32_t timestamp, uint8_t inputValue, uint8_t& outputValue ) { if(timestamp > nextBitTimestamp) { nextBitTimestamp = timestamp + ticksPerBit; switch(bitNumber) { case 0: // ON SetTxLow( outputValue ); break; case 1: // OFF SetTxHigh( outputValue ); break; } bitNumber = (bitNumber+1) & 0x1; } }