93 lines
2.2 KiB
C
93 lines
2.2 KiB
C
|
//############################################################
|
|||
|
// FILE: Timer.c
|
|||
|
// Created on: 2017<31><37>1<EFBFBD><31>11<31><31>
|
|||
|
// Author: XQ
|
|||
|
// summary: Timer
|
|||
|
// <20><>ʱ<EFBFBD><CAB1>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>ѧϰʹ<CFB0>ã<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><CEBA><EFBFBD>;
|
|||
|
//<2F><>Ȩ<EFBFBD><C8A8><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD>
|
|||
|
//DSP/STM32<33><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD><C6BF><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//˶<><CBB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//<2F><>ַ: https://shuolidianzi.taobao.com
|
|||
|
//Author-QQ: 616264123
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>QQȺ<51><C8BA>314306105
|
|||
|
//############################################################
|
|||
|
#include "Timer.h"
|
|||
|
#include "GPIO_int.h"
|
|||
|
#include "Tim1_PWM.h"
|
|||
|
|
|||
|
extern TaskTime TaskTimePare;
|
|||
|
|
|||
|
void SysTickConfig(void)
|
|||
|
{
|
|||
|
/* Setup SysTick Timer for 1ms interrupts */
|
|||
|
if (SysTick_Config(SystemCoreClock /100)) // 10ms
|
|||
|
{
|
|||
|
/* Capture error */
|
|||
|
while (1);
|
|||
|
}
|
|||
|
/* Configure the SysTick handler priority */
|
|||
|
NVIC_SetPriority(SysTick_IRQn, 0x0);
|
|||
|
}
|
|||
|
|
|||
|
void RunSystimer(void)
|
|||
|
{
|
|||
|
if(TaskTimePare.IntClock_10ms==1)
|
|||
|
{
|
|||
|
TaskTimePare.IntClock_10ms=0;
|
|||
|
TaskTimePare.Tim10ms_flag = 1;
|
|||
|
if(++TaskTimePare.Tim100ms_count >=10)
|
|||
|
{
|
|||
|
TaskTimePare.Tim100ms_count=0;
|
|||
|
TaskTimePare.Tim100ms_flag=1;
|
|||
|
}
|
|||
|
}
|
|||
|
if(TaskTimePare.Tim100ms_flag==1)
|
|||
|
{
|
|||
|
if(++TaskTimePare.Tim500ms_count >=5)
|
|||
|
{
|
|||
|
TaskTimePare.Tim500ms_count=0;
|
|||
|
TaskTimePare.Tim500ms_flag=1;
|
|||
|
}
|
|||
|
}
|
|||
|
if(TaskTimePare.Tim500ms_flag==1)
|
|||
|
{
|
|||
|
if(++TaskTimePare.Tim1s_count >=2)
|
|||
|
{
|
|||
|
TaskTimePare.Tim1s_count=0;
|
|||
|
TaskTimePare.Tim1s_flag=1;
|
|||
|
}
|
|||
|
}
|
|||
|
if(TaskTimePare.Tim1s_flag == 1)
|
|||
|
{
|
|||
|
LED1_Toggle( );
|
|||
|
if(++TaskTimePare.Tim10s_count >=10)
|
|||
|
{
|
|||
|
TaskTimePare.Tim10s_count = 0;
|
|||
|
TaskTimePare.Tim10s_flag = 1;
|
|||
|
}
|
|||
|
}
|
|||
|
if(TaskTimePare.Tim10s_flag == 1)
|
|||
|
{
|
|||
|
if(++TaskTimePare.Tim1min_count >=6)
|
|||
|
{
|
|||
|
TaskTimePare.Tim1min_count = 0;
|
|||
|
TaskTimePare.Tim1min_flag = 1;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void CLEAR_flag(void) //<2F><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>־λ
|
|||
|
{
|
|||
|
TaskTimePare.Tim10ms_flag=0;
|
|||
|
TaskTimePare.Tim100ms_flag=0;
|
|||
|
TaskTimePare.Tim500ms_flag=0;
|
|||
|
TaskTimePare.Tim1s_flag=0;
|
|||
|
TaskTimePare.Tim1min_flag=0;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//===========================================================================
|
|||
|
// No more.
|
|||
|
//===========================================================================
|