Button
Button Utility. More...
Modules | |
Types | |
Button data types. | |
Functions | |
zos_result_t | button_init (zos_gpio_t gpio, const button_config_t *config, void *arg) |
Initialize GPIO as a button. More... | |
void | button_deinit (zos_gpio_t gpio) |
De-initialize button feature for given GPIO. More... | |
zos_bool_t | button_is_active (zos_gpio_t gpio) |
Returns if a button is considered active passed on its configuration. More... | |
zos_result_t | button_update_config (zos_gpio_t gpio, const button_config_t *config) |
Update a button's configuration. More... | |
Detailed Description
Button Utility.
Function Documentation
void button_deinit | ( | zos_gpio_t | gpio | ) |
De-initialize button feature for given GPIO.
- Parameters
-
gpio
GPIO to deinitialized as button
- Examples:
- basic/button/button.c, cloud/simplemq/main.c, and demo/pong/main.c.
zos_result_t button_init | ( | zos_gpio_t | gpio, |
const button_config_t * | config, |
||
void * | arg |
||
) |
Initialize GPIO as a button.
This configures a GPIO as button. This includes the necessary functionality to debounce the button and execute handlers based on the specified configuration.
- Parameters
-
gpio
GPIO to configure as a button config
Button configuration arg
Optional argument to pass to event handlers
- Returns
- zos_result_t result of api call
- Examples:
- basic/button/button.c, cloud/simplemq/main.c, and demo/pong/main.c.
zos_bool_t button_is_active | ( | zos_gpio_t | gpio | ) |
Returns if a button is considered active passed on its configuration.
- Parameters
-
gpio
GPIO to test
- Returns
- ZOS_TRUE if button is active, FALSE else
- Examples:
- demo/pong/game.c.
zos_result_t button_update_config | ( | zos_gpio_t | gpio, |
const button_config_t * | config |
||
) |
Update a button's configuration.
This updates a button configuration including the:
- debounce time
- click_time
- press_time
All other settings are ignored.
- Parameters
-
gpio
GPIO of corresponding button config
Updated configuration
- Returns
- zos_result_t result of api call
- Examples:
- demo/pong/game.c.