Firmware SDK
twr_module_encoder

Driver for Encoder Module. More...

Enumerations

enum  twr_module_encoder_event_t {
  TWR_MODULE_ENCODER_EVENT_ROTATION = 0 ,
  TWR_MODULE_ENCODER_EVENT_PRESS = 1 ,
  TWR_MODULE_ENCODER_EVENT_RELEASE = 2 ,
  TWR_MODULE_ENCODER_EVENT_CLICK = 3 ,
  TWR_MODULE_ENCODER_EVENT_HOLD = 4 ,
  TWR_MODULE_ENCODER_EVENT_ERROR = 5
}
 Callback events. More...
 

Functions

void twr_module_encoder_init (void)
 Initialize Encoder Module.
 
void twr_module_encoder_deinit (void)
 Deinitialize Encoder Module.
 
void twr_module_encoder_set_event_handler (void(*event_handler)(twr_module_encoder_event_t, void *), void *event_param)
 Set callback function. More...
 
twr_button_ttwr_module_encoder_get_button_instance (void)
 Get encoder button instance. More...
 
int twr_module_encoder_get_increment (void)
 Read encoder delta increment (can be positive or negative number) More...
 
bool twr_module_encoder_is_present (void)
 Get Encoder Module is pressent, can use without twr_module_encoder_init.
 

Detailed Description

Driver for Encoder Module.

Enumeration Type Documentation

◆ twr_module_encoder_event_t

Callback events.

Enumerator
TWR_MODULE_ENCODER_EVENT_ROTATION 

Event rotation.

TWR_MODULE_ENCODER_EVENT_PRESS 

Event button pressed.

TWR_MODULE_ENCODER_EVENT_RELEASE 

Event button released.

TWR_MODULE_ENCODER_EVENT_CLICK 

Event button clicked (pressed and released within certain time)

TWR_MODULE_ENCODER_EVENT_HOLD 

Event button hold (pressed for longer time)

TWR_MODULE_ENCODER_EVENT_ERROR 

Event error (module is not present)

Definition at line 12 of file twr_module_encoder.h.

Function Documentation

◆ twr_module_encoder_get_button_instance()

twr_button_t* twr_module_encoder_get_button_instance ( void  )

Get encoder button instance.

Returns
Pointer to button instance

Definition at line 70 of file twr_module_encoder.c.

◆ twr_module_encoder_get_increment()

int twr_module_encoder_get_increment ( void  )

Read encoder delta increment (can be positive or negative number)

Returns
Delta increment

Definition at line 75 of file twr_module_encoder.c.

◆ twr_module_encoder_set_event_handler()

void twr_module_encoder_set_event_handler ( void(*)(twr_module_encoder_event_t, void *)  event_handler,
void *  event_param 
)

Set callback function.

Parameters
[in]event_handlerFunction address
[in]event_paramOptional event parameter (can be NULL)

Definition at line 63 of file twr_module_encoder.c.