Skip to content

Commit

Permalink
Merge pull request #321 from simplefoc/BUGFIX_teensy32_ftm3
Browse files Browse the repository at this point in the history
bugfix for teensy 3.0-3.0, wrong check for timer 3
  • Loading branch information
askuric authored Sep 27, 2023
2 parents 1694fa3 + c83ea8a commit 14c9eb2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/drivers/hardware_specific/teensy/teensy3_mcu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// if defined
// - Teensy 3.0 MK20DX128
// - Teensy 3.1/3.2 MK20DX256
// - Teensy 3.5 MK20DX128
// - Teensy LC MKL26Z64
// - Teensy 3.5 MK64FX512
// - Teensy 3.6 MK66FX1M0
Expand All @@ -14,7 +13,7 @@
#pragma message("SimpleFOC: compiling for Teensy 3.x")
#pragma message("")

// pin definition from https://github.com/PaulStoffregen/cores/blob/286511f3ec849a6c9e0ec8b73ad6a2fada52e44c/teensy3/pins_teensy.c
// pin definition from https://github.com/PaulStoffregen/cores/blob/286511f3ec849a6c9e0ec8b73ad6a2fada52e44c/teensy3/pins_teensy.c#L627
#if defined(__MK20DX128__)
#define FTM0_CH0_PIN 22
#define FTM0_CH1_PIN 23
Expand Down Expand Up @@ -116,7 +115,7 @@ int _findTimer( const int Ah, const int Al, const int Bh, const int Bl, const i
}
}

#ifdef FTM3_SC // if the board has FTM3 timer
#ifdef FTM3_CH0_PIN // if the board has FTM3 timer
if((Ah == FTM3_CH0_PIN && Al == FTM3_CH1_PIN) ||
(Ah == FTM3_CH2_PIN && Al == FTM3_CH3_PIN) ||
(Ah == FTM3_CH4_PIN && Al == FTM3_CH5_PIN) ){
Expand All @@ -134,7 +133,7 @@ int _findTimer( const int Ah, const int Al, const int Bh, const int Bl, const i
}
}
}
#endif
#endif

#ifdef SIMPLEFOC_TEENSY_DEBUG
SIMPLEFOC_DEBUG("TEENSY-DRV: ERR: Pins not on timers FTM0 or FTM3!");
Expand Down

0 comments on commit 14c9eb2

Please sign in to comment.