mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
feat(adc): support ADC single ended oneshot and continuous mode on ESP32-S31
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- | -------- |
|
||||
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- | -------- | --------- |
|
||||
|
||||
# ADC DMA Example
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "sdkconfig.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "esp_log.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
@@ -15,7 +16,11 @@
|
||||
|
||||
#define EXAMPLE_ADC_UNIT ADC_UNIT_1
|
||||
#define EXAMPLE_ADC_CONV_MODE ADC_CONV_SINGLE_UNIT_1
|
||||
#if SOC_ADC_ATTEN_NUM <= 1
|
||||
#define EXAMPLE_ADC_ATTEN ADC_ATTEN_DB_0
|
||||
#else
|
||||
#define EXAMPLE_ADC_ATTEN ADC_ATTEN_DB_12
|
||||
#endif
|
||||
#define EXAMPLE_ADC_BIT_WIDTH SOC_ADC_DIGI_MAX_BITWIDTH
|
||||
|
||||
#define EXAMPLE_READ_LEN 256
|
||||
|
||||
@@ -8,7 +8,7 @@ from pytest_embedded_idf.utils import idf_parametrize
|
||||
@pytest.mark.adc
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32c5', 'esp32p4', 'esp32c61'],
|
||||
['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32c5', 'esp32p4', 'esp32c61', 'esp32s31'],
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_adc_continuous(dut: Dut) -> None:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- | -------- |
|
||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- | -------- | --------- |
|
||||
|
||||
# ADC Single Read Example
|
||||
|
||||
|
||||
@@ -41,7 +41,11 @@ const static char *TAG = "EXAMPLE";
|
||||
#define EXAMPLE_ADC2_CHAN0 ADC_CHANNEL_0
|
||||
#endif //#if EXAMPLE_USE_ADC2
|
||||
|
||||
#if SOC_ADC_ATTEN_NUM <= 1
|
||||
#define EXAMPLE_ADC_ATTEN ADC_ATTEN_DB_0
|
||||
#else
|
||||
#define EXAMPLE_ADC_ATTEN ADC_ATTEN_DB_12
|
||||
#endif
|
||||
|
||||
static int adc_raw[2][10];
|
||||
static int voltage[2][10];
|
||||
|
||||
@@ -8,7 +8,7 @@ from pytest_embedded_idf.utils import idf_parametrize
|
||||
@pytest.mark.adc
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32c5', 'esp32p4', 'esp32c61'],
|
||||
['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32c5', 'esp32p4', 'esp32c61', 'esp32s31'],
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_adc_oneshot(dut: Dut) -> None:
|
||||
|
||||
Reference in New Issue
Block a user