mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-27 14:21:25 +01:00
Rename RMTPin to RMTChannel
This commit is contained in:
parent
c00d3a825d
commit
82df3a21dc
10
DCCRMT.cpp
10
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
|
||||
|
8
DCCRMT.h
8
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:
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user