Object Oriented library to design C++ classes that support PIO interrupts.
Goal: make a PIO state machine call the very C++ object that's managing (or watching) it.
When I designed a Pico library to manage stepper motors with the PIO co-controllers, I created a utility to handle PIO relative interrupts. This is functionality that is useful in many OO PIO designs. I developed it specifically for stepper motors. In this series, I try to make it generic. Usable for any OO designer that wants to react on PIO notifications. |
A PIO relative interrupt is an interrupt that contains info of the PIO controller and the state machine that generated the interrupt. |
This will be an evolving series. I'm going to make it as flexible as reasonable, for an embedded system. Initially, I'll try to support objects that can be executed. (in C++ language, that means that they overload the () operator).
Watch this thread while I'm trying to transform a project specific construct into a reusable library ...
sneak preview:
/* PIO interrupts can only call functions without parameters. They can't call object members. This static embedded class delegates interrupts to the relevant object. The objects have to implement the () operation. */ // guard that E has to support () operator. template <std::invocable E, uint32_t interrupt_number> class pio_irq {
How to use the library, with example: OO Library to handle Pico PIO relative interrupts: usage and example