ZDBMS/code_app/InterruptApp.c

71 lines
1.7 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/********************************************************************************
Copyright (C), Sinowealth Electronic. Ltd.
Author: Sino
Version: V0.0
Date: 2020/04/26
History:
V2.0 2020/04/26 Preliminary
********************************************************************************/
#include "Main.h"
BOOL bTimer5msFlg;
BOOL bTimer50msFlg;
BOOL bTimer1sFlg;
U8 ucTimer50ms;
U8 ucTimer1s;
/*************************************************************************************************
* 函数名: InterruptINT4App
* 参 数: IntSource外部中断4的中断源
* 返回值: 无
* 描 述: 外部中断处理包括ALARM中断和按键中断用于低功耗唤醒系统
*************************************************************************************************/
void InterruptINT4App(U8 IntSource)
{
if(IntSource == INT4_EXS45) //Alarm
{
if(bPDFlg || bSleepFlg)
{
McuClockSet(MCU_CLK_24MHz);
bWakeupFlg = 1;
}
}
else if(IntSource == INT4_EXS46) //Key wakeup
{
if(bPDFlg || bSleepFlg)
{
McuClockSet(MCU_CLK_24MHz);
bWakeupFlg = 1;
}
}
}
/*************************************************************************************************
* 函数名: InterruptTimer3App
* 参 数: 无
* 返回值: 无
* 描 述: 定时器周期为5mS产生5mS、50mS、1S三个标志
*************************************************************************************************/
void InterruptTimer3App(void)
{
bTimer5msFlg = 1; //5ms标志为预留标志
if(++ucTimer50ms >= TIME_5MS_50MS)
{
ucTimer50ms = 0;
bTimer50msFlg = 1;
}
if(++ucTimer1s >= TIME_5MS_1S)
{
ucTimer1s = 0;
bTimer1sFlg = 1;
}
KeyScan(); //扫描按键
}