Sifli button library interface. More...
Data Structures | |
struct | button_cfg_t |
enum | button_action_t { BUTTON_PRESSED = 0, BUTTON_RELEASED = 1, BUTTON_LONG_PRESSED = 2, BUTTON_CLICKED = 3 } |
enum | button_active_state_t { BUTTON_ACTIVE_LOW = 0, BUTTON_ACTIVE_HIGH = 1 } |
typedef void(* | button_handler_t) (int32_t pin, button_action_t button_action) |
int32_t | button_init (button_cfg_t *cfg) |
sf_err_t | button_enable (int32_t id) |
sf_err_t | button_disable (int32_t id) |
bool | button_is_pressed (int32_t id) |
void | button_irq_trigger (int32_t pin) |
sf_err_t | button_update_handler (int32_t id, button_handler_t new_handler) |
Sifli button library interface.
typedef void(* button_handler_t) (int32_t pin, button_action_t button_action) |
Button event handler type.
enum button_action_t |
sf_err_t button_disable | ( | int32_t | id | ) |
Disable specified button detection.
[in] | id | button id allocated by button_init |
SF_EOK | Button detection successfully disabled. Error code otherwise. |
sf_err_t button_enable | ( | int32_t | id | ) |
Enable specified button detection.
[in] | id | button id allocated by button_init |
SF_EOK | button successfully enabled. |
int32_t button_init | ( | button_cfg_t * | cfg | ) |
Initialize the button.
[in] | cfg | button config |
void button_irq_trigger | ( | int32_t | pin | ) |
Emulate the pin IRQ
[in] | pin | pin |
bool button_is_pressed | ( | int32_t | id | ) |
Check if specified button is currently being pressed.
[in] | id | button id allocated by button_init |
sf_err_t button_update_handler | ( | int32_t | id, |
button_handler_t | new_handler | ||
) |
Update button handler
[in] | id | button id allocated by button_init |
[in] | new_handler | new button handler |