Skip to content

Commit

Permalink
add v4.4 idf support (adc, rmt)
Browse files Browse the repository at this point in the history
  • Loading branch information
pborcin committed Nov 8, 2023
1 parent 6847a29 commit 01a8614
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 15 deletions.
4 changes: 3 additions & 1 deletion bsp/esp32_s3_korvo_1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#IDF version is less than IDF5.0
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_LESS "5.0")
set(SRC_VER "esp32_s3_korvo_1_idf4.c")
set(REQ spiffs)
else()
set(SRC_VER "esp32_s3_korvo_1_idf5.c")
set(REQ spiffs esp_adc)
endif()

idf_component_register(
SRCS "esp32_s3_korvo_1.c" ${SRC_VER}
INCLUDE_DIRS "include"
PRIV_INCLUDE_DIRS "priv_include"
REQUIRES spiffs
REQUIRES ${REQ}
)
4 changes: 1 addition & 3 deletions bsp/esp32_s3_korvo_1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

[![Component Registry](https://components.espressif.com/components/espressif/esp32_s3_korvo_1/badge.svg)](https://components.espressif.com/components/espressif/esp32_s3_korvo_1)

* [Hardware Reference](https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c3/esp32-s3-korvo-1/user_guide.html)

ESP32-S3-Korvo-1 is a development kit that is based on Espressif’s ESP32-S3 SoC and ESP-Skainet, Espressif’s speech recognition SDK. It features a three-microphone array which is suitable for far-field voice pick-up with low power consumption. The ESP32-S3-Korvo-1 board supports voice wake-up and offline speech command recognition in Chinese and English languages. With ESP-Skainet, you can develop a variety of speech recognition applications, such as smart displays, smart plugs, smart switches, etc.
ESP32-S3-Korvo-1 is a development kit that is based on Espressif’s ESP32-S3 SoC. It features a three-microphone array which is suitable for far-field voice pick-up with low power consumption.

The ESP32-S3-Korvo-1 board consists of two parts: the main board (ESP32-S3-Korvo-1) that integrates the ESP32-S3-WROOM-1 module, function buttons, SD card slot, speaker and USB connectors; and the sub board (ESP32-Korvo-Mic, which is also used as the sub board in ESP32-Korvo v1.1) that contains a three-microphone array, function buttons, and addressable LEDs. The main board and sub board are connected via FPC cable.

6 changes: 5 additions & 1 deletion bsp/esp32_s3_korvo_1/esp32_s3_korvo_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@ static led_strip_handle_t led_strip;
* This configuration is used by default in bsp_led_init()
*/
static const led_strip_config_t bsp_strip_config = {
.strip_gpio_num = BSP_RGB_CTRL,
.strip_gpio_num = BSP_LED_RGB_IO,
.max_leds = BSP_RGB_LEDS_NUM,
.led_pixel_format = LED_PIXEL_FORMAT_GRB,
.led_model = LED_MODEL_WS2812,
.flags.invert_out = false,
};

static const led_strip_rmt_config_t bsp_rmt_config = {
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
.rmt_channel = 0,
#else
.clk_src = RMT_CLK_SRC_DEFAULT,
.resolution_hz = 10 * 1000 * 1000,
.flags.with_dma = false,
#endif
};

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
Expand Down
11 changes: 10 additions & 1 deletion bsp/esp32_s3_korvo_1/esp32_s3_korvo_1_idf4.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@
#include "esp_err.h"
#include "bsp/esp32_s3_korvo_1.h"
#include "bsp_err_check.h"
#include "esp_adc_cal.h"

static esp_adc_cal_characteristics_t bsp_adc_chars;

esp_err_t bsp_adc_initialize(void)
{
return ESP_OK;
esp_err_t ret = ESP_OK;
BSP_ERROR_CHECK_RETURN_ERR(esp_adc_cal_check_efuse(ESP_ADC_CAL_VAL_EFUSE_TP_FIT));
esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_11, ADC_WIDTH_BIT_DEFAULT, 0, &bsp_adc_chars);

/* ADC1 config */
BSP_ERROR_CHECK_RETURN_ERR(adc1_config_width(ADC_WIDTH_BIT_DEFAULT));
return ret;
}
2 changes: 1 addition & 1 deletion bsp/esp32_s3_korvo_1/esp32_s3_korvo_1_idf5.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

#include "esp_err.h"
#include "esp_log.h"
#include "esp_adc/adc_oneshot.h"
#include "bsp/esp32_s3_korvo_1.h"
#include "bsp_err_check.h"

Expand Down
6 changes: 3 additions & 3 deletions bsp/esp32_s3_korvo_1/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: "1.0.0"
description: Board Support Package for esp32_s3_korvo_1
url: https://github.com/espressif/esp-bsp/tree/master/esp32_s3_korvo_1
description: Board Support Package for ESP32-S3-KORVO-1
url: https://github.com/espressif/esp-bsp/tree/master/bsp/esp32_s3_korvo_1

targets:
- esp32s3

dependencies:
idf: ">=4.4.5"
idf: ">=4.4"

led_strip:
version: "^2"
Expand Down
23 changes: 18 additions & 5 deletions bsp/esp32_s3_korvo_1/include/bsp/esp32_s3_korvo_1.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
* ESP32-S3-Korvo-1 pinout
**************************************************************************************************/

/* Light */
#define BSP_RGB_CTRL (GPIO_NUM_19)
#define BSP_RGB_LEDS_NUM (12)
/* Leds */
#define BSP_LED_RGB_IO (GPIO_NUM_19)
#define BSP_RGB_LEDS_NUM (12)

/* Buttons */
#define BSP_BUTTONS_IO (GPIO_NUM_8) // All 6 buttons mapped to this GPIO

#ifdef __cplusplus
extern "C" {
Expand All @@ -47,6 +50,16 @@ typedef enum {
BSP_BUTTON_NUM,
} bsp_button_t;

/**************************************************************************************************
*
* ADC interface
*
* There are multiple devices connected to ADC peripheral:
* - Buttons
*
* After initialization of ADC, use adc_handle when using ADC driver.
**************************************************************************************************/

#define BSP_ADC_UNIT ADC_UNIT_1

/**
Expand All @@ -59,7 +72,7 @@ typedef enum {
esp_err_t bsp_adc_initialize(void);


// #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
/**
* @brief Get ADC handle
*
Expand All @@ -68,7 +81,7 @@ esp_err_t bsp_adc_initialize(void);
* @return ADC handle
*/
adc_oneshot_unit_handle_t bsp_adc_get_handle(void);
// #endif
#endif

/**
* @brief Initialize all buttons
Expand Down

0 comments on commit 01a8614

Please sign in to comment.