#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:阀门状态(0阀开、1阀关) #define LEAK_ALARM BIT8 // Bit08:泄漏报警 //#define // Bit09:浓度上限报警 //#define // Bit10:浓度下限报警 //#define // Bit11:压力上限报警 //#define // Bit12:压力下限报警 //#define // Bit13:流量上限报警 //#define // Bit14:流量下限报警 //#define // Bit15:总量报警" //****************************************************************************** // 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