116 lines
1.9 KiB
C
116 lines
1.9 KiB
C
|
#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;
|
|||
|
}
|
|||
|
static void TestLCD()
|
|||
|
{
|
|||
|
for (u32 i = 0; i < 480; i++)
|
|||
|
{
|
|||
|
LCD_DrawWholeLine2(i, C_RED);
|
|||
|
}
|
|||
|
for (u32 i = 0; i < 480; i++)
|
|||
|
{
|
|||
|
LCD_DrawWholeLine2(i, C_GREEN);
|
|||
|
}
|
|||
|
for (u32 i = 0; i < 480; i++)
|
|||
|
{
|
|||
|
LCD_DrawWholeLine2(i, C_BLUE);
|
|||
|
}
|
|||
|
}
|
|||
|
void GUI_Task()
|
|||
|
{
|
|||
|
lv_task_handler();
|
|||
|
|
|||
|
}
|
|||
|
void XPT(){
|
|||
|
extern u8 TP_Read_XY(u16 *x,u16 *y);
|
|||
|
u16 x,y;
|
|||
|
TP_Read_XY(&x,&y);
|
|||
|
Printf("X:%d,Y:%d\n",x,y);
|
|||
|
}
|
|||
|
int main(void)
|
|||
|
{
|
|||
|
uint32_t chr;
|
|||
|
uint32_t err;
|
|||
|
SystemInit();
|
|||
|
DebugInit();
|
|||
|
BoardInit();
|
|||
|
Printf("\nSystemInit\n");
|
|||
|
UserTimerAdd(task1, NULL, 1000);
|
|||
|
UserTimerAdd(GUI_Task, NULL, 1);
|
|||
|
UserTimerAdd(task2, NULL, 1000);
|
|||
|
UserTimerAdd(XPT, NULL, 1000);
|
|||
|
//<2F><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>ʱ<EFBFBD><CAB1>Ϊ1ms
|
|||
|
SysTick_Config(SystemCoreClock / 1000);
|
|||
|
|
|||
|
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++;
|
|||
|
lv_tick_inc(1);
|
|||
|
}
|
|||
|
// /**
|
|||
|
// * @brief time0<65><30>ʱ<EFBFBD><CAB1><EFBFBD>ж<EFBFBD>
|
|||
|
// *
|
|||
|
// */
|
|||
|
// void TIMR0_Handler(void)
|
|||
|
// {
|
|||
|
// TIMR_INTClr(TIMR0);
|
|||
|
// extern volatile u32 ptSysTick;
|
|||
|
// ptSysTick++;
|
|||
|
// }
|