76 lines
2.0 KiB
C
76 lines
2.0 KiB
C
/*
|
|
******************************************************************************
|
|
*
|
|
* @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__
|
|
/*_____ I N C L U D E S ____________________________________________________*/
|
|
|
|
#include "define.h"
|
|
/******************************************************************************\
|
|
Macro definitions
|
|
\******************************************************************************/
|
|
|
|
//#define FOSC 11059200L
|
|
|
|
#define T1MS 1000
|
|
#define T100uS 100
|
|
#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
|
|
|
|
#if TIMER1_ENABLE
|
|
|
|
#define C_TIM1_Reload (65535 - T100uS)
|
|
|
|
#endif
|
|
|
|
/******************************************************************************\
|
|
Variables definitions
|
|
\******************************************************************************/
|
|
extern bit F_sys_tim_10ms;
|
|
extern bit F_sys_tim_250ms;
|
|
extern bit F_sys_tim_100ms;
|
|
extern bit F_sys_tim_1s;
|
|
|
|
#if TIMER1_ENABLE
|
|
|
|
extern bit F_sys_tim1_tick;
|
|
|
|
#endif
|
|
|
|
|
|
/******************************************************************************\
|
|
Functions definitions
|
|
\******************************************************************************/
|
|
extern void Sys_Tim_Handler(void );
|
|
|
|
extern void Delay15ms(void);
|
|
|
|
#if TIMER1_ENABLE
|
|
|
|
extern void Sys_Tim1_Init(void );
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|