Timer1, Timer3 and PWM

Status
Not open for further replies.

ilium007

Well-known member
Hi just wondering why the Timer1 and Timer3 library only works with pins 3,4 and 29,30 but analogueWrite on the Teensy 2.6 works on pins 5, 6, 9, 10, 20, 21, 22, 23 ( Timer FTM0) and 2, 7, 8, 14, 35, 36, 37, 38 (Timer FTM3).

I would like to use the Timer1/Timer3 libraries to get the Timer1.attachInterrupt(function) capability but on more the the 4 pins above.
 
Probably controlled/limited by the feature/connect/design of the microcontroller internals. Generally those are hardware constraints, not a failure to provide features when possible.
 
As you can probably guess, those 2 libraries are accessing the FTM1 and FTM2 timers.

If you want to have essentially the same library code accessing the FTM0 or FTM3 timer, you'll need to make a copy of the library and edit the code. By comparing the code of the 2 existing libraries (maybe first delete all the non-Teensy code from both), you can pretty easily see which code is common to both and where names differ. Just edit all those differing places in your 3rd copy of the library, so it accesses FTM0 or FTM3. Easy, right?
 
Status
Not open for further replies.
Back
Top