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

Header File

Functions

esp_periph_handle_t periph_adc_button_init(periph_adc_button_cfg_t *btn_cfg)

Create the button peripheral handle for esp_peripherals.

备注

The handle created by this function is automatically destroyed when esp_periph_destroy is called.

参数

btn_cfg – The button configuration.

返回

The esp peripheral handle.

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

adc_btn_task_cfg_t task_cfg

Adc button task configuration

Macros

ADC_BUTTON_STACK_SIZE
ADC_BUTTON_TASK_PRIORITY
ADC_BUTTON_TASK_CORE_ID
PERIPH_ADC_BUTTON_DEFAULT_CONFIG()
ADC_DEFAULT_ARR()

ESP32 ADC1 channels and GPIO table ADC1_CHANNEL_0 - GPIO36 ADC1_CHANNEL_1 - GPIO37 ADC1_CHANNEL_2 - GPIO38 ADC1_CHANNEL_3 - GPIO39 ADC1_CHANNEL_4 - GPIO32 ADC1_CHANNEL_5 - GPIO33 ADC1_CHANNEL_6 - GPIO34 ADC1_CHANNEL_7 - GPIO35

Enumerations

enum periph_adc_button_event_id_t

Values:

enumerator PERIPH_ADC_BUTTON_IDLE
enumerator PERIPH_ADC_BUTTON_PRESSED
enumerator PERIPH_ADC_BUTTON_RELEASE
enumerator PERIPH_ADC_BUTTON_LONG_PRESSED
enumerator PERIPH_ADC_BUTTON_LONG_RELEASE