diff --git a/DCCRMT.cpp b/DCCRMT.cpp index 294663b..108bac9 100644 --- a/DCCRMT.cpp +++ b/DCCRMT.cpp @@ -57,11 +57,11 @@ void setEOT(rmt_item32_t* item) { } void IRAM_ATTR interrupt(rmt_channel_t channel, void *t) { - RMTPin *tt = (RMTPin *)t; + RMTChannel *tt = (RMTChannel *)t; tt->RMTinterrupt(); } -RMTPin::RMTPin(byte pin, byte ch, byte plen) { +RMTChannel::RMTChannel(byte pin, byte ch, byte plen) { // preamble preambleLen = plen+2; // plen 1 bits, one 0 bit and one EOF marker @@ -124,14 +124,14 @@ RMTPin::RMTPin(byte pin, byte ch, byte plen) { RMTinterrupt(); } -void RMTPin::RMTprefill() { +void RMTChannel::RMTprefill() { rmt_fill_tx_items(channel, preamble, preambleLen, 0); rmt_fill_tx_items(channel, idle, idleLen, preambleLen-1); } const byte transmitMask[] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; -bool RMTPin::RMTfillData(const byte buffer[], byte byteCount, byte repeatCount=1) { +bool RMTChannel::RMTfillData(const byte buffer[], byte byteCount, byte repeatCount=1) { if (dataReady == true || dataRepeat > 0) // we have still old work to do return false; if (DATA_LEN(byteCount) > maxDataLen) // this would overun our allocated memory for data @@ -156,7 +156,7 @@ bool RMTPin::RMTfillData(const byte buffer[], byte byteCount, byte repeatCount=1 return true; } -void IRAM_ATTR RMTPin::RMTinterrupt() { +void IRAM_ATTR RMTChannel::RMTinterrupt() { //no rmt_tx_start(channel,true) as we run in loop mode //preamble is always loaded at beginning of buffer if (dataReady) { // if we have new data, fill while preamble is running diff --git a/DCCRMT.h b/DCCRMT.h index 078a652..33339c4 100644 --- a/DCCRMT.h +++ b/DCCRMT.h @@ -29,15 +29,15 @@ #define DCC_1_HALFPERIOD 58 //4640 // 1 / 80000000 * 4640 = 58us #define DCC_0_HALFPERIOD 100 //8000 -class RMTPin { +class RMTChannel { public: - RMTPin(byte pin, byte ch, byte plen); + RMTChannel(byte pin, byte ch, byte plen); void IRAM_ATTR RMTinterrupt(); void RMTprefill(); bool RMTfillData(const byte buffer[], byte byteCount, byte repeatCount); - static RMTPin mainRMTPin; - static RMTPin progRMTPin; + static RMTChannel mainRMTChannel; + static RMTChannel progRMTChannel; private: diff --git a/DCCWaveform.cpp b/DCCWaveform.cpp index a9f09f9..1cf3011 100644 --- a/DCCWaveform.cpp +++ b/DCCWaveform.cpp @@ -38,7 +38,7 @@ uint8_t DCCWaveform::trailingEdgeCounter=0; void DCCWaveform::begin(MotorDriver * mainDriver, MotorDriver * progDriver) { - mainTrack.rmtPin = new RMTPin(21, 0, PREAMBLE_BITS_MAIN); + mainTrack.rmtPin = new RMTChannel(21, 0, PREAMBLE_BITS_MAIN); mainTrack.motorDriver=mainDriver; progTrack.motorDriver=progDriver; diff --git a/DCCWaveform.h b/DCCWaveform.h index 9822a87..ef8773a 100644 --- a/DCCWaveform.h +++ b/DCCWaveform.h @@ -124,7 +124,7 @@ class DCCWaveform { bool isMainTrack; MotorDriver* motorDriver; - RMTPin* rmtPin; + RMTChannel* rmtPin; // Transmission controller byte transmitPacket[MAX_PACKET_SIZE+1]; // +1 for checksum byte transmitLength;