3#include <hardware/gpio.h>
20 gpio_set_irq_enabled(pin, edgeMask,
true);
24 gpio_set_irq_enabled(pin, GPIO_IRQ_EDGE_RISE | GPIO_IRQ_EDGE_FALL,
false);
38 static_cast<uint16_t
>(gpio),
39 static_cast<uint16_t
>(events)
43#if GPIO_EVENT_HANDLING & GPIO_NOTIFICATIONS
47 for (
auto& cb : it->second) {
54#if GPIO_EVENT_HANDLING & GPIO_EVENTS
Event pub/sub manager for embedded applications using FreeRTOS.
Defines the Event structure and related utilities for event messaging.
Posts GPIO change events (rising/falling edge) via EventManager.
static constexpr std::uintptr_t getTypeKey()
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.
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
Delegates to user or system configuration.
Represents a framework event, optionally carrying payload data.
Structure representing a GPIO event.