83 lines
3.3 KiB
C
83 lines
3.3 KiB
C
|
|
#ifndef __ConstDefine_h__
|
|||
|
|
#define __ConstDefine_h__
|
|||
|
|
|
|||
|
|
#define MAX_PULSE 500
|
|||
|
|
#define ZERO_OFFSET 32768
|
|||
|
|
//==============================================================================
|
|||
|
|
// System-state definition (for alarmState)
|
|||
|
|
//#define PULSE_ALARM BITF //0x8000
|
|||
|
|
//#define TEMP_ALARM BITE //0x4000
|
|||
|
|
//#define FACTORY_FR_ALARM BITD //0x2000
|
|||
|
|
//#define BATTERY_OFF BITC //0x1000
|
|||
|
|
//#define CRYSTAL_ALARM BITB //0x0800
|
|||
|
|
//#define ADC_ALARM BITA //0x0400
|
|||
|
|
//#define RTC_ALARM BIT9 //0x0200
|
|||
|
|
//#define EEPROM_ALARM BIT8 //0x0100
|
|||
|
|
|
|||
|
|
//#define IS_GAS_CH4 BIT7 //0x0080
|
|||
|
|
//#define AP_CRC_ERROR BIT6 //0x0040
|
|||
|
|
//#define BL_CRC_ERROR BIT5 //0x0020
|
|||
|
|
//#define SENSOR_ERROR BIT4 //0x0010
|
|||
|
|
//#define POLLUTION_ALARM BIT3 //0x0008
|
|||
|
|
//#define HARD_ALARM BIT2 //0x0004
|
|||
|
|
//#define FR_ALARM BIT1 //0x0002
|
|||
|
|
//#define BATTERY_ALARM BIT0 //0x0001
|
|||
|
|
//
|
|||
|
|
#define ALARM_SHIELD (BATTERY_OFF + SENSOR_ERROR + POLLUTION_ALARM + HARD_ALARM + \
|
|||
|
|
FR_ALARM + BATTERY_ALARM )
|
|||
|
|
#define FR_ERROR_ALARM (FR_ALARM + FACTORY_FR_ALARM + POLLUTION_ALARM)
|
|||
|
|
|
|||
|
|
typedef struct
|
|||
|
|
{
|
|||
|
|
u16 BatteryAlarm: 1; //0x0001
|
|||
|
|
u16 FRAlarm: 1; //0x0002
|
|||
|
|
u16 HardAlarm: 1; //0x0004
|
|||
|
|
u16 Pollution: 1; //0x0008
|
|||
|
|
u16 SensorErr: 1; //0x0010
|
|||
|
|
u16 BLCrcErr: 1; //0x0020
|
|||
|
|
u16 APCrcErr: 1; //0x0040
|
|||
|
|
u16 GasChange: 1; //0x0080
|
|||
|
|
u16 EEPROMAlarm: 1; //0x0100
|
|||
|
|
u16 RTCAlarm: 1; //0x0200
|
|||
|
|
u16 ADCAlarm: 1; //0x0400
|
|||
|
|
u16 CrystalAlarm: 1; //0x0800
|
|||
|
|
u16 BatteryOff: 1; //0x1000
|
|||
|
|
u16 FactoryFRErr: 1; //0x2000
|
|||
|
|
u16 TempAlarm: 1; //0x4000
|
|||
|
|
u16 PulseAlarm: 1; //0x8000
|
|||
|
|
}__Alarm_Bit_TypeDef;
|
|||
|
|
|
|||
|
|
typedef union
|
|||
|
|
{
|
|||
|
|
__Alarm_Bit_TypeDef Bit;
|
|||
|
|
u16 Word;
|
|||
|
|
u8 Byte[2];
|
|||
|
|
}__Alarm_State_TypeDef;
|
|||
|
|
|
|||
|
|
//==============================================================================
|
|||
|
|
//// System-state definition (for alarmState1)
|
|||
|
|
#define VALVE_OFF_ALARM BIT0 // Bit0<74><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬(0<><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD>)
|
|||
|
|
|
|||
|
|
#define LEAK_ALARM BIT8 // Bit08<30><38>й©<D0B9><C2A9><EFBFBD><EFBFBD>
|
|||
|
|
//#define // Bit09<30><39>Ũ<EFBFBD><C5A8><EFBFBD><EFBFBD><EFBFBD>ޱ<EFBFBD><DEB1><EFBFBD>
|
|||
|
|
//#define // Bit10<31><30>Ũ<EFBFBD><C5A8><EFBFBD><EFBFBD><EFBFBD>ޱ<EFBFBD><DEB1><EFBFBD>
|
|||
|
|
//#define // Bit11<31><31>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD>ޱ<EFBFBD><DEB1><EFBFBD>
|
|||
|
|
//#define // Bit12<31><32>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD>ޱ<EFBFBD><DEB1><EFBFBD>
|
|||
|
|
//#define // Bit13<31><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޱ<EFBFBD><DEB1><EFBFBD>
|
|||
|
|
//#define // Bit14<31><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޱ<EFBFBD><DEB1><EFBFBD>
|
|||
|
|
//#define // Bit15<31><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|||
|
|
|
|||
|
|
//******************************************************************************
|
|||
|
|
// for port 1 & 2 interrupt
|
|||
|
|
#define BIT0_VECTOR 2
|
|||
|
|
#define BIT1_VECTOR 4
|
|||
|
|
#define BIT2_VECTOR 6
|
|||
|
|
#define BIT3_VECTOR 8
|
|||
|
|
#define BIT4_VECTOR 10
|
|||
|
|
#define BIT5_VECTOR 12
|
|||
|
|
#define BIT6_VECTOR 14
|
|||
|
|
#define BIT7_VECTOR 16
|
|||
|
|
|
|||
|
|
//==============================================================================
|
|||
|
|
#endif
|