Files
Smart-granary-code/components/JW01/include/JW01.h
Wang Beihong ffdb7065e3 功能:集成SU-03T语音模块,完善UI代码文档
- 在CMakeLists.txt中添加SU-03T语音模块依赖。
- 在main.cpp中实现SU-03T接收回调函数,处理接收消息。
- 完善各UI源文件文档,包括动作、屏幕和字体,明确模块作用与数据流向。
- 更新主应用逻辑,初始化并启动SU-03T接收器。
- 修改过程中确保兼容性,保留原有接口。
2026-04-22 01:06:10 +08:00

50 lines
1008 B
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* 文件: components/JW01/include/JW01.h
* 角色: JW01 气体传感器串口解析与数据提取
* 说明:
* - 本文件用于实现当前模块的核心功能或接口定义。
* - 修改前请先确认该模块与其它任务/外设之间的数据流关系。
* - 涉及协议与硬件时,优先保持现有接口兼容,避免联调回归。
*/
#pragma once
#include <stdbool.h>
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
#define JW01_UART_PORT 0
#define JW01_UART_TX_GPIO 43
#define JW01_UART_RX_GPIO 44
#define JW01_UART_BAUDRATE 9600
typedef struct {
float tvoc;
float hcho;
float co2;
bool tvoc_valid;
bool hcho_valid;
bool co2_valid;
} jw01_data_t;
/**
* @brief 初始化 JW01 UART 传感器UART0, TX=43, RX=44
*/
esp_err_t jw01_init(void);
/**
* @brief 读取一帧 JW01 数据
*
* @param out_data 输出数据
* @param timeout_ms 超时时间(ms)
*/
esp_err_t jw01_read(jw01_data_t *out_data, int timeout_ms);
#ifdef __cplusplus
}
#endif