Firmware SDK
twr_module_encoder.h
1 #ifndef _TWR_MODULE_ENCODER_H
2 #define _TWR_MODULE_ENCODER_H
3 
4 #include <twr_button.h>
5 
9 
11 
12 typedef enum
13 {
16 
19 
22 
25 
28 
31 
32 
34 
36 
37 void twr_module_encoder_init(void);
38 
40 
41 void twr_module_encoder_deinit(void);
42 
46 
47 void twr_module_encoder_set_event_handler(void (*event_handler)(twr_module_encoder_event_t, void *), void *event_param);
48 
51 
53 
56 
58 
60 
62 
64 
65 #endif // _TWR_MODULE_ENCODER_H
struct twr_button_t twr_button_t
Button instance.
Definition: twr_button.h:32
void twr_module_encoder_set_event_handler(void(*event_handler)(twr_module_encoder_event_t, void *), void *event_param)
Set callback function.
bool twr_module_encoder_is_present(void)
Get Encoder Module is pressent, can use without twr_module_encoder_init.
twr_button_t * twr_module_encoder_get_button_instance(void)
Get encoder button instance.
void twr_module_encoder_init(void)
Initialize Encoder Module.
void twr_module_encoder_deinit(void)
Deinitialize Encoder Module.
int twr_module_encoder_get_increment(void)
Read encoder delta increment (can be positive or negative number)
twr_module_encoder_event_t
Callback events.
@ TWR_MODULE_ENCODER_EVENT_CLICK
Event button clicked (pressed and released within certain time)
@ TWR_MODULE_ENCODER_EVENT_PRESS
Event button pressed.
@ TWR_MODULE_ENCODER_EVENT_HOLD
Event button hold (pressed for longer time)
@ TWR_MODULE_ENCODER_EVENT_ERROR
Event error (module is not present)
@ TWR_MODULE_ENCODER_EVENT_ROTATION
Event rotation.
@ TWR_MODULE_ENCODER_EVENT_RELEASE
Event button released.