C++ DevKit
C++ set of OOP library
|
SwitchButtonWithIRQ status is processed by an Interrupt Service Routine. It is derived from SwithButton, but debouncing, press and release are processed differently. More...
#include <switch_button.h>
Public Member Functions | |
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. | |
SwitchButtonWithIRQ status is processed by an Interrupt Service Routine. It is derived from SwithButton, but debouncing, press and release are processed differently.
NOTICE: the test program for switch button with IRQ is implemented with the rotary encoder device, which is a good example of what can be done with and without IRQ
SwitchButtonWithIRQ::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.
gpio | The microcontroller GPIO connected to the switch |
call_back | The ISR (interrupt Service Routine) that process IRQ event |
conf | the configuration value of the switch |
event_mask_config | the rising/falling edge configuratio of the irq |
void SwitchButtonWithIRQ::irq_enabled | ( | bool | enabled | ) |
"AND" function used to enable/disable interrupt during Interrupt Service Routine (ISR)
enabled |
UIControlEvent SwitchButtonWithIRQ::process_IRQ_event | ( | uint32_t | current_event_mask | ) |
Process IRQ event and return the resulting event.
current_event_mask |