Added support for the T-CameraPlus-S3_V1.2 board (#680)

* Adapt for LilyGO-T-Circle-S3 device

* Adapt for LilyGO-T-Circle-S3 device

* Remove comments and modify the size of the lilygo-t-circle-s3 image

* Modify the code style and format to Google C++

* Modify the code style and format to Google C++

* Fixed bugs in the LILYGO T-Circle-S3 board and added support for two new boards: LILYGO T-Display-S3-Pro-MVSRLora and LILYGO T-Display-S3-Pro-MVSRLora_NO_BATTERY.

* Added support for two new boards: LILYGO T-Display-S3-Pro-MVSRLora and LILYGO T-Display-S3-Pro-MVSRLora_NO_BATTERY.

* Merge branch 'main' of https://github.com/Llgok/xiaozhi-esp32

* Added support for two new boards: LILYGO T-Display-S3-Pro-MVSRLora and LILYGO T-Display-S3-Pro-MVSRLora_NO_BATTERY.

* Added support for two new boards: LILYGO T-Display-S3-Pro-MVSRLora and LILYGO T-Display-S3-Pro-MVSRLora_NO_BATTERY.

* Added support for two new boards: LILYGO T-Display-S3-Pro-MVSRLora and LILYGO T-Display-S3-Pro-MVSRLora_NO_BATTERY.

* Added support for two new boards: LILYGO T-Display-S3-Pro-MVSRLora and LILYGO T-Display-S3-Pro-MVSRLora_NO_BATTERY.

* Fix the color display issue for T-Display-S3-Pro-MVSRLora and LILYGO T-Display-S3-Pro-MVSRLora_NO_BATTERY.

* Update T-CameraPlus-S3_V1.2 Version Xiaozhi Example
This commit is contained in:
LILYGO_L
2025-05-27 21:39:48 +08:00
committed by GitHub
parent d80f94387a
commit da62523765
5 changed files with 177 additions and 78 deletions

View File

@@ -116,7 +116,9 @@ elseif(CONFIG_BOARD_TYPE_TUDOUZI)
set(BOARD_TYPE "tudouzi")
elseif(CONFIG_BOARD_TYPE_LILYGO_T_CIRCLE_S3)
set(BOARD_TYPE "lilygo-t-circle-s3")
elseif(CONFIG_BOARD_TYPE_LILYGO_T_CAMERAPLUS_S3)
elseif(CONFIG_BOARD_TYPE_LILYGO_T_CAMERAPLUS_S3_V1_0_V1_1)
set(BOARD_TYPE "lilygo-t-cameraplus-s3")
elseif(CONFIG_BOARD_TYPE_LILYGO_T_CAMERAPLUS_S3_V1_2)
set(BOARD_TYPE "lilygo-t-cameraplus-s3")
elseif(CONFIG_BOARD_TYPE_LILYGO_T_DISPLAY_S3_PRO_MVSRLORA)
set(BOARD_TYPE "lilygo-t-display-s3-pro-mvsrlora")

View File

@@ -110,8 +110,10 @@ choice BOARD_TYPE
bool "土豆子"
config BOARD_TYPE_LILYGO_T_CIRCLE_S3
bool "LILYGO T-Circle-S3"
config BOARD_TYPE_LILYGO_T_CAMERAPLUS_S3
bool "LILYGO T-CameraPlus-S3"
config BOARD_TYPE_LILYGO_T_CAMERAPLUS_S3_V1_0_V1_1
bool "LILYGO T-CameraPlus-S3_V1_0_V1_1"
config BOARD_TYPE_LILYGO_T_CAMERAPLUS_S3_V1_2
bool "LILYGO T-CameraPlus-S3_V1_2"
config BOARD_TYPE_LILYGO_T_DISPLAY_S3_PRO_MVSRLORA
bool "LILYGO T-Display-S3-Pro-MVSRLora"
config BOARD_TYPE_LILYGO_T_DISPLAY_S3_PRO_MVSRLORA_NO_BATTERY

View File

@@ -8,13 +8,21 @@
#define AUDIO_INPUT_SAMPLE_RATE 24000
#define AUDIO_OUTPUT_SAMPLE_RATE 24000
#ifdef CONFIG_BOARD_TYPE_LILYGO_T_CAMERAPLUS_S3_V1_0_V1_1
#define AUDIO_MIC_I2S_GPIO_BCLK static_cast<gpio_num_t>(MSM261_BCLK)
#define AUDIO_MIC_I2S_GPIO_WS static_cast<gpio_num_t>(MSM261_WS)
#define AUDIO_MIC_I2S_GPIO_DATA static_cast<gpio_num_t>(MSM261_DIN)
#define AUDIO_MIC_I2S_GPIO_DATA static_cast<gpio_num_t>(MSM261_DATA)
#elif defined CONFIG_BOARD_TYPE_LILYGO_T_CAMERAPLUS_S3_V1_2
#define AUDIO_MIC_I2S_GPIO_BCLK GPIO_NUM_NC
#define AUDIO_MIC_I2S_GPIO_WS static_cast<gpio_num_t>(MP34DT05TR_LRCLK)
#define AUDIO_MIC_I2S_GPIO_DATA static_cast<gpio_num_t>(MP34DT05TR_DATA)
#define AUDIO_MIC_SPKR_EN static_cast<gpio_num_t>(MP34DT05TR_MAX98357_EN)
#endif
#define AUDIO_SPKR_I2S_GPIO_BCLK static_cast<gpio_num_t>(MAX98357A_BCLK)
#define AUDIO_SPKR_I2S_GPIO_LRCLK static_cast<gpio_num_t>(MAX98357A_LRCLK)
#define AUDIO_SPKR_I2S_GPIO_DATA static_cast<gpio_num_t>(MAX98357A_DOUT)
#define AUDIO_SPKR_I2S_GPIO_DATA static_cast<gpio_num_t>(MAX98357A_DATA)
#define TOUCH_I2C_SDA_PIN static_cast<gpio_num_t>(TP_SDA)
#define TOUCH_I2C_SCL_PIN static_cast<gpio_num_t>(TP_SCL)

View File

@@ -1,96 +1,148 @@
/*
* @Description: None
* @version: V1.0.0
* @Author: None
* @Date: 2023-08-16 14:24:03
* @LastEditors: LILYGO_L
* @LastEditTime: 2023-12-12 10:12:31
* @Author: LILYGO_L
* @Date: 2024-11-11 11:36:49
* @LastEditTime: 2025-04-25 15:53:53
* @License: GPL 3.0
*/
#pragma once
// microSD
#define SD_CS 21
#define SD_SCLK 36
#define SD_MOSI 35
#define SD_MISO 37
#ifdef CONFIG_BOARD_TYPE_LILYGO_T_CAMERAPLUS_S3_V1_0_V1_1
#define T_CameraPlus_S3_V1_0_V1_1
#elif defined CONFIG_BOARD_TYPE_LILYGO_T_CAMERAPLUS_S3_V1_2
#define T_CameraPlus_S3_V1_2
#endif
#ifdef T_CameraPlus_S3_V1_0_V1_1
// SPI
#define SCLK 36
#define MOSI 35
#define MISO 37
// MAX98357A
#define MAX98357A_BCLK 41
#define MAX98357A_LRCLK 42
#define MAX98357A_DOUT 38
// MSM261
#define MSM261_BCLK 18
#define MSM261_WS 39
#define MSM261_DIN 40
// FP-133H01D
#define LCD_WIDTH 240
#define LCD_HEIGHT 240
#define LCD_BL 46
#define LCD_MOSI 35
#define LCD_SCLK 36
#define LCD_CS 34
#define LCD_DC 45
#define LCD_RST 33
// SY6970
#define SY6970_SDA 1
#define SY6970_SCL 2
#define SY6970_Address 0x6A
#define SY6970_INT 47
#define SPI_SCLK 36
#define SPI_MOSI 35
#define SPI_MISO 37
// IIC
#define IIC_SDA 1
#define IIC_SCL 2
// MSM261
#define MSM261_BCLK 18
#define MSM261_WS 39
#define MSM261_DATA 40
// MAX98357A
#define MAX98357A_DATA 38
// FP-133H01D
#define LCD_CS 34
#define LCD_RST 33
// OV2640
#define OV2640_PWDN -1
#define OV2640_RESET 3
#define OV2640_XCLK 7
#define OV2640_SIOD 1
#define OV2640_SIOC 2
#define OV2640_D7 6
#define OV2640_D6 8
#define OV2640_D5 9
#define OV2640_D4 11
#define OV2640_D3 13
#define OV2640_D2 15
#define OV2640_D1 14
#define OV2640_D0 12
#define OV2640_VSYNC 4
// CST816
#define TP_RST 48
// SY6970
#define SY6970_INT 47
#endif
#ifdef T_CameraPlus_S3_V1_2
// SPI
#define SPI_SCLK 35
#define SPI_MOSI 34
#define SPI_MISO 48
// IIC
#define IIC_SDA 33
#define IIC_SCL 37
// MP34DT05TR
#define MP34DT05TR_LRCLK 40
#define MP34DT05TR_DATA 38
#define MP34DT05TR_MAX98357_EN 18
// MAX98357A
#define MAX98357A_DATA 39
// FP-133H01D
#define LCD_CS 36
#define LCD_RST -1
// OV2640
#define OV2640_PWDN 4
#define OV2640_RESET -1
#define OV2640_VSYNC 3
// CST816
#define TP_RST -1
#endif
// SD
#define SD_CS 21
#define SD_SCLK SPI_SCLK
#define SD_MOSI SPI_MOSI
#define SD_MISO SPI_MISO
// MAX98357A
#define MAX98357A_BCLK 41
#define MAX98357A_LRCLK 42
// FP-133H01D
#define LCD_WIDTH 240
#define LCD_HEIGHT 240
#define LCD_BL 46
#define LCD_MOSI SPI_MOSI
#define LCD_SCLK SPI_SCLK
#define LCD_DC 45
// SY6970
#define SY6970_SDA IIC_SDA
#define SY6970_SCL IIC_SCL
#define SY6970_ADDRESS 0x6A
// OV2640
#define OV2640_XCLK 7
#define OV2640_SDA 1
#define OV2640_SCL 2
#define OV2640_D9 6
#define OV2640_D8 8
#define OV2640_D7 9
#define OV2640_D6 11
#define OV2640_D5 13
#define OV2640_D4 15
#define OV2640_D3 14
#define OV2640_D2 12
#define OV2640_HREF 5
#define OV2640_PCLK 10
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 3
#define XCLK_GPIO_NUM 7
#define SIOD_GPIO_NUM 1
#define SIOC_GPIO_NUM 2
#define PWDN_GPIO_NUM OV2640_PWDN
#define RESET_GPIO_NUM OV2640_RESET
#define XCLK_GPIO_NUM OV2640_XCLK
#define SIOD_GPIO_NUM OV2640_SDA
#define SIOC_GPIO_NUM OV2640_SCL
#define Y9_GPIO_NUM 6
#define Y8_GPIO_NUM 8
#define Y7_GPIO_NUM 9
#define Y6_GPIO_NUM 11
#define Y5_GPIO_NUM 13
#define Y4_GPIO_NUM 15
#define Y3_GPIO_NUM 14
#define Y2_GPIO_NUM 12
#define VSYNC_GPIO_NUM 4
#define HREF_GPIO_NUM 5
#define PCLK_GPIO_NUM 10
#define Y9_GPIO_NUM OV2640_D9
#define Y8_GPIO_NUM OV2640_D8
#define Y7_GPIO_NUM OV2640_D7
#define Y6_GPIO_NUM OV2640_D6
#define Y5_GPIO_NUM OV2640_D5
#define Y4_GPIO_NUM OV2640_D4
#define Y3_GPIO_NUM OV2640_D3
#define Y2_GPIO_NUM OV2640_D2
#define VSYNC_GPIO_NUM OV2640_VSYNC
#define HREF_GPIO_NUM OV2640_HREF
#define PCLK_GPIO_NUM OV2640_PCLK
// CST816
#define CST816_Address 0x15
#define TP_SDA 1
#define TP_SCL 2
#define TP_RST 48
#define CST816_ADDRESS 0x15
#define TP_SDA IIC_SDA
#define TP_SCL IIC_SCL
#define TP_INT 47
// AP1511B

View File

@@ -3,6 +3,9 @@
#include <esp_log.h>
#include <driver/i2c_master.h>
#include <driver/i2s_tdm.h>
#include <driver/i2s_pdm.h>
#include "config.h"
static const char TAG[] = "Tcamerapluss3AudioCodec";
@@ -19,6 +22,20 @@ Tcamerapluss3AudioCodec::Tcamerapluss3AudioCodec(int input_sample_rate, int outp
CreateVoiceHardware(mic_bclk, mic_ws, mic_data, spkr_bclk, spkr_lrclk, spkr_data);
ESP_LOGI(TAG, "Tcamerapluss3AudioCodec initialized");
#ifdef CONFIG_BOARD_TYPE_LILYGO_T_CAMERAPLUS_S3_V1_2
gpio_config_t config_mic_spkr_en;
config_mic_spkr_en.pin_bit_mask = BIT64(AUDIO_MIC_SPKR_EN);
config_mic_spkr_en.mode = GPIO_MODE_OUTPUT;
config_mic_spkr_en.pull_up_en = GPIO_PULLUP_ENABLE;
config_mic_spkr_en.pull_down_en = GPIO_PULLDOWN_DISABLE;
config_mic_spkr_en.intr_type = GPIO_INTR_DISABLE;
#if SOC_GPIO_SUPPORT_PIN_HYS_FILTER
config_mic_spkr_en.hys_ctrl_mode = GPIO_HYS_SOFT_ENABLE;
#endif
gpio_config(&config_mic_spkr_en);
gpio_set_level(AUDIO_MIC_SPKR_EN, 0);
#endif
}
Tcamerapluss3AudioCodec::~Tcamerapluss3AudioCodec() {
@@ -41,9 +58,10 @@ void Tcamerapluss3AudioCodec::CreateVoiceHardware(gpio_num_t mic_bclk, gpio_num_
ESP_ERROR_CHECK(i2s_new_channel(&mic_chan_config, NULL, &rx_handle_));
ESP_ERROR_CHECK(i2s_new_channel(&spkr_chan_config, &tx_handle_, NULL));
#ifdef CONFIG_BOARD_TYPE_LILYGO_T_CAMERAPLUS_S3_V1_0_V1_1
i2s_std_config_t mic_config = {
.clk_cfg = {
.sample_rate_hz = (uint32_t)output_sample_rate_,
.sample_rate_hz = (uint32_t)input_sample_rate_,
.clk_src = I2S_CLK_SRC_DEFAULT,
.mclk_multiple = I2S_MCLK_MULTIPLE_256,
#ifdef I2S_HW_VERSION_2
@@ -60,11 +78,29 @@ void Tcamerapluss3AudioCodec::CreateVoiceHardware(gpio_num_t mic_bclk, gpio_num_
.invert_flags = {
.mclk_inv = false,
.bclk_inv = false,
.ws_inv = true // 默认右
.ws_inv = true // 默认右
}
}
};
ESP_ERROR_CHECK(i2s_channel_init_std_mode(rx_handle_, &mic_config));
#elif defined CONFIG_BOARD_TYPE_LILYGO_T_CAMERAPLUS_S3_V1_2
i2s_pdm_rx_config_t mic_config = {
.clk_cfg = I2S_PDM_RX_CLK_DEFAULT_CONFIG(static_cast<uint32_t>(input_sample_rate_)),
/* The data bit-width of PDM mode is fixed to 16 */
.slot_cfg = I2S_PDM_RX_SLOT_DEFAULT_CONFIG(I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_MONO),
.gpio_cfg = {
.clk = mic_ws,
.din = mic_data,
.invert_flags = {
.clk_inv = false,
},
},
};
ESP_ERROR_CHECK(i2s_channel_init_pdm_rx_mode(rx_handle_, &mic_config));
#endif
i2s_std_config_t spkr_config = {
.clk_cfg ={
.sample_rate_hz = static_cast<uint32_t>(11025),
@@ -87,7 +123,6 @@ void Tcamerapluss3AudioCodec::CreateVoiceHardware(gpio_num_t mic_bclk, gpio_num_
}
};
ESP_ERROR_CHECK(i2s_channel_init_std_mode(rx_handle_, &mic_config));
ESP_ERROR_CHECK(i2s_channel_init_std_mode(tx_handle_, &spkr_config));
ESP_LOGI(TAG, "Voice hardware created");
}