11#include "pico/stdlib.h"
84 static inline std::map<uint, std::vector<GpioCallback>>
listeners;
Event pub/sub manager for embedded applications using FreeRTOS.
GpioEventManager registers interrupts and posts GpioChange events to multiple listeners per pin.
void registerCallback(uint pin, GpioCallback cb)
Register a callback for GPIO events on a specific pin.
GpioEventManager()=default
std::function< void(const GpioEvent &)> GpioCallback
Initialize the GPIO event manager.
static void gpio_event_handler(uint gpio, uint32_t events)
void unregisterAll(uint pin)
Unregister listeners for a GPIO pin.
void disableInterrupt(uint pin)
Disable GPIO interrupts for a specific pin.
static GpioEventManager & getInstance()
Get the singleton instance of GpioEventManager.
void enableInterrupt(uint pin, uint32_t edgeMask)
Enable GPIO interrupts for a specific pin and edge mask.
static std::map< uint, std::vector< GpioCallback > > listeners
Structure representing a GPIO event.