oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Functions
ove::gpio Namespace Reference

Thin C++ wrappers around the oveRTOS GPIO API. More...

Functions

Result< void > configure (unsigned int port, unsigned int pin, ove_gpio_mode_t mode) noexcept
 Configures a GPIO pin with the specified mode.
 
Result< void > set (unsigned int port, unsigned int pin, int value) noexcept
 Drives a GPIO output pin to the specified logic level.
 
Result< int > get (unsigned int port, unsigned int pin) noexcept
 Reads the current logic level of a GPIO pin.
 
Result< void > irq_register (unsigned int port, unsigned int pin, ove_gpio_irq_mode_t mode, ove_gpio_irq_cb callback, void *user_data) noexcept
 Registers an interrupt callback for a GPIO pin.
 
Result< void > irq_enable (unsigned int port, unsigned int pin) noexcept
 Enables the interrupt for a GPIO pin (must be registered first).
 
Result< void > irq_disable (unsigned int port, unsigned int pin) noexcept
 Disables the interrupt for a GPIO pin.
 

Detailed Description

Thin C++ wrappers around the oveRTOS GPIO API.

Available when CONFIG_OVE_GPIO is enabled. Pins are addressed by a (port, pin) tuple following the same convention as the underlying C API.

Function Documentation

◆ configure()

Result< void > ove::gpio::configure ( unsigned int  port,
unsigned int  pin,
ove_gpio_mode_t  mode 
)
inlinenoexcept

Configures a GPIO pin with the specified mode.

Parameters
[in]portGPIO port index.
[in]pinPin number within the port.
[in]modeDesired pin mode.
Returns
Empty Result<void> on success; unexpected Error on failure.

◆ set()

Result< void > ove::gpio::set ( unsigned int  port,
unsigned int  pin,
int  value 
)
inlinenoexcept

Drives a GPIO output pin to the specified logic level.

Parameters
[in]portGPIO port index.
[in]pinPin number within the port.
[in]valueLogic level to drive (0 = low, non-zero = high).
Returns
Empty Result<void> on success; unexpected Error on failure.

◆ get()

Result< int > ove::gpio::get ( unsigned int  port,
unsigned int  pin 
)
inlinenoexcept

Reads the current logic level of a GPIO pin.

Parameters
[in]portGPIO port index.
[in]pinPin number within the port.
Returns
On success, the pin level (0 or 1). On failure, an unexpected Error.

◆ irq_register()

Result< void > ove::gpio::irq_register ( unsigned int  port,
unsigned int  pin,
ove_gpio_irq_mode_t  mode,
ove_gpio_irq_cb  callback,
void *  user_data 
)
inlinenoexcept

Registers an interrupt callback for a GPIO pin.

Parameters
[in]portGPIO port index.
[in]pinPin number within the port.
[in]modeTrigger mode (rising, falling, both edges, etc.).
[in]callbackFunction to call when the interrupt fires.
[in]user_dataOpaque pointer forwarded to the callback.
Returns
Empty Result<void> on success; unexpected Error on failure.

◆ irq_enable()

Result< void > ove::gpio::irq_enable ( unsigned int  port,
unsigned int  pin 
)
inlinenoexcept

Enables the interrupt for a GPIO pin (must be registered first).

Parameters
[in]portGPIO port index.
[in]pinPin number within the port.
Returns
Empty Result<void> on success; unexpected Error on failure.

◆ irq_disable()

Result< void > ove::gpio::irq_disable ( unsigned int  port,
unsigned int  pin 
)
inlinenoexcept

Disables the interrupt for a GPIO pin.

Parameters
[in]portGPIO port index.
[in]pinPin number within the port.
Returns
Empty Result<void> on success; unexpected Error on failure.