C++ DevKit
C++ set of OOP library
|
The RotaryEncoder is a device used to control a value the can be incremented/decremented by the user. It can be associated with UIControlledIncrementalValue. More...
#include <rotary_encoder.h>
Public Member Functions | |
RotaryEncoder (uint encoder_clk_gpio, uint encoder_dt_gpio, gpio_irq_callback_t call_back, control_event_processor_t event_processor, struct_ConfigSwitchButton clk_conf={}) | |
Construct a new Rotary Encoder object. | |
~RotaryEncoder () | |
Destroy the Rotary Encoder object. | |
void | interrupt_service_routine (uint32_t irq_event_mask) |
the ISR that process the IRQ and send UIControlEvent to the Model currentControlledObject. | |
void | update_event_processor (control_event_processor_t event_processor) |
This member is used to update the function pointer to the UIController. | |
![]() | |
void | irq_enabled (bool enabled) |
"AND" function used to enable/disable interrupt during Interrupt Service Routine (ISR) | |
SwitchButtonWithIRQ (uint gpio, gpio_irq_callback_t call_back, struct_ConfigSwitchButton conf={}, uint32_t event_mask_config=GPIO_IRQ_EDGE_FALL|GPIO_IRQ_EDGE_RISE) | |
Construct a new SwitchButtonWithIRQ object. | |
~SwitchButtonWithIRQ () | |
Destroy the SwitchButtonWithIRQ object. | |
UIControlEvent | process_IRQ_event (uint32_t current_event_mask) |
Process IRQ event and return the resulting event. | |
![]() | |
SwitchButton (uint gpio, struct_ConfigSwitchButton conf={}) | |
Construct a new SwitchButton object. | |
~SwitchButton () | |
Destroy the SwitchButton object. | |
UIControlEvent | process_sample_event () |
the periodic routine that process deboucing, push and release of the switch. | |
ButtonState | get_button_status () |
Get the button status object. | |
Additional Inherited Members | |
![]() | |
bool | is_switch_pushed () |
return the status of the switch. | |
![]() | |
uint | debounce_delay_us |
The time during which all changes in the switch state is ignored. | |
uint | long_push_delay_us |
when a button is pushed more than long_push_delay_us (in microseconds) a UIControlEvent::LONG_PUSH is returned. | |
uint | long_release_delay_us |
if the button is released after long_release_delay_us (in microseconds) a UIControlEvent::RELEASED_AFTER_LONG_TIME is returned, else a UIControlEvent::RELEASED_AFTER_SHORT_TIME is released. | |
uint | time_out_delay_us |
if the button is released after time_out_delay_us (in microseconds) a UIControlEvent::TIME_OUT is returned, | |
uint | gpio |
the GPIO that reads the logical state of the switch (pushed or released) | |
bool | active_lo |
his indicates that when the switch is pushed, a logical LO (0) signal is read. | |
uint | previous_change_time_us |
the system time stored on the previous switch state change. | |
bool | previous_switch_pushed_state |
The previous state read during the previous period. | |
ButtonState | button_status {ButtonState::IDLE} |
the logical button status, required to manage the event returned when the switch is pushed or released. | |
The RotaryEncoder is a device used to control a value the can be incremented/decremented by the user. It can be associated with UIControlledIncrementalValue.
A rotary encoder has two signals: one can be considered as a clock (clk) , the other as the data (dt).
Clock signal is produced by rotating the encoder. Each time a falling edge is generated on the clock, the value on dt gives the direction of the rotation.
Due to the short time between clk and dt, we cannot usually sample the signals. IRQ is more appropriate.
As a UIController, the rotary encoder is associated with a Model.
RotaryEncoder::RotaryEncoder | ( | uint | encoder_clk_gpio, |
uint | encoder_dt_gpio, | ||
gpio_irq_callback_t | call_back, | ||
control_event_processor_t | event_processor, | ||
struct_ConfigSwitchButton | clk_conf = {} ) |
Construct a new Rotary Encoder object.
encoder_clk_gpio | |
encoder_dt_gpio | |
call_back | |
event_processor | |
clk_conf |
void RotaryEncoder::interrupt_service_routine | ( | uint32_t | irq_event_mask | ) |
the ISR that process the IRQ and send UIControlEvent to the Model currentControlledObject.
irq_event_mask |
void RotaryEncoder::update_event_processor | ( | control_event_processor_t | event_processor | ) |
This member is used to update the function pointer to the UIController.
Notice: we can not directly points to the bound member!
event_processor |