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

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 <rtos_rotary_encoder.h>

Inheritance diagram for rtos_RotaryEncoder:
Inheritance graph
Collaboration diagram for rtos_RotaryEncoder:
Collaboration graph

Public Member Functions

 rtos_RotaryEncoder (uint encoder_clk_gpio, uint encoder_dt_gpio, gpio_irq_callback_t call_back, QueueHandle_t out_control_event_queue, struct_rtosConfigSwitchButton conf={}, uint32_t event_mask_config=GPIO_IRQ_EDGE_FALL|GPIO_IRQ_EDGE_RISE)
 Construct a new Rotary Encoder object compliant with FreeRTOS.
 
 ~rtos_RotaryEncoder ()
 Destroy the Rotary Encoder object.
 
void rtos_process_IRQ_event () override
 Process IRQ event and sent the resulting event to the event queue.
 
- Public Member Functions inherited from rtos_SwitchButton
 rtos_SwitchButton (uint gpio, gpio_irq_callback_t call_back, QueueHandle_t control_event_destination_queue, struct_rtosConfigSwitchButton conf={}, uint32_t event_mask_config=GPIO_IRQ_EDGE_FALL|GPIO_IRQ_EDGE_RISE)
 Construct a new rtos Switch Button object.
 
 ~rtos_SwitchButton ()
 Destroy the SwitchButton object.
 

Private Attributes

uint dt_gpio
 the GPIO pin connected to the Data pin of the rotary encoder
 

Additional Inherited Members

- Public Attributes inherited from rtos_SwitchButton
QueueHandle_t IRQdata_input_queue
 the queue from which IRQ data are received
 
- Protected Member Functions inherited from rtos_SwitchButton
bool is_switch_pushed (uint32_t current_event_mask)
 return the logical status of the switch. It process rising and falling edges of the interrupt, according to the active_lo status of the switch.
 
- Protected Attributes inherited from rtos_SwitchButton
uint debounce_delay_us
 The time during which all changes in the switch state is ignored.
 
uint long_push_delay_ms
 when a button is pushed more than long_push_delay_ms (in milliseconds) 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_ms
 if the button is released after time_out_delay_ms (in milliseconds) 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.
 
QueueHandle_t control_event_queue
 the queue to which the resulting control event is sent
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ rtos_RotaryEncoder()

rtos_RotaryEncoder::rtos_RotaryEncoder ( uint encoder_clk_gpio,
uint encoder_dt_gpio,
gpio_irq_callback_t call_back,
QueueHandle_t out_control_event_queue,
struct_rtosConfigSwitchButton conf = {},
uint32_t event_mask_config = GPIO_IRQ_EDGE_FALL | GPIO_IRQ_EDGE_RISE )

Construct a new Rotary Encoder object compliant with FreeRTOS.

Parameters
encoder_clk_gpioThe GPIO pin connected to the Clock pin of the rotary encoder
encoder_dt_gpioThe GPIO pin connected to the Data pin of the rotary encoder
call_backThe IRQ callback function
out_control_event_queueThe output queue receiving control events
confThe clock configuration (as a debounced switch)
event_mask_configThe IRQ mask configuration
Here is the call graph for this function:

Member Function Documentation

◆ rtos_process_IRQ_event()

void rtos_RotaryEncoder::rtos_process_IRQ_event ( )
overridevirtual

Process IRQ event and sent the resulting event to the event queue.

Reimplemented from rtos_SwitchButton.

Here is the call graph for this function:

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