sdk/UART/SimplUART/APP/main.c

92 lines
1.4 KiB
C
Raw Normal View History

2022-11-19 17:16:40 +00:00
#include "SWM320.h"
#include "debug.h"
#include "userTimer.h"
#include "BoardCfg.h"
static void task1()
{
Printf(".");
}
/**
* @brief ͳ<EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD>
*
*/
static u32 sysWaitCnt[1] ={0};
static u32 sysWaitCnt2[1] ={0};
static void task2(){
Printf("[Idle:%d]\n",sysWaitCnt2[0]);
}
/**
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
*/
void TaskIdle(void)
{
static u32 Systick=0;
extern volatile u32 ptSysTick;
while (ptSysTick <= Systick)
{
//ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
sysWaitCnt[0]++;
}
//<2F><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
sysWaitCnt2[0] = sysWaitCnt[0];
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>ּ<EFBFBD><D6BC><EFBFBD>
static u32 CoreCnt=0;
CoreCnt++;
if (CoreCnt==1000){
CoreCnt=0;
sysWaitCnt[0] = 0;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ر𳤣<D8B1><F0B3A4A3><EFBFBD>ô<EFBFBD>;<EFBFBD><CDBE><EFBFBD>׷<EFBFBD><D7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(Systick<ptSysTick)
Systick ++;
//<2F><><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ر𳤣<D8B1><F0B3A4A3><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>µȴ<C2B5>ʱ<EFBFBD><CAB1>,<2C><>Ϊϵͳ<CFB5><CDB3>Ϊֻ<CEAA><D6BB><EFBFBD><EFBFBD>1<EFBFBD><31>ʱ<EFBFBD><CAB1>Ƭ
// Systick = ptSysTick;
}
int main(void)
{
uint32_t chr;
uint32_t err;
SystemInit();
DebugInit();
BoardInit();
Printf("\nSystemInit\n");
UserTimerAdd(task1,NULL,1000);
//<2F><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>ʱ<EFBFBD><CAB1>Ϊ1ms
SysTick_Config(SystemCoreClock/1000);
#include "uart_Net.h"
NetInit();
while (1)
{
//1<><31>ʱ<EFBFBD><CAB1>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD>
UserTimerTask();
TaskIdle();
}
}
/**
* @brief ϵͳ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
*
*/
void SysTick_Handler(void)
{
extern volatile u32 ptSysTick;
ptSysTick++;
}
// /**
// * @brief time0<65><30>ʱ<EFBFBD><CAB1><EFBFBD>ж<EFBFBD>
// *
// */
// void TIMR0_Handler(void)
// {
// TIMR_INTClr(TIMR0);
// extern volatile u32 ptSysTick;
// ptSysTick++;
// }