Skip to content

Commit 6fafa35

Browse files
authored
Update teensy4_mcu.cpp
1 parent abda754 commit 6fafa35

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/current_sense/hardware_specific/teensy/teensy4_mcu.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// - Teensy 4.1
1010
#if defined(__arm__) && defined(CORE_TEENSY) && ( defined(__IMXRT1062__) || defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) || defined(ARDUINO_TEENSY_MICROMOD) )
1111

12-
// #define TEENSY4_ADC_INTERRUPT_DEBUG
12+
// #define SIMPLEFOC_TEENSY4_ADC_INTERRUPT_DEBUG
1313

1414

1515
volatile uint32_t val0, val1, val2;
@@ -28,7 +28,7 @@ void read_currents(uint32_t *a, uint32_t*b, uint32_t *c=nullptr){
2828
// interrupt service routine for the ADC_ETC0
2929
// reading the ADC values and clearing the interrupt
3030
void adcetc0_isr() {
31-
#ifdef TEENSY4_ADC_INTERRUPT_DEBUG
31+
#ifdef SIMPLEFOC_TEENSY4_ADC_INTERRUPT_DEBUG
3232
digitalWrite(30,HIGH);
3333
#endif
3434
// page 3509 , section 66.5.1.3.3
@@ -37,21 +37,21 @@ void adcetc0_isr() {
3737
val0 = (ADC_ETC_TRIG0_RESULT_1_0 & 4095);
3838
// val1 = lp2((ADC_ETC_TRIG0_RESULT_1_0 >> 16) & 4095);
3939
val1 = (ADC_ETC_TRIG0_RESULT_1_0 >> 16) & 4095;
40-
#ifdef TEENSY4_ADC_INTERRUPT_DEBUG
40+
#ifdef SIMPLEFOC_TEENSY4_ADC_INTERRUPT_DEBUG
4141
digitalWrite(30,LOW);
4242
#endif
4343
}
4444

4545

4646
void adcetc1_isr() {
47-
#ifdef TEENSY4_ADC_INTERRUPT_DEBUG
47+
#ifdef SIMPLEFOC_TEENSY4_ADC_INTERRUPT_DEBUG
4848
digitalWrite(30,HIGH);
4949
#endif
5050
// page 3509 , section 66.5.1.3.3
5151
ADC_ETC_DONE0_1_IRQ |= 1 << 16; // clear Done1 for trg0 at 16th bit
5252
val2 = ADC_ETC_TRIG0_RESULT_3_2 & 4095;
5353
// val2 = lp3( ADC_ETC_TRIG0_RESULT_3_2 & 4095);
54-
#ifdef TEENSY4_ADC_INTERRUPT_DEBUG
54+
#ifdef SIMPLEFOC_TEENSY4_ADC_INTERRUPT_DEBUG
5555
digitalWrite(30,LOW);
5656
#endif
5757
}
@@ -167,7 +167,7 @@ void* _configureADCLowSide(const void* driver_params, const int pinA,const int p
167167

168168
SIMPLEFOC_DEBUG("TEENSY-CS: Configuring low side current sense!");
169169

170-
#ifdef TEENSY4_ADC_INTERRUPT_DEBUG
170+
#ifdef SIMPLEFOC_TEENSY4_ADC_INTERRUPT_DEBUG
171171
pinMode(30,OUTPUT);
172172
#endif
173173

@@ -228,7 +228,7 @@ void _driverSyncLowSide(void* driver_params, void* cs_params){
228228
// flexpwm->SM[submodule].VAL4 = int(flexpwm->SM[submodule].VAL1*(1.0f - 2.5e-6*par->pwm_frequency)) ; // 2.5us before center
229229

230230

231-
#ifdef TEENSY4_ADC_INTERRUPT_DEBUG
231+
#ifdef SIMPLEFOC_TEENSY4_ADC_INTERRUPT_DEBUG
232232
// pin 4 observes out trigger line for 'scope
233233
xbar_connect (xbar_trig_pwm, XBARA1_OUT_IOMUX_XBAR_INOUT08) ;
234234
IOMUXC_GPR_GPR6 |= IOMUXC_GPR_GPR6_IOMUXC_XBAR_DIR_SEL_8 ; // select output mode for INOUT8
@@ -241,4 +241,4 @@ void _driverSyncLowSide(void* driver_params, void* cs_params){
241241
}
242242

243243

244-
#endif
244+
#endif

0 commit comments

Comments
 (0)