C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
KY040 Class Reference

This class implement the module device KY040 which is a rotary encoder with a centrl switch push button. More...

#include <ky040.h>

Inheritance diagram for KY040:
Inheritance graph
Collaboration diagram for KY040:
Collaboration graph

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
 
- Public Member Functions inherited from UIController
 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

- Public Attributes inherited from UIController
UIControlledModelcurrent_controlled_model {nullptr}
 The reference to the Model currently under control.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ KY040()

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.

Parameters
central_switch_gpioThe GPIO pin connected to the central switch push button
encoder_clk_gpioThe GPIO pin connected to the clock signal that trig the IRQ on the rotary encoder
encoder_dt_gpioThe GPIO pin connected to the data signal that indicates the direction of the rotary encoder
call_backThe interupt service routine call by the clock signal IRQ
sw_confThe central switch push button configuration for debounce processing
clk_confThe clock signal configuration for debounce processing
Here is the call graph for this function:

Member Function Documentation

◆ process_central_switch_event()

UIControlEvent KY040::process_central_switch_event ( )

the function used to mask the central switch button from KY040 user

Returns
UIControlEvent

◆ process_encoder_IRQ()

void KY040::process_encoder_IRQ ( uint32_t event_mask)

the call back function used to hide encoder from KY040 user

Parameters
event_maskthe IRQ data returned by the interrupt manager

◆ update_UI_control_event_processor()

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

Parameters
event_processora function pointer compliant with control_event_processor_t

The documentation for this class was generated from the following files: