Swadge ESP32-S2
APIs to develop for the Magfest Swadge
Loading...
Searching...
No Matches
hdw-btn.c File Reference

Data Structures

struct  timedEvt_t
 A timestamped button event. More...

Macros

#define DEBOUNCE_HIST_LEN   5
 The number of samples kept in history to debounce buttons.

Functions

void initButtons (const gpio_num_t *pushButtons, uint8_t numPushButtons)
 Initialize GPIO pushbuttons.
void deinitButtons (void)
 Free memory used by the buttons.
void powerDownButtons (void)
 Power down the GPIO pushbuttons.
void powerUpButtons (void)
 Power up the GPIO pushbuttons.
bool checkButtonQueue (buttonEvt_t *evt)
 Service the queue of button events that caused interrupts This only returns a single event, even if there are multiple in the queue This function may be called multiple times in a row to completely empty the queue.

Data Structure Documentation

◆ timedEvt_t

struct timedEvt_t
Data Fields
int32_t state
int32_t time The button state.

Macro Definition Documentation

◆ DEBOUNCE_HIST_LEN

#define DEBOUNCE_HIST_LEN   5

The number of samples kept in history to debounce buttons.

Function Documentation

◆ initButtons()

void initButtons ( const gpio_num_t * pushButtons,
uint8_t numPushButtons )

Initialize GPIO pushbuttons.

Parameters
pushButtonsA list of GPIOs with pushbuttons to initialize. The list should be in the same order as buttonBit_t, starting at PB_UP
numPushButtonsThe number of pushbuttons to initialize

◆ deinitButtons()

void deinitButtons ( void )

Free memory used by the buttons.

◆ powerDownButtons()

void powerDownButtons ( void )

Power down the GPIO pushbuttons.

◆ powerUpButtons()

void powerUpButtons ( void )

Power up the GPIO pushbuttons.

◆ checkButtonQueue()

bool checkButtonQueue ( buttonEvt_t * evt)

Service the queue of button events that caused interrupts This only returns a single event, even if there are multiple in the queue This function may be called multiple times in a row to completely empty the queue.

Parameters
evtIf an event occurred, return it through this argument
Returns
true if an event occurred, false if nothing happened