I have experimented with the general purpose timer (GPT) and am quite pleased with how it works (except the fact that reading from and writing to the status register takes incredibly long *ahem*). There are two entirely independent GPTs (GPT1 and GPT2) that offer three output-compare channels, two input capture channels (haven't tried those yet, there simply aren't enough pins for that on the Teensy). If you're interested in using the GPTs to execute your own interrupt service routines, I encourage you to read this thread: https://forum.pjrc.com/threads/5813...-purpose-timer-(GPT)-output-conpare-interrupt
But in some instances, two independent counters just aren't enough. Reading through the manual I found that there are almost countless of them (pun totally intended), but while there are some examples (like the ones for the periodic interrupt timer in section 52.6), there is nothing that points me to the all important part of how to attach my own isr to the compare event of the timer. For the GPT1 it looks something like this (leaving out the part about configuring the timer itself):
So my specific question is: How do I do this for the PIT?
And more broadly: How can you do this for all the other timers that are available on the Teensy 4.0?
Thanks!
But in some instances, two independent counters just aren't enough. Reading through the manual I found that there are almost countless of them (pun totally intended), but while there are some examples (like the ones for the periodic interrupt timer in section 52.6), there is nothing that points me to the all important part of how to attach my own isr to the compare event of the timer. For the GPT1 it looks something like this (leaving out the part about configuring the timer itself):
Code:
attachInterruptVector(IRQ_GPT1, myISR); // Specify the isr you want to be executed
// (in this case that function is called myISR and is defined somewhere else)
NVIC_ENABLE_IRQ(IRQ_GPT1); // Enable the interrupt in the nested vectored interrupt controller table (NVIC)
So my specific question is: How do I do this for the PIT?
And more broadly: How can you do this for all the other timers that are available on the Teensy 4.0?
Thanks!