Wirepas SDK
button.h
Go to the documentation of this file.
1
/* Copyright 2018 Wirepas Ltd. All Rights Reserved.
2
*
3
* See file LICENSE.txt for full license details.
4
*
5
*/
6
11
#include <stdint.h>
12
#include <stdbool.h>
13
17
typedef
enum
{
18
BUTTON_PRESSED
,
19
BUTTON_RELEASED
20
}
button_event_e
;
21
25
typedef
enum
26
{
28
BUTTON_RES_OK
= 0,
30
BUTTON_RES_INVALID_ID
= 1,
31
}
button_res_e
;
32
40
typedef
void (*
on_button_event_cb
)(uint8_t button_id,
41
button_event_e
event);
42
46
void
Button_init
(
void
);
47
58
button_res_e
Button_register_for_event
(uint8_t button_id,
59
button_event_e
event,
60
on_button_event_cb
cb);
61
71
button_res_e
Button_getState
(uint8_t button_id,
72
bool
* state_p);
73
77
uint8_t
Button_get_number
(
void
);
Button_getState
button_res_e Button_getState(uint8_t button_id, bool *state_p)
Get State of a given button.
BUTTON_RES_INVALID_ID
@ BUTTON_RES_INVALID_ID
Definition:
button.h:30
BUTTON_RES_OK
@ BUTTON_RES_OK
Definition:
button.h:28
on_button_event_cb
void(* on_button_event_cb)(uint8_t button_id, button_event_e event)
Callback structure for a button event.
Definition:
button.h:40
button_res_e
button_res_e
List of return code.
Definition:
button.h:25
BUTTON_RELEASED
@ BUTTON_RELEASED
Definition:
button.h:19
Button_register_for_event
button_res_e Button_register_for_event(uint8_t button_id, button_event_e event, on_button_event_cb cb)
Register for a button event.
Button_init
void Button_init(void)
Initialize Button module.
BUTTON_PRESSED
@ BUTTON_PRESSED
Definition:
button.h:18
Button_get_number
uint8_t Button_get_number(void)
Get number of buttons.
button_event_e
button_event_e
Different events for a button.
Definition:
button.h:17