Skip to content

Commit 627c0a8

Browse files
committed
Merge remote-tracking branch 'simplefoc/master' into dev
2 parents 14f6726 + 6fafa35 commit 627c0a8

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
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

src/drivers/hardware_specific/teensy/teensy4_mcu.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#pragma message("SimpleFOC: compiling for Teensy 4.x")
1111
#pragma message("")
1212

13-
// #define TEENSY4_FORCE_CENTER_ALIGNED_3PWM
13+
// #define SIMPLEFOC_TEENSY4_FORCE_CENTER_ALIGNED_3PWM
1414

1515

1616
// function finding the TRIG event given the flexpwm timer and the submodule
@@ -569,7 +569,7 @@ void write_pwm_on_pin(IMXRT_FLEXPWM_t *p, unsigned int submodule, uint8_t channe
569569
p->MCTRL |= FLEXPWM_MCTRL_LDOK(mask);
570570
}
571571

572-
#ifdef TEENSY4_FORCE_CENTER_ALIGNED_3PWM
572+
#ifdef SIMPLEFOC_TEENSY4_FORCE_CENTER_ALIGNED_3PWM
573573

574574
// function setting the high pwm frequency to the supplied pins
575575
// - BLDC motor - 3PWM setting
@@ -663,4 +663,4 @@ void _writeCenterAligned3PMW(float dc_a, float dc_b, float dc_c, void* params){
663663

664664
#endif
665665

666-
#endif
666+
#endif

0 commit comments

Comments
 (0)