49 lines
1.4 KiB
C
49 lines
1.4 KiB
C
#ifndef __APP_MOZEN_HANDLER_H
|
|
#define __APP_MOZEN_HANDLER_H
|
|
|
|
#include <stdint.h>
|
|
#include "mozen_protocol.h"
|
|
|
|
// 传感器数据类型定义
|
|
enum
|
|
{
|
|
SENSOR_BIT_8 = 0x01,
|
|
SENSOR_BIT_16,
|
|
};
|
|
|
|
// 全局状态变量,原在 mozen_protocol.h 中定义,现由应用层管理
|
|
extern volatile uint16_t g_sensor_frames_to_send;
|
|
extern volatile uint8_t g_sensor_data_type;
|
|
|
|
// --- Protocol Command IDs ---
|
|
#define MOZEN_CMD_ID_SENSOR_DATA 0x01 // --- 传感器数据类 ---
|
|
#define MOZEN_CMD_ID_PARAM_CONFIG 0x02 // --- 参数配置类 ---
|
|
#define MOZEN_CMD_ID_PROD_TEST 0xAA // --- 生产测试类 ---
|
|
|
|
// --- Param Config Target IDs (Command 0x02) ---
|
|
#define MOZEN_PARAM_TGT_REPORT_MODE 0x01
|
|
#define MOZEN_PARAM_TGT_CALI_DISPLAY 0x3D
|
|
#define MOZEN_PARAM_TGT_DEVICE_INFO 0x3F
|
|
|
|
// --- Production Test Target IDs (Command 0xAA) ---
|
|
#define MOZEN_PROD_TGT_SYS 0x01
|
|
#define MOZEN_PROD_TGT_MAP_CALI 0x03
|
|
|
|
// Global protocol instance for application
|
|
extern mozen_protocol_t g_mozen_prot;
|
|
|
|
/**
|
|
* @brief Initialize the Mozen application handlers.
|
|
* This will register all necessary command handlers to the protocol instance.
|
|
* @param prot Protocol instance to bind to.
|
|
*/
|
|
void app_mozen_handler_init(mozen_protocol_t *prot);
|
|
|
|
/**
|
|
* @brief Top level initialization for Mozen protocol and application handlers.
|
|
* @param tx_fn The transmit callback function.
|
|
*/
|
|
void app_mozen_init(mozen_tx_fn_t tx_fn);
|
|
|
|
#endif // __APP_MOZEN_HANDLER_H
|