?? sys_event.c
字號:
#include "includes.h"
_sys_evt_word_t _sys_event = 0;
unsigned char _key_flag = 0;
unsigned short _key_press_time = 0;
unsigned char LED_on_time = 0;
unsigned char start_check_voltage_flag = 0;
void _sys_evt_add(unsigned char evt)
{
_disable_interrupt();
_sys_event |= evt;
_enable_interrupt();
}
/* del an event
*/
void _sys_evt_del(unsigned char evt)
{
_disable_interrupt();
_sys_event &= ~(evt|SYS_EVT_REVERSED);
_enable_interrupt();
}
/* routine job on seconds
*/
void _on_seconds(void)
{
unsigned char i;
unsigned short int_flag, timer_flag = 0;
unsigned char secRund;
do{
int_flag = RFXX_WRT_CMD(0xcc00);
if(int_flag & 0x02)
{
timer_flag = 1;
}
}while(!(int_flag&0x01));
_sys_time.seconds++;
if(system_switch)
{
secRund = _sys_time.seconds % RF_SEND_PERIOD;
if(secRund == 0)
{
//_disable_interrupt();
RF_send_frame();
//_enable_interrupt();
}
else if(secRund == 1)
{
//TM1600_Init();
//P4.0 = 1;
AD_start();
}
else if(secRund == 2)
{
if(start_check_voltage_flag)
{
start_check_voltage_flag = 0;
get_Battery_Voltage();
}
}
else
{
if(start_check_dog_flag)
{
start_check_dog_flag = 0;
check_dog_timer_flag = 1;
}
}
}
if(_sys_time.seconds >= 60)
{
_sys_time.seconds -= 60;
_sys_time.minutes ++;
if(_sys_time.minutes >= 60)
{
_sys_time.minutes -= 60;
_sys_time.hours ++;
if(_sys_time.hours >= 24)
{
_sys_time.hours -= 24;
start_check_dog_flag = 1;
start_check_voltage_flag = 1;
}
}
}
}
/* key down
*/
void _on_key_down(void)
{
unsigned char i;
if(_key_flag == 0)
{
_key_flag = 1;
_key_press_time = 0;
TM80_Init();
}
}
void _on_key_press(void)
{
unsigned char i;
if(_key_flag )
{
_key_press_time++;
if(USER0)
{
_key_flag = 0;
TM80_Stop();
if(_key_press_time > 600)
{
if(system_switch)
{
system_switch = 0;
LED_on_time = 1;
}
else
{
_sys_time.seconds = 0;
LED_on_time = 3;
system_switch = 1;
}
LED = 0;
}
else if(_key_press_time > 10)
{
//RFXX_WRT_CMD(RF_TIME_CLEAR);
//RFXX_WRT_CMD(RF_TIME_SET);
//_sys_time.seconds = 0;
}
_key_press_time = 0;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -