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

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

int ove::gpio::configure ( unsigned int  port,
unsigned int  pin,
ove_gpio_mode_t  mode 
)
inline

Configures a GPIO pin with the specified mode.

Parameters
[in]portGPIO port index.
[in]pinPin number within the port.
[in]modeDesired pin mode (input, output, alternate function, etc.).
Returns
OVE_OK on success, or a negative error code.

◆ set()

int ove::gpio::set ( unsigned int  port,
unsigned int  pin,
int  value 
)
inline

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
OVE_OK on success, or a negative error code.

◆ get()

int ove::gpio::get ( unsigned int  port,
unsigned int  pin 
)
inline

Reads the current logic level of a GPIO pin.

Parameters
[in]portGPIO port index.
[in]pinPin number within the port.
Returns
0 or 1 for the pin level, or a negative error code.

◆ irq_register()

int ove::gpio::irq_register ( unsigned int  port,
unsigned int  pin,
ove_gpio_irq_mode_t  mode,
ove_gpio_irq_cb  callback,
void *  user_data 
)
inline

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
OVE_OK on success, or a negative error code.

◆ irq_enable()

int ove::gpio::irq_enable ( unsigned int  port,
unsigned int  pin 
)
inline

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

Parameters
[in]portGPIO port index.
[in]pinPin number within the port.
Returns
OVE_OK on success, or a negative error code.

◆ irq_disable()

int ove::gpio::irq_disable ( unsigned int  port,
unsigned int  pin 
)
inline

Disables the interrupt for a GPIO pin.

Parameters
[in]portGPIO port index.
[in]pinPin number within the port.
Returns
OVE_OK on success, or a negative error code.