CIU32_L051_M307R/bsp/inc/bsp_history.h

113 lines
2.7 KiB
C
Raw Normal View History

// /*
// * @Author: MBW
// * @Date: 2024-03-20 17:12:31
// * @LastEditors: MBW
// * @LastEditTime: 2024-03-27 09:57:40
// * @FilePath: \CX32L003_PROJECT\bsp\inc\bsp_history.h
// * @Description:
// *
// */
// #ifndef __BSP_HISTORY_H__
// #define __BSP_HISTORY_H__
// #include "rtthread.h"
// #include "board.h"
// #include "rtdef.h"
// #define HR_THREAD_STACK_SIZE (1536)
// #define HR_THREAD_PRIORITY (10)
// #define HR_THREAD_TIMESLICE (5)
// /*一组数据帧:帧头(1字节) + 控制码(2字节) + 帧长度(1字节) + 数据(n字节) + 校验码 + 帧尾(1字节)*/
// /*帧头0xAA*/
// /*帧尾0x55*/
// /*控制码:帧类型*/
// /*帧长度:数据域长度*/
// /*数据域:数据*/
// /*校验码:数据域的校验和*/
// #define FRAME_HEADER (0xAA)
// #define FRAME_TAIL (0x55)
// #define HOST_FRAME_MIN_LEN (6U)
// typedef enum
// {
// kNumOfRecords = 0U,
// kAlarmRecord, // at least 200
// kAlarmRcyRecord, // at least 200
// kFaultRecord, // at least 100
// kFaultRcyRecord, // at least 100
// kPowerFailureRecord, // at least 50
// kPowerOnRecord, // at least 50
// kSensorFailureRecord, // at least 1
// kGetCurrentTime,
// // 以下是在国标原基础上所扩展的
// kGetCurrentTimeSecond, // include second
// kSetCurrentTime,
// kSetFactoryTime,
// kSetExpirationTime,
// kSetAlarmValue,
// kOutSysStatus, // 0x0E 不能动,因为说明书里面写好了
// kGetAlarmValue,
// kGetMqVoltage,
// kSetSysStatus,
// kGetSysStatus,
// kEraseRecords,
// kGetFactoryTime,
// kGetExpirationTime,
// // kGetEsig,
// kReboot,
// } TeFrameC2;
// typedef struct __attribute__((packed))
// {
// rt_uint8_t year_h;
// rt_uint8_t year_l;
// rt_uint8_t month;
// rt_uint8_t day;
// rt_uint8_t hour;
// rt_uint8_t minute;
// } TsRecordsTime;
// typedef struct __attribute__((packed))
// {
// rt_uint8_t c1;
// TeFrameC2 c2;
// rt_uint8_t len;
// rt_uint8_t data[];
// } TsFrameData;
// typedef struct __attribute__((packed))
// {
// rt_uint8_t len;
// rt_uint8_t buf[256];
// } TsRawFrameData;
// extern struct rt_semaphore hr_rx_sem;
// int BSP_HR_Init(void);
// TsFrameData *HR_GetFrameData(const rt_uint8_t *p_src, const rt_uint8_t src_len);
// // FlagStatus HR_ProcessData(const TsFrameData *pHostFrameData);
// // uint8_t HR_ProcessData(const TsFrameData *pHostFrameData);
// rt_uint8_t HR_ProcessData(const TsFrameData *pHostFrameData);
// rt_uint8_t HR_GenerateRawFrame(TsRawFrameData *pRawData, rt_uint8_t c1, TeFrameC2 c2, const rt_uint8_t *p_src, rt_uint8_t src_len);
// #endif // !__BSP_HISTORY_H__