移植与电子模块通信相关代码

This commit is contained in:
andy
2023-10-06 18:47:05 +08:00
parent bf440a35bc
commit 8e3a140bec
77 changed files with 13331 additions and 1168 deletions

View File

@@ -0,0 +1,101 @@
#ifndef BASECHECKER_H_
#define BASECHECKER_H_
#include "stm32f10x.h"
#define CHECKER_NET_ID 10
#define CHECKER_DELAY_TIME 10
#define CHECKER_MAXRT_COUNT 64
#define CHECKER_MAXID_COUNT 100
typedef void (*CheckerTask)(void );
#pragma pack(1)
typedef struct {
uint8_t taskid; //任务ID
uint8_t runindex;//任务序列
uint8_t retry_time;//重试次数
uint8_t error_jumpto;//失败后跳转
uint8_t param_rtv_count;//参数个数和返回值个数
uint16_t params[10];
}CheckerTask_Info_st;
typedef struct{
CheckerTask_Info_st task_info;
uint16_t params[10];//运行参数1
uint16_t rtv_index;//返回值下标
uint8_t rtv_count;//当前任务返回值个数
uint8_t param_count;//参数个数
uint8_t excue_rtv; //任务执行结果
uint8_t power_prapare_exe;//电源准备任务执行
uint16_t Test_Rtv[100];//保存返回参数
uint8_t Task_Result[8];//保存运行状态
uint8_t Task_Excute[8];//保存执行序列号
uint16_t netid;//电子模块最新的网络ID
uint8_t user_otp[4];//用户区OTP数据
uint8_t writeuid[13];//注码uid
uint8_t writepwd[8];//注码密码
uint8_t uid_len;//密码长度 XT 7 JQ 8
uint8_t pwd_len;//密码长度 XT 4 JQ 4
uint8_t uid_pwd_bind_flag;
uint8_t code_bind_check_flag;//三码绑定检测一起执行
}Checker_RunCfg_st ;
#pragma pack()
extern Checker_RunCfg_st checker_runcfg;
#define CHECKER_WRITE_BUF 48 //(CHECKER_FAC_BUF_LEN-2)
#define CHECKER_FAC_BUF_LEN 50 //len+crc8+48bytes
extern uint8_t Checker_FacBuf[CHECKER_FAC_BUF_LEN];
extern volatile uint8_t ThreeBindResult_flag ;
extern uint16_t Checker_First_Set_Voltage ;//方案设置内部第一个电压
/*
@brief 标记执行结果
@param rtv 执行返回值 1表示失败 0 表示成功
@param taskindex 任务项目ID号
*/
void Checker_MaskResult(uint8_t rtv,uint8_t taskindex);
/*
@brief 标记任务序列执行
@param taskindex 任务序列号
*/
void Checker_Excueindex(uint8_t taskindex);
/*
@brief 保存测试结果值
@param *pus_rtv 测量结果缓存
@param count 缓存个数
*/
void Checker_SetRtv(uint16_t* pus_rtv, uint8_t count);
/*
brief 准备测试用电压
@param 设置电压值最多支持10个参数
*/
void Checker_PowerPrapare(void);
/*
@brief 延时
@pram1 延时时间 0.1S
@param 使能总线电流监控
@rtv1 波动AD值
*/
void Checker_WaitDelay(void);
/*
@brief 电阻检测
@param0 电阻检测模式 0 4线制 1 2线 1-42 2线 2-3 通
@rtv0 电阻检测值
*/
void Checker_ResistorSample(void);
/*
@brief 判断是否需要注码
@rtv 0 不需要注码 1 注码
*/
uint8_t JQXT_Test_IsNeedBind(void);
/*
检测执行函数是否正常
*/
uint8_t Checker_FunIsValid(CheckerTask* taskArray,uint16_t run_index);
#endif