/**
  ******************************************************************************
  * @file    hc32_timer_driver.h
  * @author  (C)2015, Qindao ieslab Co., Ltd
  * @version V1.0
  * @date    2015-12-25
  * @brief   the function of the entity of system processor
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/


#ifndef __UWATER_TIMER1US_DRIVER_H__
#define __UWATER_TIMER1US_DRIVER_H__


#ifdef __cplusplus
extern "C" {
#endif

	
	
#include "ddl.h"
#include "type.h"
	 

#define TIME_1uS_Timer0			1
#define TIME_1uS_Timer3			0

 
 
 typedef enum{
	TIMER_5MS_KEY, 
	TIMER_5MS_ADC, 
	TIMER_5MS_ADC_OVERTIME, 
	TIMER_5MS_POW_DOWN, 
	TIMER_5MS_POW_ON, 
    TIMER_5MS_PULSE,
	TIMER_5MS_NBIOT,
	TIMER_5MS_MOVEALERT,
	TIMER_5MS_LEAKAGE,
	TIMER_5MS_TAMPER,
	TIMER_5MS_LCD,
	TIMER_5MS_UART0, 
	TIMER_5MS_UART1, 
	TIMER_5MS_UART2, 
	TIMER_5MS_UART3, 
	TIMER_5MS_LPUART0, 
	TIMER_5MS_LPUART1, 
    TIMER_5MS_VALVE,
	TIMER_5MS_VALVE_MAIN,
	TIMER_5MS_VALVE_PAUSE,
	TIMER_5MS_VALVE_ADC_CHECK,
	TIMER_5MS_VALVE_INIT,
	TIMER_5MS_LOWPOWER,
	TIMER_5MS_BLE_MONITOR,
    
    TIMER_5MS_MAX_SUM
} TIMER_5MS_ENUM;
 
typedef enum{   
    TIMER_100MS_TEST,
	TIMER_100MS_UPLOAD_MONITOR,
	TIMER_100MS_EEPROM,
	TIMER_100MS_SYS_UPLOAD,
	TIMER_100MS_BUZZER,
	TIMER_100MS_UP_DEAL,
	TIMER_100MS_FRAME,
	TIMER_100MS_NB_ONLINE,
	TIMER_100MS_NB_REV,
	TIMER_100MS_NB_ECLSNR,
	TIMER_100MS_WAIT_FRAME,
	TIMER_100MS_NBIOT,
	TIMER_100MS_POWERON_LCD,
	TIMER_100MS_SYS,
	TIMER_100MS_VALVE,
	TIMER_100MS_POWERDOWN,
    TIMER_100MS_IR_TX_38K_END,
	TIMER_100MS_IR_OPEN,
	TIMER_100MS_IR_KEY_OPEN_ONECE,
	TIMER_100MS_IR_KEY_OPEN_ALL,
	TIMER_100MS_UART0_SEND,
	TIMER_100MS_UART1_SEND,
	TIMER_100MS_UART2_SEND,
	TIMER_100MS_UART3_SEND,
	TIMER_100MS_LPUART0_SEND,
	TIMER_100MS_LPUART1_SEND,
	TIMER_100MS_UART0_BUSY,
	TIMER_100MS_UART1_BUSY,
	TIMER_100MS_UART2_BUSY,
	TIMER_100MS_UART3_BUSY,
	TIMER_100MS_LPUART0_BUSY,
	TIMER_100MS_LPUART1_BUSY,
    TIMER_100MS_TOUCH_RESET,
	TIMER_100MS_METER_RTCCLK_MONITOR,
    TIMER_100MS_LONGLONGKEYSTART,
    TIMER_100MS_LONGLONGKEYEND,
	//NBÉÏ±¨Ïà¹Ø
	TIMER_100MS_WAIT_SLEEP_GPRS,
	TIMER_100MS_ERROR_UPLOAD,
	TIMER_100MS_NBIOT_20,
	TIMER_100MS_BLE,
	TIMER_100MS_BLE_CON_REV30S,
	TIMER_100MS_BLE_CON_ALL90S,
	TIMER_100MS_BLE_SCAN,
	TIMER_100MS_BLE_CON,
    
    TIMER_100MS_MAX_SUM
}TIMER_100MS_ENUM;

//#define TIMER_100MS_MAX_SUM 10
 
/* Function Declare------------------------------------------------------------*/	 

void Timer1usInit(void);
void Timer1usWakeSleep(void);
void Timer1usPreSleep(void);
u8 TimerIfSleep(void);
u32 Timer1usGetTick(void);
void Set5msTimer(u8 timer_5ms_num,u16 timespan_5ms);
u8 Check5msTimer(u8 timer_5ms_num);
void Set100msTimer(u8 timer_100ms_num,u16 timespan_100ms);
u8 Check100msTimer(u8 timer_100ms_num);
u32 Get100msTimer(u8 timer_100ms_num);

#ifdef __cplusplus
}
#endif


#endif
//#endif /* __UWater_TIMER_DRIVER_H */

