1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-23 08:06:13 +01:00

count packets sent by RMT HW

This commit is contained in:
Harald Barth 2022-08-02 12:42:20 +02:00
parent 167c5db1fe
commit 07600274f1
2 changed files with 3 additions and 0 deletions

View File

@ -197,6 +197,7 @@ int RMTChannel::RMTfillData(const byte buffer[], byte byteCount, byte repeatCoun
void IRAM_ATTR RMTChannel::RMTinterrupt() { void IRAM_ATTR RMTChannel::RMTinterrupt() {
//no rmt_tx_start(channel,true) as we run in loop mode //no rmt_tx_start(channel,true) as we run in loop mode
//preamble is always loaded at beginning of buffer //preamble is always loaded at beginning of buffer
packetCounter++;
if (dataReady) { // if we have new data, fill while preamble is running if (dataReady) { // if we have new data, fill while preamble is running
rmt_fill_tx_items(channel, data, dataLen, preambleLen-1); rmt_fill_tx_items(channel, data, dataLen, preambleLen-1);
dataReady = false; dataReady = false;

View File

@ -41,6 +41,7 @@ class RMTChannel {
return true; return true;
return dataReady; return dataReady;
}; };
inline uint32_t packetCount() { return packetCounter; };
private: private:
@ -54,6 +55,7 @@ class RMTChannel {
rmt_item32_t *data; rmt_item32_t *data;
byte dataLen; byte dataLen;
byte maxDataLen; byte maxDataLen;
uint32_t packetCounter = 0;
// flags // flags
volatile bool dataReady = false; // do we have real data available or send idle volatile bool dataReady = false; // do we have real data available or send idle
volatile byte dataRepeat = 0; volatile byte dataRepeat = 0;