C++ DevKit
C++ set of OOP library
|
This class implement the module device KY040 which is a rotary encoder with a centrl switch push button. More...
#include <ky040.h>
Public Member Functions | |
KY040 (uint central_switch_gpio, uint encoder_clk_gpio, uint encoder_dt_gpio, gpio_irq_callback_t call_back=nullptr, struct_ConfigSwitchButton sw_conf={}, struct_ConfigSwitchButton clk_conf={}) | |
Construct a new KY040 object. | |
void | process_encoder_IRQ (uint32_t event_mask) |
the call back function used to hide encoder from KY040 user | |
UIControlEvent | process_central_switch_event () |
the function used to mask the central switch button from KY040 user | |
void | update_UI_control_event_processor (control_event_processor_t event_processor) |
the update control event processor function used to hide encoder from KY040 user | |
![]() | |
UIController () | |
create a UIController object | |
~UIController () | |
Destroy the UIController object. | |
void | update_current_controlled_object (UIControlledModel *_new_controlled_object) |
if the current controlled object is different from _new_controlled_object, change the current controlled object this new one. By he same time, The controller of the new controlled object is updated. | |
Additional Inherited Members | |
![]() | |
UIControlledModel * | current_controlled_model {nullptr} |
The reference to the Model currently under control. | |
This class implement the module device KY040 which is a rotary encoder with a centrl switch push button.
It inherits from UIController, because most of the time it will be used in a UI context. Otherwise, a separate implementation of RotaryEncoder aand/or SwitchButton will be suficient.
KY040::KY040 | ( | uint | central_switch_gpio, |
uint | encoder_clk_gpio, | ||
uint | encoder_dt_gpio, | ||
gpio_irq_callback_t | call_back = nullptr, | ||
struct_ConfigSwitchButton | sw_conf = {}, | ||
struct_ConfigSwitchButton | clk_conf = {} ) |
Construct a new KY040 object.
central_switch_gpio | The GPIO pin connected to the central switch push button |
encoder_clk_gpio | The GPIO pin connected to the clock signal that trig the IRQ on the rotary encoder |
encoder_dt_gpio | The GPIO pin connected to the data signal that indicates the direction of the rotary encoder |
call_back | The interupt service routine call by the clock signal IRQ |
sw_conf | The central switch push button configuration for debounce processing |
clk_conf | The clock signal configuration for debounce processing |
UIControlEvent KY040::process_central_switch_event | ( | ) |
the function used to mask the central switch button from KY040 user
void KY040::process_encoder_IRQ | ( | uint32_t | event_mask | ) |
the call back function used to hide encoder from KY040 user
event_mask | the IRQ data returned by the interrupt manager |
void KY040::update_UI_control_event_processor | ( | control_event_processor_t | event_processor | ) |
the update control event processor function used to hide encoder from KY040 user
event_processor | a function pointer compliant with control_event_processor_t |