Button Utility. More...

Modules

Types
Button data types.
 

Functions

gos_result_t gos_button_init (gos_gpio_t gpio, const gos_button_config_t *config, void *arg)
 Initialize GPIO as a button. More...
 
void gos_button_deinit (gos_gpio_t gpio)
 De-initialize button feature for given GPIO. More...
 
bool gos_button_is_active (gos_gpio_t gpio)
 Returns if a button is considered active based on its configuration. More...
 
gos_result_t gos_button_update_config (gos_gpio_t gpio, const gos_button_config_t *config)
 Update a button's configuration. More...
 

Detailed Description

Button Utility.

Function Documentation

◆ gos_button_deinit()

void gos_button_deinit ( gos_gpio_t  gpio)

De-initialize button feature for given GPIO.

Parameters
gpioGPIO to deinitialized as button

◆ gos_button_init()

gos_result_t gos_button_init ( gos_gpio_t  gpio,
const gos_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
gpioGPIO to configure as a button
configButton configuration
argOptional argument to pass to event handlers
Returns
gos_result_t result of api call

◆ gos_button_is_active()

bool gos_button_is_active ( gos_gpio_t  gpio)

Returns if a button is considered active based on its configuration.

Note
The specified GPIO must first be registered as a button using gos_button_init()
Parameters
gpioGPIO to test
Returns
true if button is active, FALSE else

◆ gos_button_update_config()

gos_result_t gos_button_update_config ( gos_gpio_t  gpio,
const gos_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
gpioGPIO of corresponding button
configUpdated configuration
Returns
gos_result_t result of api call