ulp-fsm: Update ulp-fsm ADC example with S3 support

Closes https://github.com/espressif/esp-idf/issues/7963
This commit is contained in:
Marius Vikhammer
2022-09-02 16:18:14 +08:00
parent ee2ae1d589
commit 77ba84eeb7
11 changed files with 118 additions and 53 deletions
@@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
/* ULP Example: using ADC in deep sleep
This example code is in the Public Domain (or CC0 licensed, at your option.)
@@ -22,9 +27,9 @@
*/
#include "soc/rtc_cntl_reg.h"
#include "soc/soc_ulp.h"
#include "example_config.h"
/* ADC1 channel 6, GPIO34 */
.set adc_channel, 6
.set adc_channel, EXAMPLE_ADC_CHANNEL
/* Configure the number of ADC samples to average on each measurement.
For convenience, make it a power of 2. */
@@ -0,0 +1,16 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#pragma once
/* Ints are used here to be able to include the file in assembly as well */
#define EXAMPLE_ADC_CHANNEL 6 // ADC_CHANNEL_6, GPIO34 on ESP32, GPIO7 on ESP32-S3
#define EXAMPLE_ADC_UNIT 0 // ADC_UNIT_1
#define EXAMPLE_ADC_ATTEN 3 // ADC_ATTEN_DB_11
#define EXAMPLE_ADC_WIDTH 0 // ADC_BITWIDTH_DEFAULT
/* Set low and high thresholds, approx. 1.35V - 1.75V*/
#define EXAMPLE_ADC_LOW_TRESHOLD 1500
#define EXAMPLE_ADC_HIGH_TRESHOLD 2000