Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libraries/HAL_Drivers/drv_pdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ static rt_err_t mic_start(struct rt_audio_device *audio, int stream)

return RT_EOK;
}
\

static rt_err_t mic_stop(struct rt_audio_device *audio, int stream)
{
struct mic_device *mic_dev = (struct mic_device *)audio->parent.user_data;
Expand All @@ -400,6 +400,7 @@ static struct rt_audio_ops mic_ops =
.transmit = RT_NULL,
.buffer_info = RT_NULL,
};

int rt_hw_pdm_init(void)
{
rt_uint8_t *rx_fifo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* please change to the appropriate value according to the env
*/
#define MEM_BASE 0x00000000
#define MEM_SIZE 0x00000000
//#define MEM_SIZE 0x00000000

#define ALLOC_RESERVED_MEM_IN_KERNEL 1

Expand Down
10 changes: 9 additions & 1 deletion projects/Edgi-Talk_WIFI/Edgi_Talk_M55_WIFI/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,18 @@ It allows users to quickly test Wi-Fi scanning, connection, and performance, ver
* After power-on, the system initializes the Wi-Fi device.
* Connect to a Wi-Fi network via serial terminal:

```
wifi scan
```
![alt text](figures/5.png)
```
wifi join <SSID> <PASSWORD>
```

![alt text](figures/6.png)
```
ping www.rt-thread.org
```
![alt text](figures/7.png)
* After connection, perform throughput test with iperf.
* A GUI tool (`jperf`) is provided under `packages/netutils-latest/tools`.

Expand Down
11 changes: 10 additions & 1 deletion projects/Edgi-Talk_WIFI/Edgi_Talk_M55_WIFI/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,24 @@
* 系统会自动初始化 WIFI设备。
* 用户可在 **串口终端**使用以下命令连接WIFI:

```
wifi scan
```
![alt text](figures/5.png)
```
wifi join 名称 密码
```
![alt text](figures/6.png)
```
ping www.rt-thread.org
```
![alt text](figures/7.png)

* 网络连接完成后,可使用 iperf 进行性能测试。
* 在 packages\netutils-latest\tools 目录下提供了 jperf.rar 测速工具。
* 将其解压后,双击其中的 .bat 文件,即可启动工具,界面如下图所示:

![工具演示](image.png)
![工具演示](figures/4.png)

* 在开发板终端输入以下命令(其中 电脑的 IP 请替换为实际地址),即可开始测速:

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions projects/Edgi-Talk_XiaoZhi/Edgi_Talk_M55_XiaoZhi/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# XiaoZhi Example Project

[**中文**](./README_zh.md) | **English**

## Introduction

This example demonstrates the **basic functionality of XiaoZhi voice interaction device** on the **Edgi-Talk platform**, running **RT-Thread RTOS**.
Expand All @@ -16,6 +18,17 @@ It allows users to quickly test Wi-Fi connection, key wake-up, and voice interac

## Usage

### WIFI Modification

1. In `main.c` at line 36, locate the following code:

```c
while (rt_wlan_connect("TEST", "88888888"));
```

2. Replace "TEST" with your WiFi name and "88888888" with the password, then recompile and flash.
3. For detailed WiFi usage, refer to: [**WIFI**](../../Edgi-Talk_WIFI/Edgi_Talk_M55_WIFI/README.md)

### Build and Download

1. Open and compile the project.
Expand Down
11 changes: 10 additions & 1 deletion projects/Edgi-Talk_XiaoZhi/Edgi_Talk_M55_XiaoZhi/README_zh.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 小智示例工程

**中文** | [**English**](./README.md)

## 简介

本示例工程基于 **Edgi-Talk 平台**,演示 **小智语音交互设备的基本功能**,运行在 **RT-Thread 实时操作系统** 上。
Expand All @@ -15,7 +17,13 @@
* 设备状态管理(待机、监听、休眠等)

## 使用方法

### WIFI修改
1. 在 `main.c` 36行中找到以下代码:
```c
while (rt_wlan_connect("TEST", "88888888"));
```
2. 将 "TEST" 改为你的 WiFi 名称,"88888888" 改为密码,重新编译并烧录。
3. WIFI 详细使用参考 :[**WIFI**](../../Edgi-Talk_WIFI/Edgi_Talk_M55_WIFI/README_zh.md)
### 编译与下载

1. 打开工程并完成编译。
Expand All @@ -33,6 +41,7 @@
* **Sleeping**:休眠状态
* 按下顶部按键,可进入 **Listening** 状态进行语音交互。

![alt text](figures/3.png)
## 注意事项
* 第一次需要进入 [小智官网](https://xiaozhi.me/) 进行后台绑定
![alt text](figures/2.png)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int en_gpio(void)
rt_pin_mode(LCD_BL_GPIO_NUM, PIN_MODE_OUTPUT);
rt_pin_mode(LCD_DISP_GPIO_NUM, PIN_MODE_OUTPUT);
rt_pin_mode(BL_PWM_DISP_CTRL, PIN_MODE_OUTPUT);

return 0;
}
INIT_BOARD_EXPORT(en_gpio);
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ static void adc_check_entry(void* parameter)

rt_adc_device_t adc_dev;
rt_uint32_t value;
char tmp[64];
static rt_uint32_t adc_buf[ADC_AVG_NUM] = {0};
rt_uint32_t sum = 0;
rt_uint8_t idx = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void xiaozhi_ui_task(void *args)
lv_style_set_text_font(&style, font);

lv_style_init(&style24);
lv_font_t * font2 = lv_tiny_ttf_create_data(xiaozhi_font, xiaozhi_font_size, 24);
lv_font_t *font2 = lv_tiny_ttf_create_data(xiaozhi_font, xiaozhi_font_size, 24);
lv_style_set_text_font(&style24, font2);

if (xiaozhi_ui_obj_init() != RT_EOK) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ static char mac_address_string[20] = {0};
static char client_id_string[40] = {0};
xiaozhi_ws_t g_xz_ws;
enum DeviceState g_state;
rt_event_t xiaozhi_button_event = RT_NULL;

void voice_rx_init();
extern void iot_invoke(const uint8_t *data, uint16_t len);
Expand Down Expand Up @@ -90,12 +91,12 @@ void xz_button_callback(void *arg)
{
if (CYBSP_BTN_PRESSED == Cy_GPIO_Read(CYBSP_USER_BTN_PORT, CYBSP_USER_BTN_PIN))
{
rt_event_send(button_event, BUTTON_EVENT_PRESSED);
rt_event_send(xiaozhi_button_event, BUTTON_EVENT_PRESSED);
}
#ifndef ExBoard_Voice
else
{
rt_event_send(button_event, BUTTON_EVENT_RELEASED);
rt_event_send(xiaozhi_button_event, BUTTON_EVENT_RELEASED);
}
#endif
}
Expand All @@ -105,7 +106,7 @@ void xz_button_thread_entry(void *param)
rt_uint32_t evt;
while (1)
{
rt_event_recv(button_event,
rt_event_recv(xiaozhi_button_event,
BUTTON_EVENT_PRESSED | BUTTON_EVENT_RELEASED,
RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR,
RT_WAITING_FOREVER, &evt);
Expand Down Expand Up @@ -159,8 +160,8 @@ void xz_button_init(void)
{
rt_pin_mode(BUTTON_PIN, PIN_MODE_INPUT_PULLUP);
rt_pin_write(BUTTON_PIN, PIN_HIGH);
button_event = rt_event_create("btn_evt", RT_IPC_FLAG_FIFO);
RT_ASSERT(button_event != RT_NULL);
xiaozhi_button_event = rt_event_create("btn_evt", RT_IPC_FLAG_FIFO);
RT_ASSERT(xiaozhi_button_event != RT_NULL);

rt_thread_t tid = rt_thread_create("btn_thread",
xz_button_thread_entry,
Expand Down Expand Up @@ -232,7 +233,7 @@ void xz_audio_send_using_websocket(uint8_t *data, int len)
{
if (g_xz_ws.is_connected)
{
wsock_write(&g_xz_ws.clnt, data, len, OPCODE_BINARY);
wsock_write(&g_xz_ws.clnt, (const char *)data, len, OPCODE_BINARY);
}
else
{
Expand Down Expand Up @@ -271,10 +272,10 @@ err_t my_wsapp_fn(int code, char *buf, size_t len)
g_state = kDeviceStateUnknown;
break;
case WS_TEXT:
Message_handle(buf, len);
Message_handle((const uint8_t *)buf, len);
break;
case WS_DATA:
xz_audio_downlink(buf, len, NULL, 0);
xz_audio_downlink((uint8_t *)buf, len, NULL, 0);
break;
default:
LOG_E("Unknown error\n");
Expand Down Expand Up @@ -411,7 +412,7 @@ char *my_json_string(cJSON *json, char *key)
void Message_handle(const uint8_t *data, uint16_t len)
{
// rt_kputs(data);
cJSON *root = cJSON_Parse(data);
cJSON *root = cJSON_Parse((const char *)data);
if (!root)
{
LOG_E("Error before: [%s]\n", cJSON_GetErrorPtr());
Expand Down Expand Up @@ -499,6 +500,7 @@ void Message_handle(const uint8_t *data, uint16_t len)
cJSON *payload = cJSON_GetObjectItem(root, "payload");
if (payload && cJSON_IsObject(payload))
{
extern void McpServer_ParseMessage(const char* message);
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extern function declaration should be moved to a header file rather than being declared locally within the function. This improves maintainability and ensures consistent declarations across translation units.

Copilot uses AI. Check for mistakes.
McpServer_ParseMessage(cJSON_PrintUnformatted(payload));
}
}
Expand Down Expand Up @@ -622,12 +624,6 @@ int http_xiaozhi_data_parse_ws(char *json_data)
return -1;
}

cJSON *presult = cJSON_GetObjectItem(root, "mqtt");
char *endpoint = my_json_string(presult, "endpoint");
char *client_id = my_json_string(presult, "client_id");
char *username = my_json_string(presult, "username");
char *password = my_json_string(presult, "password");
char *publish_topic = my_json_string(presult, "publish_topic");
xiaozhi_ws_connect();
cJSON_Delete(root);
return 0;
Expand Down Expand Up @@ -690,6 +686,7 @@ void xiaozhi_entry(void *p)
if (my_ota_version)
{
http_xiaozhi_data_parse_ws(my_ota_version);
extern void iot_initialize(void);
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extern function declaration should be moved to a header file rather than being declared locally within the function. This improves maintainability and ensures consistent declarations across translation units.

Copilot uses AI. Check for mistakes.
iot_initialize();
rt_free(my_ota_version);
break;
Expand Down Expand Up @@ -763,14 +760,13 @@ static void serial_thread_entry(void *parameter)
result = rt_mq_recv(&rx_mq, &msg, sizeof(msg), RT_WAITING_FOREVER);
if (result > 0)
{

rx_length = rt_device_read(msg.dev, 0, rx_buffer, msg.size);
rx_buffer[rx_length] = '\0';
rt_kprintf("%s", rx_buffer);
if (rx_buffer[0] == 0x01)
{
rt_device_write(serial, 0, cmd, (sizeof(cmd)));
rt_event_send(button_event, BUTTON_EVENT_PRESSED);
rt_event_send(xiaozhi_button_event, BUTTON_EVENT_PRESSED);

}
}
Expand All @@ -779,16 +775,14 @@ static void serial_thread_entry(void *parameter)

void voice_rx_init()
{
rt_err_t result = RT_EOK;

serial = rt_device_find("uart1");
if (serial == RT_NULL)
{
rt_kprintf("device %s not find", "uart1");
return;
}

result = rt_device_open(serial, RT_DEVICE_FLAG_INT_RX);
rt_device_open(serial, RT_DEVICE_FLAG_INT_RX);
rt_device_set_rx_indicate(serial, uart_input);

rt_mq_init(&rx_mq, "rx_mq",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ typedef struct
{
uint32_t sample_rate;
uint32_t frame_duration;
uint8_t session_id[12];
char session_id[12];
wsock_state_t clnt;
rt_sem_t sem;
uint8_t is_connected;
Expand Down Expand Up @@ -132,7 +132,7 @@ typedef struct
rt_device_t rt_audio_dev;
rt_device_t rt_mic_dev;
} xz_audio_t;
static rt_event_t button_event = RT_NULL;
extern rt_event_t xiaozhi_button_event;
char *get_mac_address(void);
char *get_client_id(void);
void xz_button_callback(void *arg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ void xz_opus_thread_entry(void *p)
opus_int32 res = opus_decode(thiz->decoder, (const uint8_t *)queue->data,
queue->data_len, thiz->downlink_decode_out,
XZ_SPK_FRAME_LEN / 2, 0);
if (res < 0)
{
LOG_E("Opus decode error: %d", res);
}
rt_device_write(thiz->rt_audio_dev, 0, (char *)thiz->downlink_decode_out, XZ_SPK_FRAME_LEN);

uint8_t need_decode_again = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*******************************************************************************
#include <packages/lvgl_9.2.0/src/draw/vg_lite/lv_draw_vg_lite.h>
* File Name : lv_draw_vg_lite.c
*
* Description : This file provides implementation of LVGL's drawing operations
Expand All @@ -24,7 +23,7 @@
#include "lv_vg_lite_grad.h"
#include "lv_vg_lite_pending.h"
#include "lv_vg_lite_stroke.h"

#include "lv_draw_vg_lite.h"
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The include directive #include \"lv_draw_vg_lite.h\" should be placed at the top of the file with other includes (before line 23) rather than after them. Standard practice is to group all includes together at the beginning of the source file.

Suggested change
#include "lv_draw_vg_lite.h"
#include "lv_draw_vg_lite.h"

Copilot uses AI. Check for mistakes.
/*********************
* Macros
*********************/
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading