ADC Button Peripheral

Read status of buttons connected to an ADC input using a resistor ladder. Configuration provides for more than a singe ADC input to read several sets of buttons. For an example hardware implementation please refer to schematic of ESP32-LyraTD-MSC V2.2 Upper Board (PDF).

Application Examples

Implementation of this API is demonstrated in the following example:

API Reference

Functions

esp_periph_handle_t periph_adc_button_init(periph_adc_button_cfg_t *btn_cfg)

Create the button peripheral handle for esp_peripherals.

Note
The handle created by this function is automatically destroyed when esp_periph_destroy is called.
Return
The esp peripheral handle.
Parameters
  • btn_cfg: The button configuration.

Structures

struct periph_adc_button_cfg_t

The configuration of ADC Button.

Public Members

adc_arr_t *arr

An array with configuration of buttons

int arr_size

The array size

Macros

ADC_DEFAULT_ARR

Enumerations

enum periph_adc_button_event_id_t

Values:

PERIPH_ADC_BUTTON_IDLE
PERIPH_ADC_BUTTON_CLICK
PERIPH_ADC_BUTTON_PRESS
PERIPH_ADC_BUTTON_RELEASE