438 lines
21 KiB
C
438 lines
21 KiB
C
#ifndef __DP2201_V5000_IO_h__
|
||
#define __DP2201_V5000_IO_h__
|
||
//.h Start--------------------------------------------------------------------
|
||
|
||
//------------------------------------------------------------------------------
|
||
#if ((DP2201_CORE_V5020) || (DP2201_CORE_V5002))
|
||
#define DP2201_CORE_V5000 1
|
||
#endif
|
||
|
||
//File Start--------------------------------------------------------------------
|
||
#if (DP2201_CORE_V5000)
|
||
//**************************************************************************
|
||
|
||
// for flow compute
|
||
//==============================================================================
|
||
#define TEST_PIN GPIO_PIN_5
|
||
#define TEST_PIN_PINPOS GPIO_PinPos_5
|
||
#define TEST_PIN_GPIO GPIO0
|
||
#define TEST_PIN_OUT() EnableOutput(TEST_PIN_GPIO, TEST_PIN_PINPOS)
|
||
#define TEST_PIN_TOGGLE() TOGGLE_PIN(TEST_PIN_GPIO, TEST_PIN)
|
||
#define CLR_TEST_PIN() CLR_PIN(TEST_PIN_GPIO,TEST_PIN)
|
||
#define SET_TEST_PIN() SET_PIN(TEST_PIN_GPIO,TEST_PIN)
|
||
//------------------------------------------------------------------------------
|
||
// RH power control pin
|
||
#define RH_CON_PIN GPIO_PIN_0
|
||
#define RH_CON_PINPOS GPIO_PinPos_0
|
||
#define RH_GPIO GPIO0
|
||
#define RH_CON_OUTPUT() EnableOutput(RH_GPIO, RH_CON_PINPOS)
|
||
#define TURN_OFF_RH_POWER() SET_PIN(RH_GPIO,RH_CON_PIN)
|
||
#define TURN_ON_RH_POWER() CLR_PIN(RH_GPIO,RH_CON_PIN)
|
||
//------------------------------------------------------------------------------
|
||
// Heating control pin
|
||
#define HEATING_PIN GPIO_PIN_6
|
||
#define HEATING_PINPOS GPIO_PinPos_6
|
||
#define HEATING_GPIO GPIO1
|
||
#define HEATING_OUTPUT() EnableOutput(HEATING_GPIO, HEATING_PINPOS)
|
||
#define CLR_HEATING() CLR_PIN(HEATING_GPIO,HEATING_PIN)
|
||
#define SET_HEATING() SET_PIN(HEATING_GPIO,HEATING_PIN)
|
||
#define TURN_ON_HEATING() SET_HEATING()
|
||
#define TURN_OFF_HEATING() CLR_HEATING() // CLR_HEATING()
|
||
#define SELECT_VREF_CON() SET_HEATING()
|
||
#define SELECT_MEMS_CON() CLR_HEATING()
|
||
//------------------------------------------------------------------------------
|
||
// RH Heating control select pin
|
||
#define TD_CON_PIN GPIO_PIN_5
|
||
#define TD_CON_PINPOS GPIO_PinPos_5
|
||
#define TD_CON_GPIO GPIO1
|
||
#define TD_CON_OUTPUT() EnableOutput(TD_CON_GPIO, TD_CON_PINPOS)
|
||
#define CLR_TD_CON() CLR_PIN(TD_CON_GPIO,TD_CON_PIN)
|
||
#define SET_TD_CON() SET_PIN(TD_CON_GPIO,TD_CON_PIN)
|
||
#define SELECT_TD_CON() CLR_TD_CON()
|
||
#define SELECT_TU_CON() SET_TD_CON()
|
||
|
||
#define CALIB_PIN GPIO_PIN_7
|
||
#define CALIB_PINPOS GPIO_PinPos_7
|
||
#define CALIB_GPIO GPIO1
|
||
#define EXT_CALIB_OUTPUT() EnableOutput(CALIB_GPIO, CALIB_PINPOS)
|
||
#define CLR_CALIB_PIN() CLR_PIN(CALIB_GPIO,CALIB_PIN)
|
||
//------------------------------------------------------------------------------
|
||
// for soft I2C
|
||
#define I2C_SDA GPIO_PIN_0
|
||
#define I2C_SDA_PINPOS GPIO_PinPos_0
|
||
#define I2C_SDA_GPIO GPIO1
|
||
#define I2C_SCL GPIO_PIN_1
|
||
#define I2C_SCL_PINPOS GPIO_PinPos_1
|
||
#define I2C_SCL_GPIO GPIO1
|
||
//------------------------------------------------------------------------------
|
||
// for eeprom
|
||
#define EEPROM_WP_PIN GPIO_PIN_4
|
||
#define EEPROM_WP_PINPOS GPIO_PinPos_4
|
||
#define EEPROM_WP_GPIO GPIO1
|
||
#define PARA_EEPROM BIT1
|
||
#define DATA_EEPROM BIT2
|
||
#define FROCK_EEPROM BIT1+BIT2+BIT3
|
||
//------------------------------------------------------------------------------
|
||
// for FRAM
|
||
#define FRAM_WP_PIN GPIO_PIN_4
|
||
#define FRAM_WP_PINPOS GPIO_PinPos_4
|
||
#define FRAM_WP_GPIO GPIO1
|
||
#define FRAM_CS_PIN GPIO_PIN_5
|
||
#define FRAM_CS_PINPOS GPIO_PinPos_5
|
||
#define FRAM_CS_GPIO GPIO0
|
||
//------------------------------------------------------------------------------
|
||
// for SPI
|
||
#define SCLK_PIN GPIO_PIN_5
|
||
#define SCLK_PINPOS GPIO_PinPos_5
|
||
#define SCLK_PIN_SOURCE GPIO_PinSource5
|
||
#define SCLK_PIN_CONFIG GPIO1_5_AF_SCLK
|
||
#define SCLK_GPIO GPIO1
|
||
|
||
#define SOMI_PIN GPIO_PIN_4
|
||
#define SOMI_PINPOS GPIO_PinPos_4
|
||
#define SOMI_PIN_SOURCE GPIO_PinSource4
|
||
#define SOMI_PIN_CONFIG GPIO1_4_AF_MISO
|
||
#define SOMI_GPIO GPIO1
|
||
|
||
#define SIMO_PIN GPIO_PIN_6
|
||
#define SIMO_PINPOS GPIO_PinPos_6
|
||
#define SIMO_PIN_SOURCE GPIO_PinSource6
|
||
#define SIMO_PIN_CONFIG GPIO1_6_AF_MOSI
|
||
#define SIMO_GPIO GPIO1
|
||
//------------------------------------------------------------------------------
|
||
#define EXT_CALIB_PIN GPIO_PIN_7
|
||
#define EXT_CALIB_PINPOS GPIO_PinPos_7
|
||
#define EXT_CALIB_GPIO GPIO1
|
||
|
||
#define RS485DE_PIN GPIO_PIN_1
|
||
#define RS485DE_PINPOS GPIO_PinPos_1
|
||
#define RS485DE_GPIO GPIO1
|
||
#define RS485DE_OUTPUT() EnableOutput(RS485DE_GPIO, RS485DE_PINPOS)
|
||
#define ENABLE_TXD() SET_PIN(RS485DE_GPIO, RS485DE_PIN)
|
||
#define ENABLE_RXD() CLR_PIN(RS485DE_GPIO, RS485DE_PIN)
|
||
// *****************************************************************************
|
||
// 'X' <20><><EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// *****************************************************************************
|
||
#define CTYPE_FR CURVE_1ST
|
||
#define ATYPE_VH CURVE_2ND
|
||
#define MICRO_FR CURVE_3RD
|
||
|
||
#define FRIDX CTYPE_FR // 0
|
||
#define RGIDX ATYPE_VH // 1
|
||
#define GAINX MICRO_FR // 2
|
||
#define VDUX 3 //
|
||
#define VDUGX 4 //
|
||
#define RIDX 5 //
|
||
#define NIDX 6 // NORMAL_VL - LOW_VL (TD INDEX)
|
||
#define TPCB 7 // PCB temperature
|
||
#define TGAS 8 // GAS temperature
|
||
#define TRH 9 // RH temperature
|
||
#define BATT 10 // Battery volatge
|
||
#define IVHDX 11 // IRH CODE test VHH By TD Control
|
||
#define VRHX 12 // VRH CODE
|
||
#define IVHUX 13 // IRH CODE test VHH By TU Control
|
||
#define VRRX 14 // VRR CODE
|
||
#define RHVOL 15 // RH VOLATAGE
|
||
#define RRVOL 16 // RR VOLATAGE
|
||
#define RHRES 17 // RH resistance
|
||
#define RRRES 18 // RR resistance
|
||
#define PORH 19 // RH Power
|
||
#define PDRH 20 // RH current Power
|
||
#define CVHHX 21 //
|
||
#define DVHHX 22 //
|
||
#define VHPA 23 //
|
||
#define RATO 24 // RR:RH
|
||
#define SDT 25 // ATYPE OFFSET
|
||
#define DIVHX 26 // IVHH(TD) - IVHH(TU)
|
||
#define TCOE 27 //
|
||
#define TVDUX 28 //
|
||
#define TVDUGX 29 //
|
||
#define FR_H 30 //
|
||
#define FR_L 31 //
|
||
#define ANX 32 //
|
||
#define ANX_MASK (ANX-1)
|
||
//------------------------------------------------------------------------------
|
||
#define NRH RRRES
|
||
#define NVHH IVHDX
|
||
#define CVHH CVHHX //
|
||
#define DVHH DVHHX //
|
||
#define NVDU VDUX
|
||
|
||
#define LRH RHRES
|
||
#define LVOL RHVOL
|
||
#define LVHH IVHDX
|
||
//------------------------------------------------------------------------------
|
||
#define GCFX NVDU //
|
||
#define GIDX LCDE //
|
||
#define FIDX FRIDX
|
||
#define RAOOM RATO
|
||
|
||
#define ATYPE_FR CURVE_2ND
|
||
#define REG_INDEX RGIDX
|
||
//------------------------------------------------------------------------------
|
||
#define CODE1 FR_H // 8300 FIDX
|
||
#define CODE2 FR_L // 8301 FIDX
|
||
#define CODE3 FRIDX // 8302 FIDX
|
||
#if(TEMP_CORR_USE_RR)
|
||
#define CODE4 RRRES // MICRO_FR // 8303 TEMP
|
||
#else
|
||
#define CODE4 TGAS // MICRO_FR // 8303
|
||
#endif
|
||
#define CODE5 MICRO_FR // 8304 С<><D0A1><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> С<><D0A1><EFBFBD><EFBFBD>
|
||
#define CODE6 DVHHX // 8305 С<><D0A1><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> DVHH
|
||
#define CODE7 RHVOL // 8306 С<><D0A1><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> LVOL // VRH
|
||
#define CODE8 RRVOL // 8307 С<><D0A1><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> NVOL // VRR
|
||
#define CODE9 VHPA // 8308 С<><D0A1><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> VHPA
|
||
#define CODE10 TPCB // 8309 С<><D0A1><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
|
||
#define CODE11 VDUX // 830A
|
||
#define CODE12 IVHDX // 830B
|
||
#define CODE13 DIVHX // 830C
|
||
#define CODE14 VRHX // 830D
|
||
#define CODE15 VDUGX // 830E
|
||
#define CODE16 RHRES // 830F
|
||
// *****************************************************************************
|
||
// 1S = 16384
|
||
// Circuit preparation process
|
||
#define START_CIRCUIT_SETUP 0
|
||
#define START_DETECT_STAGE_HEATING 1
|
||
#define START_DETECT_STAGE_PROCESSING 2
|
||
#define START_1ST_STAGE_HEATING 3
|
||
#define START_1ST_STAGE_SAMPLING 4
|
||
#define START_1ST_STAGE_PROCESSING 5
|
||
//------------------------------------------------------------------------------
|
||
#define FR_UPDATE 0x0A
|
||
#define FR_UPDATE_PULSE_TIME 16 // 1ms
|
||
//------------------------------------------------------------------------------
|
||
#define CIRCUIT_SETUP_TIME 82 // 5ms
|
||
//------------------------------------------------------------------------------
|
||
#define SET_UP_TIME_FROM_DETECT_TO_1ST_STAGE 1638 // 100ms
|
||
//------------------------------------------------------------------------------
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD>
|
||
//------------------------------------------------------------------------------
|
||
#define COUNT_VALUE_PER_MS 16 //10
|
||
#define SET_UP_TIME_OF_DETECT_STAGE (20 * COUNT_VALUE_PER_MS) ///20ms
|
||
#define SAMPLING_TIMES_IN_DETECT_STAGE 16 //
|
||
#define SHIFT_IN_DETECT_STAGE 4 //
|
||
//
|
||
#define SET_UP_TIME_OF_1ST_STAGE (40 * COUNT_VALUE_PER_MS) //40ms <20><>Ӧ<EFBFBD><D3A6><EFBFBD><CEA2><EFBFBD><EFBFBD>ADC 977SRS DMA<4D><41><EFBFBD><EFBFBD>32<33><32>ʱ<EFBFBD><CAB1>
|
||
#define PRESAMPLING_TIMES_IN_1ST_STAGE 32 //
|
||
#define SHIFT_IN_PRESAMPLING_1ST_STAGE 5 //
|
||
//
|
||
#define SAMPLING_TIME_OF_1ST_STAGE (70 * COUNT_VALUE_PER_MS) //70ms <20><>Ӧ<EFBFBD><D3A6><EFBFBD><CEA2><EFBFBD><EFBFBD>ADC 977SRS DMA<4D><41><EFBFBD><EFBFBD>64<36><34>ʱ<EFBFBD><CAB1>
|
||
#define SAMPLING_TIMES_IN_1ST_STAGE 64 //
|
||
#define SHIFT_IN_1ST_STAGE 6 //
|
||
|
||
//******************************************************************************
|
||
#define STATIC_HIGH_CODE 50
|
||
#define STATIC_LOW_CODE 50
|
||
// *****************************************************************************
|
||
//#define VHH_GAIN GAIN16
|
||
#define NIDX_GAIN GAIN32
|
||
#define GIDX_GAIN GAIN128 //GAIN_64
|
||
#define GIDX_SHIFT 4
|
||
//#define VRR_GAIN GAIN16
|
||
//#define VRH_GAIN GAIN1
|
||
|
||
#define SAMPLE_NORMOL_MODE 0
|
||
#define SAMPLE_TRACK_ZERO_MODE 1
|
||
#define SAMPLE_FAST_MODE 2
|
||
#define SAMPLE_MODE_MAX SAMPLE_TRACK_ZERO_MODE //SAMPLE_VDU_VRH_MODE
|
||
#define SAMPLE_DEFAULT_MODE SAMPLE_NORMOL_MODE //SAMPLE_VDU_VRR_MODE
|
||
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ÿ<><C3BF>4λ
|
||
#define SAMPLE_VDU 0
|
||
#define SAMPLE_GVDU 1
|
||
|
||
#define SAMPLE_VRH 0
|
||
#define SAMPLE_IRH 1
|
||
|
||
#define SWITCH_GAIN_THRESHOLD 0x36768
|
||
|
||
#define CAL_VDUX CTYPE_FR
|
||
#define CAL_ATYPE ATYPE_VH
|
||
#define CAL_VDUGX MICRO_FR
|
||
|
||
|
||
// *****************************************************************************
|
||
#if (DP2201_CORE_V5002)
|
||
//---------------------------------------------------------------------------------
|
||
#define VCOM 0.0
|
||
#define VREF_PER_CODE (ADC_VREF/32768)
|
||
#define VRR_BRIDGE_VOL (ADC_VREF - VCOM)
|
||
|
||
#define VRR_RA 33000.0
|
||
#define VRR_RB 2800.0
|
||
#define VRR_RDC (VRR_RB/(VRR_RA + VRR_RB))
|
||
#define VRR_VDC (VRR_BRIDGE_VOL*VRR_RDC)
|
||
|
||
#define VRR_ADC_GAIN 16.0
|
||
#define VRR_VREF ( VREF_PER_CODE/VRR_ADC_GAIN )
|
||
#define VRR_PER_CODE ( ADC_VREF/((ADC_VREF-VCOM)*GAIN*32768))
|
||
|
||
#define SampingADCInit() ADC_REF_Init(REF_INTERNAL_2P5V, REF_INTERNAL_1P25V)
|
||
#define SetupCTypeChannle(gain) ADC_Init(ADC_0, SPS_977, gain, ADC0_AIN0, ADC0_AIN1)
|
||
#define SetupRTypeChannle() ADC_Init(ADC_1, SPS_977, GAIN32, ADC0_AIN3,ADC1_AIN4)
|
||
#define SetupATypeChannle() ADC_Init(ADC_1, SPS_977, GAIN16, ADC1_AIN3,ADC1_AIN4)
|
||
#define SetupVRHChannle() ADC_Init(ADC_1, SPS_977, GAIN1, ADC0_AIN2,ADC1_AVSS)
|
||
#define SetupIRHChannle() ADC_Init(ADC_1, SPS_977, GAIN16, ADC0_AIN5,ADC1_AIN4)
|
||
|
||
//---------------------------------------------------------------------------------
|
||
#else if (DP2201_CORE_V5020)
|
||
//---------------------------------------------------------------------------------
|
||
#define VCOM 1261.0
|
||
#define VREF_PER_CODE (ADC_VREF/32768)
|
||
#define VRR_BRIDGE_VOL (ADC_VREF - VCOM)
|
||
|
||
#define VRR_RA 33000.0
|
||
#define VRR_RB 7500.0
|
||
#define VRR_RDC (VRR_RB/(VRR_RA + VRR_RB))
|
||
#define VRR_VDC (VRR_BRIDGE_VOL*VRR_RDC)
|
||
|
||
#define VRR_ADC_GAIN 32.0
|
||
#define VRR_VREF ( VREF_PER_CODE/VRR_ADC_GAIN )
|
||
#define VRR_PER_CODE ( ADC_VREF/((ADC_VREF-VCOM)*GAIN*32768))
|
||
|
||
#define SampingADCInit() ADC_REF_Init(REF_INTERNAL_2P5V, REF_INTERNAL_1P25V)
|
||
#define SetupCTypeChannle(gain) ADC_Init(ADC_0, SPS_977, gain, ADC0_AIN0, ADC0_AIN1)
|
||
#define SetupRTypeChannle() ADC_Init(ADC_1, SPS_977, GAIN32, ADC1_AIN3,ADC1_AIN5)
|
||
#define SetupVRHChannle() ADC_Init(ADC_1, SPS_977, GAIN1, ADC1_AIN2,ADC1_AVSS)
|
||
#define SetupIRHChannle() ADC_Init(ADC_1, SPS_977, GAIN16, ADC1_AIN7,ADC1_AIN4)
|
||
#define SetupRTypeVDCChannle() ADC_Init(ADC_1, SPS_977, GAIN1, ADC1_REFP,ADC1_AIN5)
|
||
#define SetupRTypeVREFChannle() ADC_Init(ADC_0, SPS_977, GAIN1, ADC0_REFP,ADC0_AIN5)
|
||
//---------------------------------------------------------------------------------
|
||
#endif
|
||
//---------------------------------------------------------------------------------
|
||
|
||
//---------------------------------------------------------------------------------------
|
||
#define StartSamplingADC() { \
|
||
ADC_SyncCmd(ENABLE); \
|
||
DMA_ADC_Init(ADC_0, sampleProcess.ADC0Buffer, sampleProcess.CounterMax); \
|
||
DMA_ADC_Init(ADC_1, sampleProcess.ADC1Buffer, sampleProcess.CounterMax); \
|
||
DMA_StartADC(ADC_0); \
|
||
DMA_StartADC(ADC_1); \
|
||
}
|
||
|
||
#define StopSamplingADC() { \
|
||
DMA_StopADC(ADC_0); \
|
||
DMA_StopADC(ADC_1); \
|
||
}
|
||
//---------------------------------------------------------------------------------------
|
||
#define sampleCTypeValue sampleProcess.ADC0Result
|
||
#define sampleATypeValue sampleProcess.ADC1Result
|
||
#define sampleRTypeValue sampleProcess.ADC1Result
|
||
#define ReadADCData()
|
||
//---------------------------------------------------------------------------------------
|
||
// 125ms/250ms/500ms/1000ms/2000ms/4000ms <20><><EFBFBD>ڶ<EFBFBD>ʱ uploadCounter: <20><><EFBFBD><EFBFBD>ֵ(>32.768)<29><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ֵ=(32768/1000)*t t(ms)Ϊ<><CEAA><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||
//#define USE_LPTIMER0
|
||
#define PrimaryTimer LPTIM1
|
||
#define StartPrimaryTimer( uploadCounter ) StartLPTimer1( uploadCounter )
|
||
#define ResetPrimaryTimer( uploadCounter ) ResetLPTimer1( uploadCounter )
|
||
#define EnablePrimaryTimerInterrupt() EnableLPTimer1Interrupt()
|
||
#define DisablePrimaryTimerInterrupt() DisableTimer1Interrupt()
|
||
#define StopPrimaryTimer() StopLPTimer1()
|
||
//#define PrimaryTimer_IRQ_Callback PrimaryTimer_IRQ_Callback// ManagePrimaryTimeInterval
|
||
|
||
//---------------------------------------------------------------------------------------
|
||
// 1ms<6D><73><EFBFBD><D7BC>ʱ uploadCounter: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Χ:(1~4000)
|
||
//#define USE_TIMER2
|
||
#define ProcessTimer TIM1
|
||
#define ProcessTimerIT TIM_IT_CC1
|
||
#define StartProcessTimer(uploadCounter) StartTimer1_CC1(uploadCounter)
|
||
#define ResetProcessTimer(uploadCounter) ResetTimer1_CC1(uploadCounter)
|
||
#define StopProcessTimer() StopTimer1()
|
||
#define EnableProcessTimerInterrupt() NVIC_EnableIRQ(TIM1_IRQn); // EnableTimer2Interrupt()
|
||
#define DisableProcessTimerInterrupt() NVIC_DisableIRQ(TIM1_IRQn); // DisableTimer2Interrupt()
|
||
//#define Timer2InterruptCallBack()
|
||
//#define ProcessTimer_IRQ_Callback ProcessTimerInterruptCallBack
|
||
|
||
//---------------------------------------------------------------------------------------
|
||
//<2F>Ƚ϶<C8BD>ʱ uploadCounter: <20><><EFBFBD><EFBFBD>ֵ(1~65535)<29><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ֵ=(65535/4000)*t t(ms)Ϊ<><CEAA><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||
//#define USE_TIMER1
|
||
//#define SamplingTimer TIM1
|
||
//#define StartSamplingTimer(uploadCounter) StartTimer1_CC1(uploadCounter)
|
||
//#define ResetSamplingTimer(uploadCounter) ResetTimer1_CC1(uploadCounter)
|
||
//#define StopSamplingTimer() StopTimer1()
|
||
//#define EnableSamplingInterrupt() NVIC_EnableIRQ(TIM1_IRQn); // EnableTimer1Interrupt()
|
||
//#define DisableSamplingInterrupt() NVIC_DisableIRQ(TIM1_IRQn); // DisableTimer1Interrupt()
|
||
//#define SamplingTimer_IRQ_Callback ProcessTimerInterruptCallBack
|
||
|
||
#define TEMP_SENSOR_RESULT RESULT_0_25_BIT
|
||
|
||
// *****************************************************************************
|
||
typedef struct
|
||
{
|
||
u16 DisplayZero : 1; // 1
|
||
u16 Mode: 2; // 3
|
||
u16 CType: 1; // 5
|
||
u16 AType: 2; // 7
|
||
u16 PreSampling: 1; // 10
|
||
u16 AutoDetectOffset: 1; // 11
|
||
u16 AutoDetectProcess: 2; // 13
|
||
u16 EnableRHTest : 1; // 14
|
||
u16 EnableRoughTest: 1; // 15
|
||
} __SAMPLE_STATUS_BIT_TypeDef;
|
||
|
||
typedef struct
|
||
{
|
||
__SAMPLE_STATUS_BIT_TypeDef State;
|
||
u16 NextRun;
|
||
u16 NextTime;
|
||
u16 Counter;
|
||
u16 CounterMax;
|
||
u16 CTypeGain;
|
||
u16 CTypeResult;
|
||
u16 ATypeResult;
|
||
u16 RTypeResult;
|
||
u32 ADC0Result;
|
||
u32 ADC1Result;
|
||
u32 ADC0Buffer[70];
|
||
u32 ADC1Buffer[70];
|
||
} TypeSample;
|
||
|
||
|
||
typedef struct
|
||
{
|
||
unsigned int CalTA;
|
||
unsigned int Value[3];
|
||
unsigned int DeltaVHH;
|
||
unsigned int TUVHH;
|
||
unsigned int TDVHH;
|
||
unsigned int TUIndex;
|
||
unsigned int TDIndex;
|
||
} TypeCalibOffset;
|
||
|
||
// *****************************************************************************
|
||
extern unsigned short int FRType;
|
||
// *****************************************************************************
|
||
void SetNextProcess(void);
|
||
void AnalogCircuitInit(void);
|
||
void EnableRHControlByTD(void);
|
||
void EnableRHControlByTU(void);
|
||
void TurnOffAnalogCircuit(void);
|
||
void RapidHeating(void);
|
||
void FirstStageHeating(void);
|
||
void StartNormolFlowMeasurement(void);
|
||
bool JudgmentFlowRate(void);
|
||
void CheckATypeSensor(void);
|
||
bool CheckSensor(u16 voltageIndex);
|
||
//void TemperatureCorrection(void)
|
||
u16 ComputeCTypeIndex(u16 detectIndex, u16 indexOffset);;
|
||
void ComputeFlowRateIndexAndFlowRate(void);
|
||
void FlowRateDealAndOuputSub(void);
|
||
void ComputeSampleData(u16 sampleNum, u16 sampleShift);
|
||
void SetSystemForADCSample(u16 sampleNum);
|
||
void ProcessTimerInterruptCallBack(void);
|
||
void FlowProcessManagement(void);
|
||
void CoreInit(void);
|
||
void CoreColdStartProcessing(void);
|
||
//void SamplingTimer_IRQ_Callback(void)
|
||
void PrimaryTimer_IRQ_Callback();
|
||
void SystemPolling(void);
|
||
|
||
//**************************************************************************
|
||
//File End------------------------------------------------------------------
|
||
#endif
|
||
//.h End--------------------------------------------------------------------
|
||
#endif
|
||
|