Appiko
codebase
peripheral_modules
button_ui.h
1
19
#ifndef CODEBASE_PERIPHERAL_MODULES_BUTTON_UI_H_
20
#define CODEBASE_PERIPHERAL_MODULES_BUTTON_UI_H_
21
35
#include "stdint.h"
36
#include "stdbool.h"
37
#include "ms_timer.h"
38
42
typedef
enum
43
{
44
BUTTON_UI_ACT_CROSS
,
45
BUTTON_UI_ACT_RELEASE
46
}
button_ui_action
;
47
51
typedef
enum
52
{
53
BUTTON_UI_STEP_QUICK
,
54
BUTTON_UI_STEP_SHORT
,
55
BUTTON_UI_STEP_LONG
,
56
BUTTON_UI_STEP_WAKE
,
57
}
button_ui_steps
;
58
65
const
static
uint32_t press_duration[] = {
66
MS_TIMER_TICKS_MS
(100),
67
MS_TIMER_TICKS_MS
(5000),
68
MS_TIMER_TICKS_MS
(15000),
69
0xFFFFFFFF
70
};
71
78
void
button_ui_init
(uint32_t button_pin, uint32_t irq_priority,
79
void
(*button_ui_handler)(
button_ui_steps
step,
button_ui_action
act));
85
void
button_ui_add_tick
(uint32_t ui_ticks);
86
91
void
button_ui_config_wake
(
bool
set_wake_on);
92
93
#endif
/* CODEBASE_PERIPHERAL_MODULES_BUTTON_UI_H_ */
94
BUTTON_UI_ACT_CROSS
When a button press crosses a particular time.
Definition:
button_ui.h:44
BUTTON_UI_STEP_SHORT
For a short button press.
Definition:
button_ui.h:54
button_ui_action
button_ui_action
Definition:
button_ui.h:42
button_ui_init
void button_ui_init(uint32_t button_pin, uint32_t irq_priority, void(*button_ui_handler)(button_ui_steps step, button_ui_action act))
Initialize the button ui event generator module.
Definition:
button_ui.c:66
BUTTON_UI_STEP_LONG
For a long button press.
Definition:
button_ui.h:55
BUTTON_UI_ACT_RELEASE
When a button is released.
Definition:
button_ui.h:45
button_ui_steps
button_ui_steps
Definition:
button_ui.h:51
BUTTON_UI_STEP_QUICK
For a short button press.
Definition:
button_ui.h:53
MS_TIMER_TICKS_MS
#define MS_TIMER_TICKS_MS(ms)
Definition:
ms_timer.h:64
button_ui_config_wake
void button_ui_config_wake(bool set_wake_on)
To enable/disable the button UI GPIOTE IRQ.
Definition:
button_ui.c:128
BUTTON_UI_STEP_WAKE
For the moment a button is pressed.
Definition:
button_ui.h:56
button_ui_add_tick
void button_ui_add_tick(uint32_t ui_ticks)
The ticks that need to be sent to the button UI module for its processing.
Definition:
button_ui.c:86
Generated by
1.8.15