You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

338 lines
8.6 KiB

1 year ago
#ifndef APP_CONFIG_H
#define APP_CONFIG_H
#include "c_type51.h"
//#include "asp_para.h"
#include "app_weight.h"
///#include "app_save.h"
#define APP_VERSION 0x10
#define D_MCU_BIGENDIAN 1
// #define D_MCU_LITTLEENDIAN 1
#define POWER_NORMAL 0
#define POWER_LOW 1
#define LeaveForbid_OPEN 1 //1 打开,0 不打开
#define LeaveForbid_OFF 0
// #define RFID_FREE_NO 0x00FA
#define NET_STATUS_NOTCONNECT 1
#define NET_STATUS_CONNECTED 0
#define KG 0 //0 KG; 1 磅
#define lb 1
#define beep_on 1 //1 开启,0 关闭
#define beep_off 0
1 year ago
enum tp_handle
{
TP_HANDLED,
TP_UNHANDLE
};
////#define baud_rade L3_baud_rate_change(G.p.baud_rate)
//STEP 3 Register CONFIG >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
///存放全局需要保存的数据
///cc 2023/04/07--5:12:12 包含系统运行需要的:通讯参数 低功耗配置 采集配置 功能配置(称重)等
/*
S中 TS_GlobalRegisterSave_
code中和程序hex文件一体
S保存参数 eeprom中 eeprom eeprom
F出厂参数 code//hex
R运行参数 ram中
C缓存参数 ram
--> --> -->
= >= >=
R运行参数 eeprom中的保存参数中
S保存参数直接放到eeprom
register
,
512
512
eeprom
eeprom中的0x55aa,F然后放入eeprom中 S R参数中
*/
/*********
///cc 2023/04/08--4:2:23 需要整理
1,
1 512---4-6ms
01
,,
,
--->,
1,,512
30
2, ,.--->,;
flash 28k 8k EEp 28K的最后8K 5000h-6FFFh
*******/
/*******
app_config app_save
app_save ,
,西,,使bsp中
asp ,app通过参数调用asp,使.
,.
app ,
asp app support program wifi的模式设置,adc的读取后的处理
bsp board support program ,wdt,wifi的底层配置函数,sensor
msp mcu support program ,cpu自身的外设,uart led
cpu
*****/
/*******
adc采样值
^
|
| o
| |
| o |
| | |
| ---|---- |------------0=adc=0
0 | |D_ADC_OFFSET
|____|_____|____________> adc + D_ADC_OFFSET
0 40 80
西:
1,< >
2, 0kg的时候的<>
3,<> + <>
3.1 ,250kg,,,.<250kg,>
4, : <(+-10kg)>,<>
,.
5,,<>,,.
4,.
B:4,.
---->C: 4.5 ,
c,,0 (H1sL0.5s)3
西:
< > Byte x n=? .
Byte x n=? .
<> Byte x n=? .
<> ,
,250kg
,id之类的
3,,,使.使.
*****/
////整体放入eeprom的扇区种
typedef struct
{
//RO Register
//RW Register
TS_adc_SPara_ adc_SPara[4];
TS_weight_SPara_ weight_SPara;//// 称重的参数
U16 d0xaa55;
}TS_GlobalRegisterSave_;
extern TS_GlobalRegisterSave_ S;
typedef struct global_register
{
//称重
struct
{
U16 sensor_adc[4];
U16 kgx10_out;
U16 adc16;
S16 differ;
} weight;
//电量
U8 dl;
//网络状态
U8 net_status;
//单位
U8 danwei;
//蜂鸣器
U8 beep;
//蜂鸣器开启时间
U32 beep_startime;
//离床报警开启标志
U8 LeaveForbid_flag;
//离床报警手动解除标志
U8 ForbidDelate_flag;
//离床报警参考重量
U16 Weight_Ref;
//功耗模式
U8 power_mode;
//屏幕按键按下标志
U8 ScrTouch_flag;
//屏幕按键按下时间
U32 ScrTouch_time;
// 校准index
U8 calib_index;
// 校准重量
U16 calib_kg_x100;
} GlobalRegister;
extern GlobalRegister R;
1 year ago
#define D_S_LEN (D_TS_weight_SPara_len + D_TS_adc_SPara_LEN*D_ADC_CHANNEL_NUM +2 +8)///+8为了容错及扩展
///cc 2023/04/07--15:4:20 独立任务有独立的存储 ,还是比较麻烦,简单至上吧
/*
typedef struct
{
//RO Register
U16 add;
U16 num;
u8* pdat;
U16 0xaa55;////作为本任务保存的
}TS_para_;
*/
#define D_GlobalRegister_size 2
//寄存器内存基地址
#define REG_MEM_BASE ((U16*)(&S)) //寄存器基础地址(本文件外部不应该使用该宏定义)
//变量地址转寄存器
#define MEM_2_REG(mem) (((U16*)(mem) - REG_MEM_BASE) + 1)
//寄存器转变量地址
#define REG_2_MEM(reg) (REG_MEM_BASE + (U16)((reg) - 1))
#define D_EEP_BASE 0x0
extern vtype L3_S_init(void);
extern int L3_mcu_id_ok();
extern S32 L3_count_std_weight(S32 weight);
extern void L3_eeprom_persist_param(void);
extern U8 L1_para_read(U8 *buf,U8 *len);
extern U8 L1_para_write(U8 *buf, U8 len);
extern void L0_main_lowp(void);
extern void L3_S_2_R(void);
extern void L3_R_2_S(void);
extern void L3_reg_init(void);
1 year ago
#if 0
typedef struct
{
/// U8 enc_key[MCU_ID_KEY_LEN];
/// U8 mcu_id[MCU_ID_LEN];
/// U8 mcu_enc_id[MCU_ID_LEN];
}McuEncryptInfo;
#define D_ch_max_num 4
typedef struct global_param
{
//EncryptInfo
McuEncryptInfo e;
//Global Variables
S32 weight[D_ch_max_num]; //4路重量
S32 allweight; //总重量
S32 _total_weight; //实际重量*1000
S32 _total_zweight; //实际皮重*1000
}TS_GlobalParam_;
extern TS_GlobalParam_ G;
///extern TS_eeprom_param_ eep_param;
///extern TS_EEPROM_ENC_ eep_enc;
#endif
#endif