mirror of
https://github.com/78/xiaozhi-esp32.git
synced 2026-01-14 01:07:30 +08:00
add support for Wireless-Tag WTP4C5MP07S ESP32P4 board + 7 inch MIPI DSI LCD display combo (#1281)
* add support for Wireless-Tag WTP4C5MP07S ESP32P4 + 7 inch MIPI DSI LCD display combo * a minor update of README * update of the device name/folder * exclude USE_DEVICE_AEC from the options list
This commit is contained in:
parent
1ccd5108c3
commit
4854bda302
@ -509,6 +509,11 @@ elseif(CONFIG_BOARD_TYPE_YUNLIAO_S3)
|
||||
set(BUILTIN_TEXT_FONT font_puhui_basic_20_4)
|
||||
set(BUILTIN_ICON_FONT font_awesome_20_4)
|
||||
set(DEFAULT_EMOJI_COLLECTION twemoji_64)
|
||||
elseif(CONFIG_BOARD_TYPE_WTP4C5MP07S)
|
||||
set(BOARD_TYPE "wireless-tag-wtp4c5mp07s")
|
||||
set(BUILTIN_TEXT_FONT font_puhui_basic_30_4)
|
||||
set(BUILTIN_ICON_FONT font_awesome_30_4)
|
||||
set(DEFAULT_EMOJI_COLLECTION twemoji_64)
|
||||
endif()
|
||||
|
||||
file(GLOB BOARD_SOURCES
|
||||
|
||||
@ -386,6 +386,9 @@ choice BOARD_TYPE
|
||||
config BOARD_TYPE_YUNLIAO_S3
|
||||
bool "小智云聊-S3"
|
||||
depends on IDF_TARGET_ESP32S3
|
||||
config BOARD_TYPE_WTP4C5MP07S
|
||||
bool "Wireless-Tag WTP4C5MP07S"
|
||||
depends on IDF_TARGET_ESP32P4
|
||||
endchoice
|
||||
|
||||
choice
|
||||
|
||||
45
main/boards/wireless-tag-wtp4c5mp07s/README.md
Normal file
45
main/boards/wireless-tag-wtp4c5mp07s/README.md
Normal file
@ -0,0 +1,45 @@
|
||||
## Wireless-Tag WTP4C5MP07S
|
||||
|
||||
[Wireless-Tag WTP4C5MP07S](https://shop.wireless-tag.com/products/7inch-lcd-touch-screen-1024x600-mipi-smart-displays-wtp4c5mp07s-esp32-lcd-board-used-with-esp32-p4-and-esp32-c5-dev-board) product is a combo of
|
||||
* [Wireless-Tag WT99P4C5-S1](https://en.wireless-tag.com/product-item-66.html) ESP32-P4 development board and
|
||||
* 7 inch 1024x600 ZX7D00C1060M002A MIPI DSI LCD display
|
||||
|
||||
<br>
|
||||
|
||||
## Configuration
|
||||
|
||||
### ESP32P4 Configuration
|
||||
|
||||
* Set the compilation target to ESP32P4
|
||||
|
||||
idf.py set-target esp32p4
|
||||
|
||||
* Open menuconfig
|
||||
|
||||
idf.py menuconfig
|
||||
|
||||
* Select the board
|
||||
|
||||
Xiaozhi Assistant -> Board Type -> Wireless-Tag WTP4C5MP07S
|
||||
|
||||
* Select PSRAM
|
||||
|
||||
Component config -> ESP PSRAM -> PSRAM config -> Try to allocate memories of WiFi and LWIP in SPIRAM firstly -> No
|
||||
|
||||
* Select Wi-Fi slave target
|
||||
|
||||
Component config -> Wi-Fi Remote -> choose slave target -> esp32c5
|
||||
|
||||
* Select Wi-Fi buffers
|
||||
|
||||
Component config -> Wi-Fi Remote -> Wi-Fi configuration -> Max number of WiFi static RX buffers -> 10
|
||||
Component config -> Wi-Fi Remote -> Wi-Fi configuration -> Max number of WiFi dynamic RX buffers -> 24
|
||||
Component config -> Wi-Fi Remote -> Wi-Fi configuration -> Max number of WiFi static TX buffers -> 10
|
||||
|
||||
* Build
|
||||
|
||||
idf.py build
|
||||
|
||||
### ESP32C5 Configuration
|
||||
|
||||
* Flash the slave example from the esp-hosted-mcu library for the target chip ESP32C5. The esp-hosted-mcu version must match the one used in the xiaozhi-esp32 library.
|
||||
104
main/boards/wireless-tag-wtp4c5mp07s/config.h
Normal file
104
main/boards/wireless-tag-wtp4c5mp07s/config.h
Normal file
@ -0,0 +1,104 @@
|
||||
#ifndef _BOARD_CONFIG_H_
|
||||
#define _BOARD_CONFIG_H_
|
||||
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#define AUDIO_INPUT_SAMPLE_RATE 24000
|
||||
#define AUDIO_OUTPUT_SAMPLE_RATE 24000
|
||||
|
||||
#define AUDIO_INPUT_REFERENCE true
|
||||
|
||||
#define AUDIO_I2S_GPIO_MCLK GPIO_NUM_13
|
||||
#define AUDIO_I2S_GPIO_WS GPIO_NUM_10
|
||||
#define AUDIO_I2S_GPIO_BCLK GPIO_NUM_12
|
||||
#define AUDIO_I2S_GPIO_DIN GPIO_NUM_11
|
||||
#define AUDIO_I2S_GPIO_DOUT GPIO_NUM_9
|
||||
|
||||
#define AUDIO_CODEC_PA_PIN GPIO_NUM_53
|
||||
#define AUDIO_CODEC_I2C_SDA_PIN GPIO_NUM_7
|
||||
#define AUDIO_CODEC_I2C_SCL_PIN GPIO_NUM_8
|
||||
#define AUDIO_CODEC_ES8311_ADDR ES8311_CODEC_DEFAULT_ADDR
|
||||
|
||||
#define BOOT_BUTTON_GPIO GPIO_NUM_35
|
||||
|
||||
#define DISPLAY_WIDTH 1024
|
||||
#define DISPLAY_HEIGHT 600
|
||||
|
||||
#define LCD_BIT_PER_PIXEL (16)
|
||||
#define PIN_NUM_LCD_RST GPIO_NUM_23
|
||||
|
||||
#define DELAY_TIME_MS (3000)
|
||||
#define LCD_MIPI_DSI_LANE_NUM (2) // 2 data lanes
|
||||
|
||||
#define MIPI_DSI_PHY_PWR_LDO_CHAN (3)
|
||||
#define MIPI_DSI_PHY_PWR_LDO_VOLTAGE_MV (2500)
|
||||
|
||||
#define DISPLAY_SWAP_XY false
|
||||
#define DISPLAY_MIRROR_X false
|
||||
#define DISPLAY_MIRROR_Y false
|
||||
|
||||
#define DISPLAY_OFFSET_X 0
|
||||
#define DISPLAY_OFFSET_Y 0
|
||||
|
||||
#define DISPLAY_BACKLIGHT_PIN GPIO_NUM_20
|
||||
#define DISPLAY_BACKLIGHT_OUTPUT_INVERT false
|
||||
|
||||
// SD Card configuration (disabled by default)
|
||||
// Enable one of the following by setting to 1 and set pins accordingly.
|
||||
// Note: SDMMC may conflict with ESP-Hosted SDIO. If using ESP-Hosted via SDIO,
|
||||
// prefer SDSPI mode for SD card or disable hosted SDIO.
|
||||
|
||||
// SDMMC 1-bit/4-bit mode
|
||||
#ifndef SDCARD_SDMMC_ENABLED
|
||||
#define SDCARD_SDMMC_ENABLED 0
|
||||
#endif
|
||||
// SDMMC bus width: set to 1 or 4
|
||||
#ifndef SDCARD_SDMMC_BUS_WIDTH
|
||||
// Use 4-bit bus width when enabling SDMMC
|
||||
#define SDCARD_SDMMC_BUS_WIDTH 4
|
||||
#endif
|
||||
// SDMMC pin assignments (set to actual pins when enabling SDMMC)
|
||||
#ifndef SDCARD_SDMMC_CLK_PIN
|
||||
#define SDCARD_SDMMC_CLK_PIN GPIO_NUM_43 // BSP_SD_CLK
|
||||
#endif
|
||||
#ifndef SDCARD_SDMMC_CMD_PIN
|
||||
#define SDCARD_SDMMC_CMD_PIN GPIO_NUM_44 // BSP_SD_CMD
|
||||
#endif
|
||||
#ifndef SDCARD_SDMMC_D0_PIN
|
||||
#define SDCARD_SDMMC_D0_PIN GPIO_NUM_39 // BSP_SD_D0
|
||||
#endif
|
||||
#ifndef SDCARD_SDMMC_D1_PIN
|
||||
#define SDCARD_SDMMC_D1_PIN GPIO_NUM_40 // BSP_SD_D1
|
||||
#endif
|
||||
#ifndef SDCARD_SDMMC_D2_PIN
|
||||
#define SDCARD_SDMMC_D2_PIN GPIO_NUM_41 // BSP_SD_D2
|
||||
#endif
|
||||
#ifndef SDCARD_SDMMC_D3_PIN
|
||||
#define SDCARD_SDMMC_D3_PIN GPIO_NUM_42 // BSP_SD_D3
|
||||
#endif
|
||||
|
||||
// SDSPI mode (uses SPI bus)
|
||||
#ifndef SDCARD_SDSPI_ENABLED
|
||||
#define SDCARD_SDSPI_ENABLED 1
|
||||
#endif
|
||||
#ifndef SDCARD_SPI_HOST
|
||||
#define SDCARD_SPI_HOST SPI3_HOST
|
||||
#endif
|
||||
#ifndef SDCARD_SPI_MOSI
|
||||
#define SDCARD_SPI_MOSI GPIO_NUM_44 // BSP_SD_SPI_MOSI
|
||||
#endif
|
||||
#ifndef SDCARD_SPI_MISO
|
||||
#define SDCARD_SPI_MISO GPIO_NUM_39 // BSP_SD_SPI_MISO
|
||||
#endif
|
||||
#ifndef SDCARD_SPI_SCLK
|
||||
#define SDCARD_SPI_SCLK GPIO_NUM_43 // BSP_SD_SPI_CLK
|
||||
#endif
|
||||
#ifndef SDCARD_SPI_CS
|
||||
#define SDCARD_SPI_CS GPIO_NUM_42 // BSP_SD_SPI_CS
|
||||
#endif
|
||||
|
||||
#ifndef SDCARD_MOUNT_POINT
|
||||
#define SDCARD_MOUNT_POINT "/sdcard"
|
||||
#endif
|
||||
|
||||
#endif // _BOARD_CONFIG_H_
|
||||
16
main/boards/wireless-tag-wtp4c5mp07s/config.json
Normal file
16
main/boards/wireless-tag-wtp4c5mp07s/config.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"target": "esp32p4",
|
||||
"builds": [
|
||||
{
|
||||
"name": "wireless-tag-wtp4c5mp07s",
|
||||
"sdkconfig_append": [
|
||||
"CONFIG_USE_WECHAT_MESSAGE_STYLE=n",
|
||||
"CONFIG_SLAVE_IDF_TARGET_ESP32C5=y",
|
||||
"CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=n",
|
||||
"CONFIG_WIFI_RMT_STATIC_RX_BUFFER_NUM=10",
|
||||
"CONFIG_WIFI_RMT_DYNAMIC_RX_BUFFER_NUM=24",
|
||||
"CONFIG_WIFI_RMT_STATIC_TX_BUFFER_NUM=10"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
296
main/boards/wireless-tag-wtp4c5mp07s/wireless-tag-wtp4c5mp07s.cc
Normal file
296
main/boards/wireless-tag-wtp4c5mp07s/wireless-tag-wtp4c5mp07s.cc
Normal file
@ -0,0 +1,296 @@
|
||||
#include "wifi_board.h"
|
||||
#include "codecs/es8311_audio_codec.h"
|
||||
#include "application.h"
|
||||
#include "display/lcd_display.h"
|
||||
// #include "display/no_display.h"
|
||||
#include "button.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "esp_lcd_panel_ops.h"
|
||||
#include "esp_lcd_mipi_dsi.h"
|
||||
#include "esp_ldo_regulator.h"
|
||||
|
||||
#include "esp_lcd_ek79007.h"
|
||||
|
||||
#include <wifi_station.h>
|
||||
#include <esp_log.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <esp_lvgl_port.h>
|
||||
#include "esp_lcd_touch_gt911.h"
|
||||
|
||||
#include <esp_vfs_fat.h>
|
||||
#include <sdmmc_cmd.h>
|
||||
#include <driver/sdmmc_host.h>
|
||||
#include <driver/sdspi_host.h>
|
||||
#include "sd_pwr_ctrl_by_on_chip_ldo.h"
|
||||
|
||||
#define TAG "WirelessTagEsp32p47b"
|
||||
|
||||
class WirelessTagEsp32p47b : public WifiBoard {
|
||||
private:
|
||||
i2c_master_bus_handle_t i2c_bus_;
|
||||
Button boot_button_;
|
||||
LcdDisplay *display_;
|
||||
|
||||
void InitializeCodecI2c() {
|
||||
// Initialize I2C peripheral
|
||||
i2c_master_bus_config_t i2c_bus_cfg = {
|
||||
.i2c_port = I2C_NUM_1,
|
||||
.sda_io_num = AUDIO_CODEC_I2C_SDA_PIN,
|
||||
.scl_io_num = AUDIO_CODEC_I2C_SCL_PIN,
|
||||
.clk_source = I2C_CLK_SRC_DEFAULT,
|
||||
.glitch_ignore_cnt = 7,
|
||||
.intr_priority = 0,
|
||||
.trans_queue_depth = 0,
|
||||
.flags = {
|
||||
.enable_internal_pullup = 1,
|
||||
},
|
||||
};
|
||||
ESP_ERROR_CHECK(i2c_new_master_bus(&i2c_bus_cfg, &i2c_bus_));
|
||||
}
|
||||
|
||||
static esp_err_t bsp_enable_dsi_phy_power(void) {
|
||||
#if MIPI_DSI_PHY_PWR_LDO_CHAN > 0
|
||||
// Turn on the power for MIPI DSI PHY, so it can go from "No Power" state to "Shutdown" state
|
||||
static esp_ldo_channel_handle_t phy_pwr_chan = NULL;
|
||||
esp_ldo_channel_config_t ldo_cfg = {
|
||||
.chan_id = MIPI_DSI_PHY_PWR_LDO_CHAN,
|
||||
.voltage_mv = MIPI_DSI_PHY_PWR_LDO_VOLTAGE_MV,
|
||||
};
|
||||
esp_ldo_acquire_channel(&ldo_cfg, &phy_pwr_chan);
|
||||
ESP_LOGI(TAG, "MIPI DSI PHY Powered on");
|
||||
#endif // BSP_MIPI_DSI_PHY_PWR_LDO_CHAN > 0
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
void InitializeLCD() {
|
||||
bsp_enable_dsi_phy_power();
|
||||
esp_lcd_panel_io_handle_t io = NULL;
|
||||
esp_lcd_panel_handle_t disp_panel = NULL;
|
||||
|
||||
esp_lcd_dsi_bus_handle_t mipi_dsi_bus = NULL;
|
||||
esp_lcd_dsi_bus_config_t bus_config = {
|
||||
.bus_id = 0,
|
||||
.num_data_lanes = 2,
|
||||
.phy_clk_src = MIPI_DSI_PHY_CLK_SRC_DEFAULT,
|
||||
.lane_bit_rate_mbps = 900,
|
||||
};
|
||||
esp_lcd_new_dsi_bus(&bus_config, &mipi_dsi_bus);
|
||||
|
||||
ESP_LOGI(TAG, "Install MIPI DSI LCD control panel");
|
||||
// we use DBI interface to send LCD commands and parameters
|
||||
esp_lcd_dbi_io_config_t dbi_config = EK79007_PANEL_IO_DBI_CONFIG();
|
||||
esp_lcd_new_panel_io_dbi(mipi_dsi_bus, &dbi_config, &io);
|
||||
|
||||
esp_lcd_dpi_panel_config_t dpi_config = {
|
||||
.dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT,
|
||||
.dpi_clock_freq_mhz = 52,
|
||||
.pixel_format = LCD_COLOR_PIXEL_FORMAT_RGB565,
|
||||
.num_fbs = 1,
|
||||
.video_timing = {
|
||||
.h_size = 1024,
|
||||
.v_size = 600,
|
||||
.hsync_pulse_width = 10,
|
||||
.hsync_back_porch = 160,
|
||||
.hsync_front_porch = 160,
|
||||
.vsync_pulse_width = 1,
|
||||
.vsync_back_porch = 23,
|
||||
.vsync_front_porch = 12,
|
||||
},
|
||||
.flags = {
|
||||
.use_dma2d = true,
|
||||
},
|
||||
};
|
||||
ek79007_vendor_config_t vendor_config = {
|
||||
.mipi_config = {
|
||||
.dsi_bus = mipi_dsi_bus,
|
||||
.dpi_config = &dpi_config,
|
||||
},
|
||||
};
|
||||
|
||||
const esp_lcd_panel_dev_config_t lcd_dev_config = {
|
||||
.reset_gpio_num = PIN_NUM_LCD_RST,
|
||||
.rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB,
|
||||
.bits_per_pixel = 16,
|
||||
.flags = {
|
||||
.reset_active_high = true,
|
||||
},
|
||||
.vendor_config = &vendor_config,
|
||||
};
|
||||
esp_lcd_new_panel_ek79007(io, &lcd_dev_config, &disp_panel);
|
||||
esp_lcd_panel_reset(disp_panel);
|
||||
esp_lcd_panel_init(disp_panel);
|
||||
|
||||
display_ = new MipiLcdDisplay(io, disp_panel, DISPLAY_WIDTH, DISPLAY_HEIGHT,
|
||||
DISPLAY_OFFSET_X, DISPLAY_OFFSET_Y, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y, DISPLAY_SWAP_XY);
|
||||
#if 0
|
||||
lv_display_t *disp = lv_display_get_default();
|
||||
if (disp) {
|
||||
lv_disp_set_rotation(disp, LV_DISPLAY_ROTATION_180);
|
||||
ESP_LOGI(TAG, "Display rotated 180 degrees");
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Failed to get default display for rotation");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void InitializeTouch()
|
||||
{
|
||||
esp_lcd_touch_handle_t tp;
|
||||
esp_lcd_touch_config_t tp_cfg = {
|
||||
.x_max = DISPLAY_WIDTH,
|
||||
.y_max = DISPLAY_HEIGHT,
|
||||
.rst_gpio_num = GPIO_NUM_NC,
|
||||
.int_gpio_num = GPIO_NUM_21,
|
||||
.levels = {
|
||||
.reset = 1,
|
||||
.interrupt = 0,
|
||||
},
|
||||
.flags = {
|
||||
.swap_xy = DISPLAY_SWAP_XY,
|
||||
.mirror_x = DISPLAY_MIRROR_X,
|
||||
.mirror_y = DISPLAY_MIRROR_Y,
|
||||
},
|
||||
};
|
||||
esp_lcd_panel_io_handle_t tp_io_handle = NULL;
|
||||
esp_lcd_panel_io_i2c_config_t tp_io_config = ESP_LCD_TOUCH_IO_I2C_GT911_CONFIG();
|
||||
tp_io_config.scl_speed_hz = 400 * 1000;
|
||||
ESP_ERROR_CHECK(esp_lcd_new_panel_io_i2c(i2c_bus_, &tp_io_config, &tp_io_handle));
|
||||
ESP_LOGI(TAG, "Initialize touch controller");
|
||||
ESP_ERROR_CHECK(esp_lcd_touch_new_i2c_gt911(tp_io_handle, &tp_cfg, &tp));
|
||||
const lvgl_port_touch_cfg_t touch_cfg = {
|
||||
.disp = lv_display_get_default(),
|
||||
.handle = tp,
|
||||
};
|
||||
lvgl_port_add_touch(&touch_cfg);
|
||||
ESP_LOGI(TAG, "Touch panel initialized successfully");
|
||||
}
|
||||
|
||||
void InitializeButtons() {
|
||||
boot_button_.OnClick([this]() {
|
||||
auto& app = Application::GetInstance();
|
||||
if (app.GetDeviceState() == kDeviceStateStarting && !WifiStation::GetInstance().IsConnected()) {
|
||||
ResetWifiConfiguration();
|
||||
}
|
||||
app.ToggleChatState(); });
|
||||
}
|
||||
|
||||
void InitializeSdCard() {
|
||||
#if SDCARD_SDMMC_ENABLED
|
||||
sd_pwr_ctrl_handle_t sd_ldo = NULL;
|
||||
sd_pwr_ctrl_ldo_config_t ldo_cfg = { .ldo_chan_id = 4 };
|
||||
if (sd_pwr_ctrl_new_on_chip_ldo(&ldo_cfg, &sd_ldo) == ESP_OK) {
|
||||
ESP_LOGI(TAG, "SD LDO channel 4 enabled");
|
||||
} else {
|
||||
ESP_LOGW(TAG, "Failed to enable SD LDO channel 4");
|
||||
}
|
||||
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
|
||||
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
|
||||
// Map pins via GPIO matrix if needed
|
||||
slot_config.clk = SDCARD_SDMMC_CLK_PIN;
|
||||
slot_config.cmd = SDCARD_SDMMC_CMD_PIN;
|
||||
slot_config.d0 = SDCARD_SDMMC_D0_PIN;
|
||||
slot_config.width = SDCARD_SDMMC_BUS_WIDTH;
|
||||
if (SDCARD_SDMMC_BUS_WIDTH == 4) {
|
||||
slot_config.d1 = SDCARD_SDMMC_D1_PIN;
|
||||
slot_config.d2 = SDCARD_SDMMC_D2_PIN;
|
||||
slot_config.d3 = SDCARD_SDMMC_D3_PIN;
|
||||
}
|
||||
|
||||
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
|
||||
.format_if_mount_failed = false,
|
||||
.max_files = 5,
|
||||
.allocation_unit_size = 0,
|
||||
.disk_status_check_enable = true,
|
||||
};
|
||||
sdmmc_card_t* card;
|
||||
host.pwr_ctrl_handle = sd_ldo;
|
||||
esp_err_t ret = esp_vfs_fat_sdmmc_mount(SDCARD_MOUNT_POINT, &host, &slot_config, &mount_config, &card);
|
||||
if (ret == ESP_OK) {
|
||||
sdmmc_card_print_info(stdout, card);
|
||||
ESP_LOGI(TAG, "SD card mounted at %s (SDMMC)", SDCARD_MOUNT_POINT);
|
||||
} else {
|
||||
ESP_LOGW(TAG, "Failed to mount SD card (SDMMC): %s", esp_err_to_name(ret));
|
||||
}
|
||||
#elif SDCARD_SDSPI_ENABLED
|
||||
sd_pwr_ctrl_handle_t sd_ldo = NULL;
|
||||
sd_pwr_ctrl_ldo_config_t ldo_cfg = { .ldo_chan_id = 4 };
|
||||
if (sd_pwr_ctrl_new_on_chip_ldo(&ldo_cfg, &sd_ldo) == ESP_OK) {
|
||||
ESP_LOGI(TAG, "SD LDO channel 4 enabled");
|
||||
} else {
|
||||
ESP_LOGW(TAG, "Failed to enable SD LDO channel 4");
|
||||
}
|
||||
sdmmc_host_t host = SDSPI_HOST_DEFAULT();
|
||||
spi_bus_config_t bus_cfg = {
|
||||
.mosi_io_num = SDCARD_SPI_MOSI,
|
||||
.miso_io_num = SDCARD_SPI_MISO,
|
||||
.sclk_io_num = SDCARD_SPI_SCLK,
|
||||
.quadwp_io_num = -1,
|
||||
.quadhd_io_num = -1,
|
||||
.max_transfer_sz = 4000,
|
||||
};
|
||||
ESP_ERROR_CHECK_WITHOUT_ABORT(spi_bus_initialize((spi_host_device_t)SDCARD_SPI_HOST, &bus_cfg, SPI_DMA_CH_AUTO));
|
||||
sdspi_device_config_t slot_config = SDSPI_DEVICE_CONFIG_DEFAULT();
|
||||
slot_config.gpio_cs = SDCARD_SPI_CS;
|
||||
slot_config.host_id = (spi_host_device_t)SDCARD_SPI_HOST;
|
||||
|
||||
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
|
||||
.format_if_mount_failed = false,
|
||||
.max_files = 5,
|
||||
.allocation_unit_size = 0,
|
||||
.disk_status_check_enable = true,
|
||||
};
|
||||
sdmmc_card_t* card;
|
||||
host.pwr_ctrl_handle = sd_ldo;
|
||||
esp_err_t ret = esp_vfs_fat_sdspi_mount(SDCARD_MOUNT_POINT, &host, &slot_config, &mount_config, &card);
|
||||
if (ret == ESP_OK) {
|
||||
sdmmc_card_print_info(stdout, card);
|
||||
ESP_LOGI(TAG, "SD card mounted at %s (SDSPI)", SDCARD_MOUNT_POINT);
|
||||
} else {
|
||||
ESP_LOGW(TAG, "Failed to mount SD card (SDSPI): %s", esp_err_to_name(ret));
|
||||
}
|
||||
#else
|
||||
ESP_LOGI(TAG, "SD card disabled (enable SDCARD_SDMMC_ENABLED or SDCARD_SDSPI_ENABLED)");
|
||||
#endif
|
||||
}
|
||||
|
||||
public:
|
||||
WirelessTagEsp32p47b() :
|
||||
boot_button_(BOOT_BUTTON_GPIO) {
|
||||
InitializeCodecI2c();
|
||||
InitializeLCD();
|
||||
InitializeTouch();
|
||||
InitializeSdCard();
|
||||
InitializeButtons();
|
||||
GetBacklight()->RestoreBrightness();
|
||||
}
|
||||
|
||||
virtual AudioCodec* GetAudioCodec() override {
|
||||
static Es8311AudioCodec audio_codec(
|
||||
i2c_bus_,
|
||||
I2C_NUM_1,
|
||||
AUDIO_INPUT_SAMPLE_RATE,
|
||||
AUDIO_OUTPUT_SAMPLE_RATE,
|
||||
AUDIO_I2S_GPIO_MCLK,
|
||||
AUDIO_I2S_GPIO_BCLK,
|
||||
AUDIO_I2S_GPIO_WS,
|
||||
AUDIO_I2S_GPIO_DOUT,
|
||||
AUDIO_I2S_GPIO_DIN,
|
||||
AUDIO_CODEC_PA_PIN,
|
||||
AUDIO_CODEC_ES8311_ADDR);
|
||||
return &audio_codec;
|
||||
}
|
||||
|
||||
virtual Display *GetDisplay() override {
|
||||
return display_;
|
||||
}
|
||||
|
||||
virtual Backlight* GetBacklight() override {
|
||||
static PwmBacklight backlight(DISPLAY_BACKLIGHT_PIN, DISPLAY_BACKLIGHT_OUTPUT_INVERT);
|
||||
return &backlight;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
DECLARE_BOARD(WirelessTagEsp32p47b);
|
||||
Loading…
Reference in New Issue
Block a user