123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- #ifndef __weight_H
- #define __weight_H
- #include "usart.h"
- //时间的结构
- struct datetime_t
- {
- uint32_t ss:6;
- uint32_t mm:6;
- uint32_t hh:5;
- uint32_t date:5;
- uint32_t month:4;
- uint32_t year:6;
- }__attribute__((packed));
- //按键重量的结构
- union timekeyweight_t
- {
- struct {
- uint8_t reserved:4; // 保留
- uint8_t WeightRun:1;
- uint8_t WeightWS:2;
- uint8_t WeightZF:1;
- int16_t WeightLast:16;
- int16_t WeightBegin:16;
- struct datetime_t datetime;
- }__attribute__((packed)) data;
- uint8_t Buffer[9];
- };
- //准备发送重量的结构
- union timeweight_t
- {
- struct {
- uint8_t reserved:4; // 保留
- uint8_t WeightRun:1;
- uint8_t WeightWS:2;
- uint8_t WeightZF:1;
- int16_t Weight:16;
- struct datetime_t datetime;
- }__attribute__((packed)) data;
- uint8_t Buffer[7];
- };
- //保存到flash中的结构
- union timeweight_save_t
- {
- struct {
- uint8_t reserved:4; // 保留
- uint8_t WeightRun:1;
- uint8_t WeightWS:2;
- uint8_t WeightZF:1;
- int16_t Weight4:16;
- int16_t Weight3:16;
- int16_t Weight2:16;
- int16_t Weight1:16;
- struct datetime_t datetime;
- }__attribute__((packed)) data;
- uint8_t Buffer[13];
- };
- extern unsigned char isn; //是否新大屏
- extern unsigned char isWeight;
- extern signed long WeightConst_WeightCurTem; //当前临时重量
- extern signed short WeightConst_WeightCur;
- extern unsigned char WeightConst_WeightWS; //小数位数
- extern unsigned char WeightConst_Weight_ZWS; //整数位数
- extern unsigned char WeightConst_WeightHaveBegin; //已经确认开始
- extern signed short WeightConst_WeightLast; //上次按键重量 1S一次
-
- extern unsigned char WeightConst_oksum; //符合目标重量数
- extern unsigned char WeightConst_allsum; //总重量值数
- extern signed short WeightConst_WeightOK;
- extern unsigned char WeightConst_AutoSingleNSecondNum[30][3]; //自动跳转每秒值的数组
- extern void ReadWeight(void);
- extern unsigned long mypow(unsigned char x,unsigned char y);
- extern void weight_usart_Init(UART_HandleTypeDef* uartHandle);
- extern union timekeyweight_t getTimeWeight(int i) ;
- extern rt_sem_t weight_lock;
- extern void CheckWeight_thread(void);
- extern void ReadWeight_thread(void);
- extern void ReadEID_thread(void);
- extern uint16_t tempWeighttime;
- #endif
|