?? show.c
字號(hào):
#if !BASIC_BIOS
#include <stdio.h>
#include "44b0x.h"
#include "cli.h"
#include "uart.h"
#include "rtc.h"
#include "cpu.h"
static CommandNode CLI_NAME_SHOW =
{
"show", // node command hint pointer
"查詢顯示類", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_KEY, // node type
NULL // node command value
};
static CommandNode CLI_NAME_DATE =
{
"date", // node command hint pointer
"系統(tǒng)日期", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_KEY, // node type
CLI_SHOWDATE // node command value
};
static CommandNode CLI_NAME_TIME =
{
"time", // node command hint pointer
"系統(tǒng)時(shí)間", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_KEY, // node type
CLI_SHOWTIME // node command value
};
static CommandNode CLI_NAME_VERSION =
{
"version", // node command hint pointer
"版本類", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_KEY, // node type
NULL // node command value
};
static CommandNode CLI_NAME_HARDWARE =
{
"hardware", // node command hint pointer
"硬件版本", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_KEY, // node type
CLI_SHOWHARDWARE // node command value
};
static CommandNode CLI_NAME_SOFTWARE =
{
"software", // node command hint pointer
"軟件版本", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_KEY, // node type
CLI_SHOWSOFTWARE // node command value
};
static CommandNode CLI_NAME_BAUDRATE =
{
"baudrate", // node command hint pointer
"波特率", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_KEY, // node type
CLI_SHOWBAUDRATE // node command value
};
static CommandNode CLI_NAME_IP =
{
"ip-address", // node command hint pointer
"IP地址", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_KEY, // node type
CLI_SHOWIP // node command value
};
static CommandNode CLI_NAME_HELP =
{
"help", // node command hint pointer
"顯示幫助", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_KEY, // node type
CLI_SHOWHELP // node command value
};
CommandNode *CLI_ShowDate[] =
{
&CLI_NAME_SHOW, // show
&CLI_NAME_DATE, // date
NULL
};
CommandNode *CLI_ShowTime[] =
{
&CLI_NAME_SHOW, // show
&CLI_NAME_TIME, // time
NULL
};
CommandNode *CLI_ShowHardware[] =
{
&CLI_NAME_SHOW, // show
&CLI_NAME_VERSION, // version
&CLI_NAME_HARDWARE, // hardware
NULL
};
CommandNode *CLI_ShowSoftware[] =
{
&CLI_NAME_SHOW, // show
&CLI_NAME_VERSION, // version
&CLI_NAME_SOFTWARE, // software
NULL
};
CommandNode *CLI_ShowBaudrate[] =
{
&CLI_NAME_SHOW, // show
&CLI_NAME_BAUDRATE, // baudrate
NULL
};
CommandNode *CLI_ShowIp[] =
{
&CLI_NAME_SHOW, // show
&CLI_NAME_IP, // ip-address
NULL
};
CommandNode *CLI_ShowHelp[] =
{
&CLI_NAME_HELP, // help
NULL
};
void CLI_ShowProc( unsigned char key )
{
switch( key )
{
case CLI_SHOWDATE:
CLI_ShowDateProc();
break;
case CLI_SHOWTIME:
CLI_ShowTimeProc();
break;
case CLI_SHOWHARDWARE:
CLI_ShowVerHardProc();
break;
case CLI_SHOWSOFTWARE:
CLI_ShowVerSoftProc();
break;
case CLI_SHOWBAUDRATE:
CLI_ShowBaudRateProc();
break;
case CLI_SHOWIP:
CLI_ShowIpProc();
break;
case CLI_SHOWHELP:
CLI_ListHelp();
break;
default:
break;
}
return;
}
void CLI_ShowDateProc( void )
{
struct reldate date;
RTC_GetDate( &date );
UART_Printf("\r\nCurrent date : %04d-%02d-%02d, %s",
date.year, date.month, date.day, RTC_DayOfWeek[date.weekday] );
return;
}
void CLI_ShowTimeProc( void )
{
struct reltime time;
RTC_GetTime( &time );
UART_Printf("\r\nCurrent time : %02d:%02d:%02d",
time.hour, time.minute, time.second );
return;
}
void CLI_ShowVerHardProc( void )
{
UART_Printf("\r\nHardware version:1.00");
return;
}
void CLI_ShowVerSoftProc( void )
{
UART_Printf("\r\nSoftware version:1.00");
return;
}
void CLI_ShowBaudRateProc( void )
{
UART_Printf("\r\nCOM1: %ld00 bps/s", (MCLK >>4 ) / rUBRDIV0 / 100 );
return;
}
void CLI_ShowIpProc( void )
{
UART_Printf("\r\n1.1.1.1");
return;
}
#endif
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -