/*
 ******************************************************************************
 *
 * @file     sys_tim.h
 * @brief    system timer module
 *                 
 *
 * @version  1.0
 * @date     2023/05/12   09:59:40
 * @author   Alex Xu
 *
 * Copyright (c) 2013-2099,Tkplusemi Technology Co.,Ltd.
 * All Rights Reserved
 *
 * History:
 * Revision          Date           Author            Desc
 * 1.0.0            2023/07/12      Alex          build this file
 ******************************************************************************
 */

#ifndef __sys_tim_H__
#define __sys_tim_H__

#include "define.h"

//#define FOSC 11059200L

#define T1MS 1000
#define T100uS 100
#define T500uS 500
#define T10MS 10000			//FOSC/12/100

#define T10MS_DEBOUNCE_1S		100		//10ms周期定时1s

#define	C_TIM0_Reload	(65535 - T1MS)	//1ms (65535 - N) * 1/FOSC = Time -> (65535 - N) * 1/11.0592M = 1ms -> 65535 - N = 11059.2 -> N = 65535 - 11059.2
//extern void Sys_Tim0_Init(void );

#if TIMER1_ENABLE

#ifdef BREATHING_LIGHT
#define	C_TIM1_Reload	(65535 - T100uS) //100us 用于呼吸灯
#else	
#define	C_TIM1_Reload	(65535 - T500uS) //1ms
#endif

extern	bit F_sys_tim1_tick;
extern void Sys_Tim1_Init(void );

#endif

extern  bit F_sys_tim_5ms;
#ifdef LED_DISPLAY	
extern  bit F_sys_tim_10ms;
#endif
#if DISPLAY_6PIN_188
extern  bit F_sys_tim_500ms;
#endif
extern  bit F_sys_tim_250ms;
extern  bit F_sys_tim_100ms;
extern  bit F_sys_tim_1s;

extern void Sys_Tim_Handler(void );
extern void Delay200ms(void);

#endif

