Skip to content

Commit a575397

Browse files
committed
FIEAT Teensy suppor - Cristopher Parrot code
1 parent 037322f commit a575397

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

library_source/FOCutils.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ void _setPwmFrequency(const int pinA, const int pinB, const int pinC) {
5353
analogWrite(pinC, 0);
5454
analogWriteFrequency(50000); // set 50kHz
5555

56+
#elif defined(__arm__) && defined(CORE_TEENSY) //if teensy 3x / 4x / LC boards
57+
analogWrite(pinA, 0);
58+
analogWriteFrequency(pinA, 50000); // set 50kHz
59+
analogWrite(pinB, 0);
60+
analogWriteFrequency(pinB, 50000); // set 50kHz
61+
analogWrite(pinC, 0);
62+
analogWriteFrequency(pinC, 50000); // set 50kHz
63+
5664
#elif defined(ESP_H) // if esp32 boards
5765

5866
motor_slots_t m_slot = {};
@@ -133,7 +141,7 @@ void _writeDutyCycle(float dc_a, float dc_b, float dc_c, int pinA, int pinB, in
133141
break;
134142
}
135143
}
136-
#else // Arduino & STM32 devices
144+
#else // Arduino & STM32 devices & Teensy
137145
// transform duty cycle from [0,1] to [0,255]
138146
analogWrite(pinA, 255*dc_a);
139147
analogWrite(pinB, 255*dc_b);

0 commit comments

Comments
 (0)