E015.D.011-FXLS90230/Drivers/BSP/system.h

105 lines
2.4 KiB
C

#ifndef __SYSTEM_H
#define __SYSTEM_H
#include "stm32l4xx_hal.h"
#include "stm32l433xx.h"
#include "stm32l4xx.h"
#include "General_type.h"
#define AMENDLENG 112//40 //参数长度
//#define DATALENG 21 //数据长度
#define DATALENG 23 //数据长度
#define SPIHIGHSPEED 0x01 //高速SPI模式
#define SPILOWSPEED 0x00 //低速SPI模式
#define TRANS_TIME 50 //time trans a6 data ,n*10ms
#define ROLLSPEED_CYCLE 20 //20*25ms=500ms
#define T50S_TIME 9000 //n*0.005s
#define TRANS_POWER_TIME 1200 //power-on time
#define CHANGE_ADDRESS_TIMES 12000 //更改位置时间
#define CHANGE_TOTAL_TIMES 25 //位置更改次数
#define GAMMA_TIMES 16
#define GAMMA_SECTIONS 8
#define GAMMA_SAMPINGINTERVAL 5 //ms
#define GAMMA_CIRCUITSHIFT 0 //circuit delay
#define SECTION_SHIFT (270) //sensor is 45 degrees before gamma
#define ANGLE_SHIFT 0 //sensor is 45 degrees before gamma
typedef enum flagdata
{
_FALSE=0x00,
_TRUE=0x01,
}FLAG;
typedef union addata
{
float fd[8];
int32_t ld[8];
uint16_t id[16];
uint8_t cd[32];
}AD_DATA;
typedef union SectorAddress
{
uint32_t SectorAddress;
uint8_t SectorAddressBuf[4];
}SectorAddress;
typedef struct globaldata
{
vu16 Tim1Num0; //定时器1 1ms计时累加
vu16 Tim1Num1; //定时器1 10ms计时累加
vu16 Tim1Num2; //定时器1 1s计时累加
uint16_t Tim1Num3; //工作时间累加
uint16_t Tim1Count1s;//定时器1定时1s
vu16 Tim2Num0; //1ms计时累加
vu16 Tim2Num1; //10ms计时累加
vu16 Tim2Num2; //1s计时累加
uint16_t Tim2Num3; //工作时间存储计时
uint16_t Tim2Num4; //采集间隔时间计时
uint16_t Tim2Count1s;//定时器2定时1s
FLAG Tim1Count1sFlag; //定时器3 1s时间标志
uint16_t Power_On_Times; //上电存储时间扇区数记录
uint16_t Coll_Speed_Times; //转速存储次数记录
uint16_t Coll_Vibrate_Times; //振动存储次数记录
uint16_t Uart1RcvOverTime; //串口1超时计时
uint16_t Uart2RcvOverTime; //串口2超时计时
uint16_t USBRcvOverTime; //并口超时计时
uint8_t GetUart1OverFlag; //获得串口1数据完成
uint8_t GetUart3OverFlag; //获得串口2数据完成
uint8_t Uart1SendCommendFlag;
uint8_t Uart3SendCommendFlag;
uint8_t Uart1OverCount; //串口1超时计数
uint8_t Uart3OverCount; //串口2超时计数
uint8_t GetComplate_Flag; //
}G_DATA;
extern G_DATA g_Data;
extern void init_every_variable(void);
extern void System_Init (void);
extern void SystemService(void);
#endif