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
12
#ifndef BUTTON_H_
13
#define BUTTON_H_
14
15
#include <stdint.h>
16
#include <stdbool.h>
17
21
typedef
enum
{
22
BUTTON_PRESSED
,
23
BUTTON_RELEASED
24
}
button_event_e
;
25
29
typedef
enum
30
{
32
BUTTON_RES_OK
= 0,
34
BUTTON_RES_INVALID_ID
= 1,
36
BUTTON_RES_INVALID_PARAM
= 2,
38
BUTTON_RES_UNINITIALIZED
= 3
39
}
button_res_e
;
40
48
typedef
void (*
on_button_event_cb
)(uint8_t button_id,
49
button_event_e
event);
50
54
void
Button_init
(
void
);
55
66
button_res_e
Button_register_for_event
(uint8_t button_id,
67
button_event_e
event,
68
on_button_event_cb
cb);
69
79
button_res_e
Button_getState
(uint8_t button_id,
80
bool
* state_p);
81
85
uint8_t
Button_get_number
(
void
);
86
87
#endif
/* BUTTON_H_ */
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:34
BUTTON_RES_OK
@ BUTTON_RES_OK
Definition:
button.h:32
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:48
BUTTON_RES_INVALID_PARAM
@ BUTTON_RES_INVALID_PARAM
Definition:
button.h:36
button_res_e
button_res_e
List of return code.
Definition:
button.h:29
BUTTON_RELEASED
@ BUTTON_RELEASED
Definition:
button.h:23
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:22
Button_get_number
uint8_t Button_get_number(void)
Get number of buttons.
BUTTON_RES_UNINITIALIZED
@ BUTTON_RES_UNINITIALIZED
Definition:
button.h:38
button_event_e
button_event_e
Different events for a button.
Definition:
button.h:21