GPIO#
The GPIO Interface module provides interfaces for interacting with General-Purpose Input/Output (GPIO) pins within the Sidewalk SDK. These interfaces ensure consistent and platform-independent access to GPIO functionalities, allowing developers to control and monitor digital signals across different hardware platforms.
Modules#
Typedefs#
GPIO Pin IRQ handler.
Functions#
sid_pal_gpio_set_direction is used to set the direction of the GPIO.
sid_pal_gpio_read is used to read data from GPIO pin.
sid_pal_gpio_write is used to write data to the GPIO.
sid_pal_gpio_toggle is used to toggle the GPIO.
sid_pal_gpio_set_irq is used to generate an interrupt based on the configuration and set callbacket function.
sid_pal_gpio_irq_enable is used to disable an interrupt.
sid_pal_gpio_irq_disable is used to disable an interrupt.
sid_pal_gpio_input_mode is used to configure input mode of GPIO.
sid_pal_gpio_output_mode is used to configure output mode of GPIO.
sid_pal_gpio_pull_mode is used to configure pull type of GPIO.
Typedef Documentation#
sid_pal_gpio_irq_handler_t#
typedef void(* sid_pal_gpio_irq_handler_t) (uint32_t gpio_number, void *callback_arg) )(uint32_t gpio_number, void *callback_arg)
GPIO Pin IRQ handler.
Type | Direction | Argument Name | Description |
---|---|---|---|
[in] | gpio_number | The logical GPIO number. | |
[in] | callback_arg | The argument to be passed to the callback function. |
Note
The callback to be called when the configured transition occurs.
Function Documentation#
sid_pal_gpio_set_direction#
sid_error_t sid_pal_gpio_set_direction (uint32_t gpio_number, sid_pal_gpio_direction_t direction)
sid_pal_gpio_set_direction is used to set the direction of the GPIO.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | gpio_number | The logical GPIO number. |
sid_pal_gpio_direction_t | [in] | direction | Direction of GPIO. |
sid_pal_gpio_read#
sid_error_t sid_pal_gpio_read (uint32_t gpio_number, uint8_t * value)
sid_pal_gpio_read is used to read data from GPIO pin.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | gpio_number | The logical GPIO number. |
uint8_t * | [out] | value | Value read from the GPIO. |
sid_pal_gpio_write#
sid_error_t sid_pal_gpio_write (uint32_t gpio_number, uint8_t value)
sid_pal_gpio_write is used to write data to the GPIO.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | gpio_number | The logical GPIO number. |
uint8_t | [out] | value | Value to write to GPIO. |
sid_pal_gpio_toggle#
sid_error_t sid_pal_gpio_toggle (uint32_t gpio_number)
sid_pal_gpio_toggle is used to toggle the GPIO.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | gpio_number | The logical GPIO number. |
sid_pal_gpio_set_irq#
sid_error_t sid_pal_gpio_set_irq (uint32_t gpio_number, sid_pal_gpio_irq_trigger_t irq_trigger, sid_pal_gpio_irq_handler_t gpio_irq_handler, void * callback_arg)
sid_pal_gpio_set_irq is used to generate an interrupt based on the configuration and set callbacket function.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | gpio_number | The logical GPIO number. |
sid_pal_gpio_irq_trigger_t | [in] | irq_trigger | The interrupt config types to generate an interrupt based on the configuration. |
sid_pal_gpio_irq_handler_t | [in] | gpio_irq_handler | The callback function to be called on interrupt. |
void * | [in] | callback_arg | The argument to be passed to the callback function. |
sid_pal_gpio_irq_enable#
sid_error_t sid_pal_gpio_irq_enable (uint32_t gpio_number)
sid_pal_gpio_irq_enable is used to disable an interrupt.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | gpio_number | The logical GPIO number to enable interrupts. |
sid_pal_gpio_irq_disable#
sid_error_t sid_pal_gpio_irq_disable (uint32_t gpio_number)
sid_pal_gpio_irq_disable is used to disable an interrupt.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | gpio_number | The logical GPIO number to disable interrupts. |
sid_pal_gpio_input_mode#
sid_error_t sid_pal_gpio_input_mode (uint32_t gpio_number, sid_pal_gpio_input_t mode)
sid_pal_gpio_input_mode is used to configure input mode of GPIO.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | gpio_number | The logical GPIO number to operate on. |
sid_pal_gpio_input_t | [in] | mode | The input mode to set. |
sid_pal_gpio_output_mode#
sid_error_t sid_pal_gpio_output_mode (uint32_t gpio_number, sid_pal_gpio_output_t mode)
sid_pal_gpio_output_mode is used to configure output mode of GPIO.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | gpio_number | The logical GPIO number to operate on. |
sid_pal_gpio_output_t | [in] | mode | The output mode to set. |
sid_pal_gpio_pull_mode#
sid_error_t sid_pal_gpio_pull_mode (uint32_t gpio_number, sid_pal_gpio_pull_t pull)
sid_pal_gpio_pull_mode is used to configure pull type of GPIO.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | gpio_number | The logical GPIO number to operate on. |
sid_pal_gpio_pull_t | [in] | pull | The pull mode to set. |