Skip to content

Commit 245be0e

Browse files
Three new Waveshare ESP32-P4 development boards have been added (#691)
* Added third-party hardware support Waveshare-ESP32-P4-WIFI6-Touch-LCD-3.4C, Waveshare-ESP32-P4-WIFI6-Touch-LCD-4C, Waveshare-ESP32-P4-WIFI6-Touch-LCD-4B * Remove the README * Merge ESP32-P4-WIFI6-Touch-LCD-3.4C and ESP32-P4-WIFI6-Touch-LCD-4C into one board * Add readme files
1 parent 7f7f24e commit 245be0e

File tree

9 files changed

+1013
-2
lines changed

9 files changed

+1013
-2
lines changed

main/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ elseif(CONFIG_BOARD_TYPE_ESP32S3_Touch_LCD_3_5)
112112
set(BOARD_TYPE "esp32-s3-touch-lcd-3.5")
113113
elseif(CONFIG_BOARD_TYPE_ESP32P4_NANO)
114114
set(BOARD_TYPE "waveshare-p4-nano")
115+
elseif(CONFIG_BOARD_TYPE_ESP32P4_WIFI6_Touch_LCD_4B)
116+
set(BOARD_TYPE "waveshare-p4-wifi6-touch-lcd-4b")
117+
elseif(CONFIG_BOARD_TYPE_ESP32P4_WIFI6_Touch_LCD_XC)
118+
set(BOARD_TYPE "waveshare-p4-wifi6-touch-lcd-xc")
115119
elseif(CONFIG_BOARD_TYPE_BREAD_COMPACT_WIFI_LCD)
116120
set(BOARD_TYPE "bread-compact-wifi-lcd")
117121
elseif(CONFIG_BOARD_TYPE_TUDOUZI)

main/Kconfig.projbuild

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ choice BOARD_TYPE
108108
bool "Waveshare ESP32-S3-Touch-LCD-3.5"
109109
config BOARD_TYPE_ESP32P4_NANO
110110
bool "Waveshare ESP32-P4-NANO"
111+
config BOARD_TYPE_ESP32P4_WIFI6_Touch_LCD_4B
112+
bool "Waveshare ESP32-P4-WIFI6-Touch-LCD-4B"
113+
config BOARD_TYPE_ESP32P4_WIFI6_Touch_LCD_XC
114+
bool "Waveshare ESP32-P4-WIFI6-Touch-LCD-3.4C or ESP32-P4-WIFI6-Touch-LCD-4C"
111115
config BOARD_TYPE_TUDOUZI
112116
bool "土豆子"
113117
config BOARD_TYPE_LILYGO_T_CIRCLE_S3
@@ -197,7 +201,7 @@ choice DISPLAY_OLED_TYPE
197201
endchoice
198202

199203
choice DISPLAY_LCD_TYPE
200-
depends on BOARD_TYPE_BREAD_COMPACT_WIFI_LCD || BOARD_TYPE_BREAD_COMPACT_ESP32_LCD || BOARD_TYPE_ESP32_CGC || BOARD_TYPE_ESP32P4_NANO
204+
depends on BOARD_TYPE_BREAD_COMPACT_WIFI_LCD || BOARD_TYPE_BREAD_COMPACT_ESP32_LCD || BOARD_TYPE_ESP32_CGC || BOARD_TYPE_ESP32P4_NANO || BOARD_TYPE_ESP32P4_WIFI6_Touch_LCD_XC
201205
prompt "LCD Type"
202206
default LCD_ST7789_240X320
203207
help
@@ -236,6 +240,10 @@ choice DISPLAY_LCD_TYPE
236240
bool "Waveshare 101M-8001280-IPS-CT-K Display"
237241
config LCD_TYPE_800_1280_10_1_INCH_A
238242
bool "Waveshare 10.1-DSI-TOUCH-A Display"
243+
config LCD_TYPE_800_800_3_4_INCH
244+
bool "Waveshare ESP32-P4-WIFI6-Touch-LCD-3.4C with 800*800 3.4inch round display"
245+
config LCD_TYPE_720_720_4_INCH
246+
bool "Waveshare ESP32-P4-WIFI6-Touch-LCD-4C with 720*720 4inch round display"
239247
config LCD_CUSTOM
240248
bool "自定义屏幕参数"
241249
endchoice
@@ -275,7 +283,7 @@ config USE_AUDIO_PROCESSOR
275283
config USE_DEVICE_AEC
276284
bool "Enable Device-Side AEC"
277285
default n
278-
depends on USE_AUDIO_PROCESSOR && (BOARD_TYPE_ESP_BOX_3 || BOARD_TYPE_ESP_BOX || BOARD_TYPE_ESP_BOX_LITE || BOARD_TYPE_LICHUANG_DEV || BOARD_TYPE_ESP32S3_KORVO2_V3 || BOARD_TYPE_ESP32S3_Touch_AMOLED_1_75)
286+
depends on USE_AUDIO_PROCESSOR && (BOARD_TYPE_ESP_BOX_3 || BOARD_TYPE_ESP_BOX || BOARD_TYPE_ESP_BOX_LITE || BOARD_TYPE_LICHUANG_DEV || BOARD_TYPE_ESP32S3_KORVO2_V3 || BOARD_TYPE_ESP32S3_Touch_AMOLED_1_75 || BOARD_TYPE_ESP32P4_WIFI6_Touch_LCD_4B || BOARD_TYPE_ESP32P4_WIFI6_Touch_LCD_XC)
279287
help
280288
因为性能不够,不建议和微信聊天界面风格同时开启
281289

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Waveshare ESP32-P4-WIFI6-Touch-LCD-4B
2+
3+
4+
[ESP32-P4-WIFI6-Touch-LCD-4B](https://www.waveshare.com/esp32-p4-wifi6-touch-lcd-4b.htm) is waveshare electronics designed an intelligent 86 box based on ESP32-P4 module equipped with a 720*720 IPS capacitive touch screen
5+
6+
7+
## Configuration
8+
9+
Configuration in `menuconfig`.
10+
11+
Selection Board Type `Xiaozhi Assistant --> Board Type`
12+
- Waveshare ESP32-P4-WIFI6-Touch-LCD-4B
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#ifndef _BOARD_CONFIG_H_
2+
#define _BOARD_CONFIG_H_
3+
4+
#include <driver/gpio.h>
5+
6+
#define AUDIO_INPUT_SAMPLE_RATE 24000
7+
#define AUDIO_OUTPUT_SAMPLE_RATE 24000
8+
9+
#define AUDIO_INPUT_REFERENCE true
10+
11+
#define AUDIO_I2S_GPIO_MCLK GPIO_NUM_13
12+
#define AUDIO_I2S_GPIO_WS GPIO_NUM_10
13+
#define AUDIO_I2S_GPIO_BCLK GPIO_NUM_12
14+
#define AUDIO_I2S_GPIO_DIN GPIO_NUM_11
15+
#define AUDIO_I2S_GPIO_DOUT GPIO_NUM_9
16+
17+
#define AUDIO_CODEC_PA_PIN GPIO_NUM_53
18+
#define AUDIO_CODEC_I2C_SDA_PIN GPIO_NUM_7
19+
#define AUDIO_CODEC_I2C_SCL_PIN GPIO_NUM_8
20+
#define AUDIO_CODEC_ES8311_ADDR ES8311_CODEC_DEFAULT_ADDR
21+
#define AUDIO_CODEC_ES7210_ADDR ES7210_CODEC_DEFAULT_ADDR
22+
23+
#define BOOT_BUTTON_GPIO GPIO_NUM_35
24+
25+
#define DISPLAY_WIDTH 720
26+
#define DISPLAY_HEIGHT 720
27+
28+
#define LCD_BIT_PER_PIXEL (16)
29+
#define PIN_NUM_LCD_RST GPIO_NUM_27
30+
31+
#define DELAY_TIME_MS (3000)
32+
#define LCD_MIPI_DSI_LANE_NUM (2) // 2 data lanes
33+
34+
#define MIPI_DSI_PHY_PWR_LDO_CHAN (3)
35+
#define MIPI_DSI_PHY_PWR_LDO_VOLTAGE_MV (2500)
36+
37+
#define DISPLAY_SWAP_XY false
38+
#define DISPLAY_MIRROR_X false
39+
#define DISPLAY_MIRROR_Y false
40+
41+
#define DISPLAY_OFFSET_X 0
42+
#define DISPLAY_OFFSET_Y 0
43+
44+
#define DISPLAY_BACKLIGHT_PIN GPIO_NUM_26
45+
#define DISPLAY_BACKLIGHT_OUTPUT_INVERT true
46+
47+
#endif // _BOARD_CONFIG_H_
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
#include "wifi_board.h"
2+
#include "audio_codecs/box_audio_codec.h"
3+
#include "application.h"
4+
#include "display/lcd_display.h"
5+
// #include "display/no_display.h"
6+
#include "button.h"
7+
#include "config.h"
8+
#include "iot/thing_manager.h"
9+
10+
#include "esp_lcd_panel_ops.h"
11+
#include "esp_lcd_mipi_dsi.h"
12+
#include "esp_ldo_regulator.h"
13+
14+
#include "esp_lcd_st7703.h"
15+
16+
#include <wifi_station.h>
17+
#include <esp_log.h>
18+
#include <driver/i2c_master.h>
19+
#include <esp_lvgl_port.h>
20+
#include "esp_lcd_touch_gt911.h"
21+
#define TAG "WaveshareEsp32p44b"
22+
23+
LV_FONT_DECLARE(font_puhui_30_4);
24+
LV_FONT_DECLARE(font_awesome_30_4);
25+
26+
class WaveshareEsp32p44b : public WifiBoard {
27+
private:
28+
i2c_master_bus_handle_t i2c_bus_;
29+
Button boot_button_;
30+
LcdDisplay *display_;
31+
32+
void InitializeCodecI2c() {
33+
// Initialize I2C peripheral
34+
i2c_master_bus_config_t i2c_bus_cfg = {
35+
.i2c_port = I2C_NUM_1,
36+
.sda_io_num = AUDIO_CODEC_I2C_SDA_PIN,
37+
.scl_io_num = AUDIO_CODEC_I2C_SCL_PIN,
38+
.clk_source = I2C_CLK_SRC_DEFAULT,
39+
.glitch_ignore_cnt = 7,
40+
.intr_priority = 0,
41+
.trans_queue_depth = 0,
42+
.flags = {
43+
.enable_internal_pullup = 1,
44+
},
45+
};
46+
ESP_ERROR_CHECK(i2c_new_master_bus(&i2c_bus_cfg, &i2c_bus_));
47+
}
48+
49+
static esp_err_t bsp_enable_dsi_phy_power(void) {
50+
#if MIPI_DSI_PHY_PWR_LDO_CHAN > 0
51+
// Turn on the power for MIPI DSI PHY, so it can go from "No Power" state to "Shutdown" state
52+
static esp_ldo_channel_handle_t phy_pwr_chan = NULL;
53+
esp_ldo_channel_config_t ldo_cfg = {
54+
.chan_id = MIPI_DSI_PHY_PWR_LDO_CHAN,
55+
.voltage_mv = MIPI_DSI_PHY_PWR_LDO_VOLTAGE_MV,
56+
};
57+
esp_ldo_acquire_channel(&ldo_cfg, &phy_pwr_chan);
58+
ESP_LOGI(TAG, "MIPI DSI PHY Powered on");
59+
#endif // BSP_MIPI_DSI_PHY_PWR_LDO_CHAN > 0
60+
61+
return ESP_OK;
62+
}
63+
64+
void InitializeLCD() {
65+
bsp_enable_dsi_phy_power();
66+
esp_lcd_panel_io_handle_t io = NULL;
67+
esp_lcd_panel_handle_t disp_panel = NULL;
68+
69+
esp_lcd_dsi_bus_handle_t mipi_dsi_bus = NULL;
70+
esp_lcd_dsi_bus_config_t bus_config = ST7703_PANEL_BUS_DSI_2CH_CONFIG();
71+
esp_lcd_new_dsi_bus(&bus_config, &mipi_dsi_bus);
72+
73+
ESP_LOGI(TAG, "Install MIPI DSI LCD control panel");
74+
// we use DBI interface to send LCD commands and parameters
75+
esp_lcd_dbi_io_config_t dbi_config = ST7703_PANEL_IO_DBI_CONFIG();
76+
esp_lcd_new_panel_io_dbi(mipi_dsi_bus, &dbi_config, &io);
77+
78+
esp_lcd_dpi_panel_config_t dpi_config = {
79+
.dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT,
80+
.dpi_clock_freq_mhz = 46,
81+
.pixel_format = LCD_COLOR_PIXEL_FORMAT_RGB565,
82+
.num_fbs = 1,
83+
.video_timing = {
84+
.h_size = 720,
85+
.v_size = 720,
86+
.hsync_pulse_width = 20,
87+
.hsync_back_porch = 80,
88+
.hsync_front_porch = 80,
89+
.vsync_pulse_width = 4,
90+
.vsync_back_porch = 12,
91+
.vsync_front_porch = 30,
92+
},
93+
.flags = {
94+
.use_dma2d = true,
95+
},
96+
};
97+
st7703_vendor_config_t vendor_config = {
98+
99+
.mipi_config = {
100+
.dsi_bus = mipi_dsi_bus,
101+
.dpi_config = &dpi_config,
102+
},
103+
.flags = {
104+
.use_mipi_interface = 1,
105+
},
106+
};
107+
108+
const esp_lcd_panel_dev_config_t lcd_dev_config = {
109+
.reset_gpio_num = PIN_NUM_LCD_RST,
110+
.rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB,
111+
.bits_per_pixel = 16,
112+
.vendor_config = &vendor_config,
113+
};
114+
esp_lcd_new_panel_st7703(io, &lcd_dev_config, &disp_panel);
115+
esp_lcd_panel_reset(disp_panel);
116+
esp_lcd_panel_init(disp_panel);
117+
118+
display_ = new MipiLcdDisplay(io, disp_panel, DISPLAY_WIDTH, DISPLAY_HEIGHT,
119+
DISPLAY_OFFSET_X, DISPLAY_OFFSET_Y, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y, DISPLAY_SWAP_XY,
120+
{
121+
.text_font = &font_puhui_30_4,
122+
.icon_font = &font_awesome_30_4,
123+
.emoji_font = font_emoji_64_init(),
124+
});
125+
}
126+
void InitializeTouch()
127+
{
128+
esp_lcd_touch_handle_t tp;
129+
esp_lcd_touch_config_t tp_cfg = {
130+
.x_max = DISPLAY_WIDTH,
131+
.y_max = DISPLAY_HEIGHT,
132+
.rst_gpio_num = GPIO_NUM_23,
133+
.int_gpio_num = GPIO_NUM_NC,
134+
.levels = {
135+
.reset = 0,
136+
.interrupt = 0,
137+
},
138+
.flags = {
139+
.swap_xy = 0,
140+
.mirror_x = 0,
141+
.mirror_y = 0,
142+
},
143+
};
144+
esp_lcd_panel_io_handle_t tp_io_handle = NULL;
145+
esp_lcd_panel_io_i2c_config_t tp_io_config = ESP_LCD_TOUCH_IO_I2C_GT911_CONFIG();
146+
tp_io_config.scl_speed_hz = 400 * 1000;
147+
ESP_ERROR_CHECK(esp_lcd_new_panel_io_i2c(i2c_bus_, &tp_io_config, &tp_io_handle));
148+
ESP_LOGI(TAG, "Initialize touch controller");
149+
ESP_ERROR_CHECK(esp_lcd_touch_new_i2c_gt911(tp_io_handle, &tp_cfg, &tp));
150+
const lvgl_port_touch_cfg_t touch_cfg = {
151+
.disp = lv_display_get_default(),
152+
.handle = tp,
153+
};
154+
lvgl_port_add_touch(&touch_cfg);
155+
ESP_LOGI(TAG, "Touch panel initialized successfully");
156+
}
157+
void InitializeButtons() {
158+
boot_button_.OnClick([this]() {
159+
auto& app = Application::GetInstance();
160+
if (app.GetDeviceState() == kDeviceStateStarting && !WifiStation::GetInstance().IsConnected()) {
161+
ResetWifiConfiguration();
162+
}
163+
app.ToggleChatState(); });
164+
}
165+
166+
// 物联网初始化,添加对 AI 可见设备
167+
void InitializeIot() {
168+
auto &thing_manager = iot::ThingManager::GetInstance();
169+
thing_manager.AddThing(iot::CreateThing("Speaker"));
170+
thing_manager.AddThing(iot::CreateThing("Screen"));
171+
}
172+
173+
public:
174+
WaveshareEsp32p44b() :
175+
boot_button_(BOOT_BUTTON_GPIO) {
176+
InitializeCodecI2c();
177+
InitializeIot();
178+
InitializeLCD();
179+
InitializeTouch();
180+
InitializeButtons();
181+
GetBacklight()->RestoreBrightness();
182+
}
183+
184+
virtual AudioCodec* GetAudioCodec() override {
185+
static BoxAudioCodec audio_codec(
186+
i2c_bus_,
187+
AUDIO_INPUT_SAMPLE_RATE,
188+
AUDIO_OUTPUT_SAMPLE_RATE,
189+
AUDIO_I2S_GPIO_MCLK,
190+
AUDIO_I2S_GPIO_BCLK,
191+
AUDIO_I2S_GPIO_WS,
192+
AUDIO_I2S_GPIO_DOUT,
193+
AUDIO_I2S_GPIO_DIN,
194+
AUDIO_CODEC_PA_PIN,
195+
AUDIO_CODEC_ES8311_ADDR,
196+
AUDIO_CODEC_ES7210_ADDR,
197+
AUDIO_INPUT_REFERENCE);
198+
return &audio_codec;
199+
}
200+
201+
virtual Display *GetDisplay() override {
202+
return display_;
203+
}
204+
205+
virtual Backlight* GetBacklight() override {
206+
static PwmBacklight backlight(DISPLAY_BACKLIGHT_PIN, DISPLAY_BACKLIGHT_OUTPUT_INVERT);
207+
return &backlight;
208+
}
209+
};
210+
211+
DECLARE_BOARD(WaveshareEsp32p44b);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Waveshare ESP32-P4-WIFI6-Touch-LCD-XC
2+
3+
4+
[ESP32-P4-WIFI6-Touch-LCD-XC](https://www.waveshare.com/esp32-p4-wifi6-touch-lcd-3.4c.htm) is waveshare electronics designed a 3.4-inch, 4-inch circular screen, highly integrated development board
5+
6+
7+
## Configuration
8+
9+
Configuration in `menuconfig`.
10+
11+
Selection Board Type `Xiaozhi Assistant --> Board Type`
12+
- Waveshare ESP32-P4-WIFI6-Touch-LCD-3.4C or ESP32-P4-WIFI6-Touch-LCD-4C
13+
14+
Selection Display LCD Type `Xiaozhi Assistant --> LCD Type`
15+
- Waveshare ESP32-P4-WIFI6-Touch-LCD-3.4C with 800*800 3.4inch round display
16+
- Waveshare ESP32-P4-WIFI6-Touch-LCD-4C with 720*720 4inch round display
17+
18+
19+
20+
| [ESP32-P4-WIFI6-Touch-LCD-3.4C](https://www.waveshare.com/esp32-p4-wifi6-touch-lcd-3.4c.htm) | [ESP32-P4-WIFI6-Touch-LCD-4C](https://www.waveshare.com/esp32-p4-wifi6-touch-lcd-4c.htm) |
21+
|----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
22+
| <img style="width: 150px; height: auto; display: block; margin: 0 auto;" src= "https://www.waveshare.com/media/catalog/product/cache/1/image/800x800/9df78eab33525d08d6e5fb8d27136e95/e/s/esp32-p4-wifi6-touch-lcd-3.4c-1.jpg"> | <img style="width: 150px; height: auto; display: block; margin: 0 auto;" src= "https://www.waveshare.com/media/catalog/product/cache/1/image/800x800/9df78eab33525d08d6e5fb8d27136e95/e/s/esp32-p4-wifi6-touch-lcd-4c-1.jpg"> |

0 commit comments

Comments
 (0)