Skip to content

Commit 1355687

Browse files
committed
rename CCWaveform::incCutoutCounter to ailcom::incCutout
1 parent 20beb1b commit 1355687

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

DCCRMT.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "DCCTimer.h"
4444
#include "DCCWaveform.h" // for MAX_PACKET_SIZE
4545
#include "soc/gpio_sig_map.h"
46+
#include "Railcom.h"
4647

4748
// mcpwm stuff
4849
#include "soc/mcpwm_struct.h"
@@ -94,7 +95,8 @@ void setEOT(rmt_item32_t* item) {
9495
item->val = 0;
9596
}
9697

97-
// Special for debug
98+
// Special for debug, this can be called from interrupt.
99+
#ifdef MCPWM_DEBUG
98100
static void IRAM_ATTR __digitalWrite(uint8_t pin, uint8_t val) {
99101
if(val) {
100102
if(pin < 32)
@@ -117,6 +119,7 @@ static void IRAM_ATTR __digitalWrite(uint8_t pin, uint8_t val) {
117119
}
118120
}
119121
}
122+
#endif
120123

121124
// This is an array that contains the this pointers
122125
// to all uses channel objects. This is used to determine
@@ -145,8 +148,10 @@ void IRAM_ATTR interrupt(rmt_channel_t channel, void *t) {
145148
cutoutFlag = 0;
146149
// not needed here, we keep it enabled all the time
147150
//MCPWM1.int_ena.timer0_tez_int_ena = 1; // Enable interrupt on TEZ
148-
//DEBUG __digitalWrite(13 , 0);
149-
//DEBUG __digitalWrite(26 , 1);
151+
#ifdef MCPWM_DEBUG
152+
__digitalWrite(13 , 0);
153+
__digitalWrite(26 , 1);
154+
#endif
150155
mcpwm_set_duty_in_us(MCPWM_UNIT_1, MCPWM_TIMER_0, MCPWM_GEN_A, CUTOUT_PULSE);
151156
mcpwm_sync_config_t sync_conf = {
152157
.sync_sig = MCPWM_SELECT_GPIO_SYNC0,
@@ -162,7 +167,9 @@ static void IRAM_ATTR mcpwmIsrHandler(void* arg) {
162167
if (MCPWM1.int_st.timer0_tez_int_st) {
163168
MCPWM1.int_clr.timer0_tez_int_clr = 1;
164169
if (cutoutFlag == 0) {
165-
//DEBUG __digitalWrite(26, 0);
170+
#ifdef MCPWM_DEBUG
171+
__digitalWrite(26, 0);
172+
#endif
166173
// The cutout has not happened yet
167174
// This interrupt is on cutout start
168175
// but we reset already the mcpwm into standby mode
@@ -171,9 +178,11 @@ static void IRAM_ATTR mcpwmIsrHandler(void* arg) {
171178
mcpwm_sync_disable(MCPWM_UNIT_1, MCPWM_TIMER_0);
172179
cutoutFlag++;
173180
} else if (cutoutFlag == 1) { // the else is important
174-
//DEBUG __digitalWrite(13 , 1);
181+
#ifdef MCPWM_DEBUG
182+
__digitalWrite(13 , 1);
183+
#endif
175184
// Cutout is done
176-
DCCWaveform::incCutoutCounter();
185+
Railcom::incCutout();
177186
cutoutFlag++;
178187
// this does not work as the enable does not go into effect immidiately
179188
// MCPWM1.int_ena.timer0_tez_int_ena = 0; // Disable interrupt on TEZ

0 commit comments

Comments
 (0)