djasfihasof
New member
Hello,
I'm having trouble finding information about how to handle (external) GPIO Interrupts on the Teensy 4.0 running on Windows.
I essentially want to use direct registers as much as possible (so without using attachInterrupt etc).
I've already figured out from the reference manual how to configure these GPIO Interrupts, of which the summary is given below (please correct me if I'm wrong!)
Choose a digital pin on the Teensy 4 -> Lookup the corresponding NXP iMXRT1060 GPIO (or use the given macros) -> Use the faster GPIO6-9 pins (p375) -> Configure ICR1 and ICR2 registers (p966) ->
Find the IRQ number (p47) -> Enable and set the interrupt priority using the NVIC functions
If what is written above is correct, I should be able to correctly configure the interrupt registers for a pin on the Teensy 4.0. However, I'm struggling with what comes after that. How do I actually "bind" a function
to that interrupt when it occurs?
I have looked through the core Teensy code, but could not find any predetermined function names (e.g. GPIO9_IRQ_HANDLER() ), so my guess is that there are no predetermined function names. I tried looking in the
interrupt.c file to see how the attachInterrupt function does it, and could see that it uses a function pointer table to store the ISR for specific pins. However again, I do not understand how the function is actually bound to a digital pin.
If someone could point me in the right direction/explain how it could be done, it would be greatly appreciated!
I'm having trouble finding information about how to handle (external) GPIO Interrupts on the Teensy 4.0 running on Windows.
I essentially want to use direct registers as much as possible (so without using attachInterrupt etc).
I've already figured out from the reference manual how to configure these GPIO Interrupts, of which the summary is given below (please correct me if I'm wrong!)
Choose a digital pin on the Teensy 4 -> Lookup the corresponding NXP iMXRT1060 GPIO (or use the given macros) -> Use the faster GPIO6-9 pins (p375) -> Configure ICR1 and ICR2 registers (p966) ->
Find the IRQ number (p47) -> Enable and set the interrupt priority using the NVIC functions
If what is written above is correct, I should be able to correctly configure the interrupt registers for a pin on the Teensy 4.0. However, I'm struggling with what comes after that. How do I actually "bind" a function
to that interrupt when it occurs?
I have looked through the core Teensy code, but could not find any predetermined function names (e.g. GPIO9_IRQ_HANDLER() ), so my guess is that there are no predetermined function names. I tried looking in the
interrupt.c file to see how the attachInterrupt function does it, and could see that it uses a function pointer table to store the ISR for specific pins. However again, I do not understand how the function is actually bound to a digital pin.
If someone could point me in the right direction/explain how it could be done, it would be greatly appreciated!