prf::hal::GpioIrqBinding class final

Pico GPIO IRQ binding helper.

This helper centralizes MCU-specific callback registration so higher layers can request edge notifications without including Pico GPIO headers or owning global callback state directly.

Contract:

  • multiple bindings may coexist globally on different GPIO pins,
  • one binding instance owns exactly one GPIO pin at a time,
  • shared ownership of one GPIO pin by multiple bindings is not supported,
  • disabling one binding turns the MCU IRQ source off for that GPIO pin.

Callers must therefore ensure that one physical GPIO pin is managed by only one GpioIrqBinding at a time.

Public types

using Callback = void(*)(uint32_t gpio, uint32_t events, void*user_ctx)
enum class Event: uint32_t { LevelLow = 0x1u, LevelHigh = 0x2u, EdgeFall = 0x4u, EdgeRise = 0x8u }

Constructors, destructors, conversion operators

GpioIrqBinding() defaulted
GpioIrqBinding(const GpioIrqBinding&) deleted
~GpioIrqBinding()

Public functions

void disable()
Disables previously enabled GPIO IRQ binding.
auto enable(const GpioPin& pin, uint32_t events, Callback callback, void* user_ctx) -> bool
Binds edge callback for one GPIO pin.
auto enabled() const -> bool
auto operator=(const GpioIrqBinding&) -> GpioIrqBinding& deleted
auto pin_number() const -> uint32_t

Function documentation

bool prf::hal::GpioIrqBinding::enable(const GpioPin& pin, uint32_t events, Callback callback, void* user_ctx)

Binds edge callback for one GPIO pin.

Returns false when the pin/callback is invalid or when the global binding table has no free slot.