📄 boot.c
字号:
/***************************************************************************************
****************************************************************************************
* MCUSYSTEM3(MS3)
*
* Hardware Name : MS3
* SoftWave Name : MS3
* Complie : Keil C Compile V7.10
* Version : MS3.00
* Description : -
* Created : 2007.3.11 by wangsw
* Modefied : -
****************************************************************************************
****************************************************************************************/
/***************************************************************************************
****************************************************************************************
* FILE : boot.c
* Description : The main program
*
* Copyright (c) 2003~2007 by WANG SHAOWEI. All Rights Reserved.
*
* History:
* Version Name Date Description
1.0 Wang Shaowei 2003/07/16 Initial Version (MCU System)
2.0 Wang Shaowei 2005/06/01 MS2
3.0 Wang Shaowei 2007/03/11 MS3
****************************************************************************************
****************************************************************************************/
#include "common.h"
/*==================================================================
* Function : init_process
* Description : System initialize entry
* Input Para : void
* Output Para : void
* Return Value: void
==================================================================*/
void init_process(void)
{
port_init();
Interrupt_priority_init();
flash_init();
uty_delay(0xF000);
mode_init();
uart_init(UART_RATE576);
mmi_init();
msg_init();
rtc_soft_init(0, 0, 0);
timer2_init(TRUE, TimerInterval5H); /*system timer,importance*/
INTERRUPT_ENABLE(); /*enable global interrupt*/
}
/*==================================================================
* Function : TimerCallbackFunc
* Description : 演示MSTimer程序,会周期性的执行
* Input Para : void
* Output Para : void
* Return Value: void
==================================================================*/
void TimerCallbackFunc1(void)
{
uprintf("Hw!\n");
MSTimerStart(MSTIMERMODE_HANDLE_IN_MSG, 1000, TimerCallbackFunc1);
}
void TimerCallbackFunc2(void)
{
uprintf("Hellow World2!\n");
MSTimerStart(MSTIMERMODE_HANDLE_IN_INT, 1200, TimerCallbackFunc2);
}
void TimerCallbackFunc3(void)
{
uprintf("Hellow World3!\n");
MSTimerStart(MSTIMERMODE_HANDLE_IN_MSG, 1500, TimerCallbackFunc3);
}
void TimerCallbackFunc4(void)
{
uprintf("Hellow World4!\n");
MSTimerStart(MSTIMERMODE_HANDLE_IN_INT, 1700, TimerCallbackFunc4);
}
/*==================================================================
* Function : main
* Description : Program entry
* Input Para : void
* Output Para : void
* Return Value: void
==================================================================*/
main(void)
{
U8 i = 0;
U16 Msg;
init_process();
MSTimerStart(MSTIMERMODE_HANDLE_IN_MSG, 100, TimerCallbackFunc1);
MSTimerStart(MSTIMERMODE_HANDLE_IN_INT, 110, TimerCallbackFunc2);
MSTimerStart(MSTIMERMODE_HANDLE_IN_MSG, 120, TimerCallbackFunc3);
//MSTimerStart(MSTIMERMODE_HANDLE_IN_INT, 130, TimerCallbackFunc4);
while(TRUE)
{
MSG_GET_MSG(&Msg);
switch(MSG_TYPE(Msg))
{
case MSG_KEY:
KeyStore = MSG_VALUE(Msg);
mmi_process(MSG_VALUE(Msg));
break;
case MSG_RTC:
//uputbyte(i++);
//uputbyte('*');
break;
case MSG_MSTIMER:
MSG_GET_DATA(&Msg);
FUNC(Msg);
break;
case MSG_TEST:
//special for test
break;
case MSG_NULL:
default:
//no msg, or error msg
break;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -