Example #1
0
void DrawInfoTimer(u8 y,u8 idx)
{
	u16 m,s;
	TIMERRUN *pt=&TxTimer[idx];
	s32 timer=pt->Cnt;

	//显隐判断
	if(pt->Cfg->Type==TMR_HIDE)
	{
		LcdSetXy(4,y);
		LcdWriteSp(48);
		return;
	}
	
	//绘制图标		
	LcdSetXy(4,y);
	LcdWriteChar(9);
	LcdWriteChar(10+idx);
		
	//绘制符号
	if(timer<0)
	{
		LcdWriteChar('-');
		timer=-timer;
	}
	else
	{
		LcdWriteChar(' ');
	}
	
	//计算MS
	m=timer/60%60;
	s=timer%60;
	
	//显示
	if(!PageMainTimerCol && PageMainTimerSel==idx+1)
	{
		LcdWriteSp(30);
	}
	else
	{
		char sp=pt->Run ? (PageMainTimerCol?0x36:0) : 0x36;//秒点闪烁图标计算
		LcdWriteChar('0'+m/10);
		LcdWriteChar('0'+m%10);
		LcdWriteLine(0);
		LcdWriteLine(sp);
		LcdWriteLine(sp);//运行时秒点闪烁
		LcdWriteChar('0'+s/10);
		LcdWriteChar('0'+s%10);		
	}
}
/*!
 * Display the actual menu on the LCD.
 */
void vPerformMenu(MENU_ITEM menu_item)
{
    switch (menu_item)
    {
        case sMenu_StartupScreen:
            // Display SiLabs startup screen
            LcdClearDisplay();
            LcdSetPictureCursor(LCD_LINE_1, 20);
            LcdDrawPicture(silabs87x40);
            memcpy(lcd_data, "Network Application  ", 21);
            LcdWriteLine(LCD_LINE_7, lcd_data);
            sprintf(lcd_data, "  P2P Demo v        ");
            memcpy(&lcd_data[12], APP_FW_VERSION, 6);
            LcdWriteLine(LCD_LINE_8, lcd_data);
            break;

        case sMenu_TxScreen:
            // Show Tx screen
            LcdClearDisplay();
            memcpy(lcd_data, "Network Application  ", 21);
            LcdWriteLine(LCD_LINE_1, lcd_data);
            memcpy(lcd_data, "---------------------", 21);
            LcdWriteLine(LCD_LINE_2, lcd_data);
            LcdWriteLine(LCD_LINE_7, lcd_data);
            memcpy(lcd_data, "       Tx Node       ", 21);
            LcdWriteLine(LCD_LINE_3, lcd_data);
            sprintf(lcd_data, "Packet content:%5u", wPacketCounter);
            LcdWriteLine(LCD_LINE_5, lcd_data);
            break;

        case sMenu_TxRefreshCounter:
            // Refresh number of packets sent
            sprintf(lcd_data, "Packet content:%5u", wPacketCounter);
            LcdWriteLine(LCD_LINE_5, lcd_data);
            break;

        case sMenu_PacketTransmit:
            // Show transmit state
            memcpy(lcd_data, " Sleep    Transmit * ", 21);
            LcdWriteLine(LCD_LINE_8, lcd_data);
            break;

        case sMenu_SleepMode:
            // Show sleep state
            memcpy(lcd_data, " Sleep *  Transmit   ", 21);
            LcdWriteLine(LCD_LINE_8, lcd_data);
            break;
    }
}