GPIO Interface
GPIO Platform interface
GPIO Overview:
GPIO (General-Purpose Input/Output) is a flexible pin on a microcontroller or integrated circuit that can be configured as an input or output to interact with external hardware. GPIOs serve as the fundamental interface between digital systems and their surrounding environment, enabling communication, control, and data acquisition.
GPIO Supported Modes
The middleware part will be responsible for debouncing the GPIO’s inputs, triggering call backs, sleep mode settings, etc. Technically this is the value addition, RAPIDSEA is going to provide. The GPIO input mode macro (RS_GPIO_INPUT_MODE macro) can be configured in 3 modes.
Mode |
Description |
|---|---|
RS_GPIO_INPUT_MODE_PASS_THROUGH |
No action by middleware |
RS_GPIO_INPUT_MODE_STATIC_DEBOUNCE |
Static number of debounce counts across all inputs. Defined per rs_gpio_process call |
RS_GPIO_INPUT_MODE_DYNAMIC_DEBOUNCE |
Dynamic settings configurable for each input. Defined in milliseconds |
Application Interface
The below table captures the functions that are to be called from the application layer.
Function |
Description |
|---|---|
rs_gpio_callback_enable |
To enable the gpio callback. |
rs_gpio_configure_pin |
To configure the gpio pins. |
rs_gpio_configures_pin |
To configure the arrary of GPIO port pins. |
rs_gpio_set_pin_level |
To set the gpio value to the pin levels. |
rs_gpio_get_pin_level |
To get the gpio value from the pin levels. |
rs_gpio_set_port_levels |
To sets the output levels of the GPIO port group |
rs_gpio_register_interrupt_callback |
To register the gpio interrupt callback. |
Error Code
Every API’s for the GPIO returns some success or failure values. Please refer below section,
Implementation Guide
Users can directly call the API’s though most of them will be called by device drivers.
Configure the GPIO port and pins.
Register the interrupt callback.
Set the gpio pins and get the gpio pins if needed.
The user will have to repeatedly call rs_gpio_process routine when de-bouncing is configured for.
Documentation from the relevant header as follows:
Warning
doxygenfile: Cannot find file “rs_gpio.h