C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
switch_button.h File Reference
#include "pico/stdio.h"
#include "pico/stdlib.h"
#include <stdio.h>
#include "sw/ui_core/ui_control_event.h"
Include dependency graph for switch_button.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  struct_ConfigSwitchButton
 These are the values used to configure a switch button (0) debounce_delay_us (1) long_release_delay_us (2) long_push_delay_us (3) time_out_delay_us (4) active_lo. More...
 
class  SwitchButton
 SwitchButton status is sampled periodically by software. More...
 
class  SwitchButtonWithIRQ
 SwitchButtonWithIRQ status is processed by an Interrupt Service Routine. It is derived from SwithButton, but debouncing, press and release are processed differently. More...
 

Macros

#define GPIO_HI   true
 the boolean meaning for GPIO_HI
 
#define GPIO_LO   false
 the boolean meaning for GPIO_LO
 
#define DEBOUNCE_us   10000
 the default value for debounce_delay_us
 
#define LONG_RELEASE_DELAY_us   1000000
 the default value for LONG_RELEASE_DELAY_us
 
#define LONG_PUSH_DELAY_us   1000000
 the default value for LONG_PUSH_DELAY_us
 
#define TIME_OUT_DELAY_us   5000000
 the default value for TIME_OUT_DELAY_us
 

Enumerations

enum class  ButtonState { IDLE , ACTIVE , RELEASE_PENDING , TIME_OUT_PENDING }
 The logical state of the switch (0) IDLE (1) ACTIVE (2) RELEASE_PENDING (3) TIME_OUT_PENDING. More...
 

Detailed Description

Author
xiansnn (xians.nosp@m.nn@h.nosp@m.otmai.nosp@m.l.co.nosp@m.m)
Version
0.1
Date
2025-01-11

Enumeration Type Documentation

◆ ButtonState

enum class ButtonState
strong

The logical state of the switch (0) IDLE (1) ACTIVE (2) RELEASE_PENDING (3) TIME_OUT_PENDING.

Enumerator
IDLE 

The button is inactive.

ACTIVE 

the switch has been pushed, the button is active

RELEASE_PENDING 

A long push has been detected, the switch wait to be released.

TIME_OUT_PENDING 

the switch has beeb released, the button wait for next action. If nothing occurs, a time_out event is returned and the button is inactive