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>
|
| 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.
|
| |
|
|
uint32_t | irq_event_mask_config |
| | A memory slot reserved to store the irq_event_mask.
|
| |
|
| 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.
- Note
- WARNING: LONG_PUSH and TIME_OUT cannot be implemented by processing IRQ. NOTICE: SwitchButtonWithIRQ can be associated with UIController only if button belongs to a UI.
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::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.
- Parameters
-
| 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 |
◆ irq_enabled()
| void SwitchButtonWithIRQ::irq_enabled |
( |
bool | enabled | ) |
|
"AND" function used to enable/disable interrupt during Interrupt Service Routine (ISR)
- Parameters
-
◆ is_switch_pushed()
| bool SwitchButtonWithIRQ::is_switch_pushed |
( |
uint32_t | current_event_mask | ) |
|
|
private |
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.
- Parameters
-
- Returns
- true if switch status is read LO (resp. HI) if active_lo is true (resp. false)
-
false if switch status is read HI (resp. LO) if active_lo is true (resp. false)
◆ process_IRQ_event()
| UIControlEvent SwitchButtonWithIRQ::process_IRQ_event |
( |
uint32_t | current_event_mask | ) |
|
Process IRQ event and return the resulting event.
- Parameters
-
- Returns
- UIControlEvent
The documentation for this class was generated from the following files: