1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-27 01:56:14 +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() {
//no rmt_tx_start(channel,true) as we run in loop mode
//preamble is always loaded at beginning of buffer
packetCounter++;
if (dataReady) { // if we have new data, fill while preamble is running
rmt_fill_tx_items(channel, data, dataLen, preambleLen-1);
dataReady = false;

View File

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