menu.c

来自「使用JTAG口对AT91R40008芯片进行FLASH编程的程序」· C语言 代码 · 共 76 行

C
76
字号
//*----------------------------------------------------------------------------
//*      ATMEL Microcontroller Software Support  -  ROUSSET  -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name           : menu.c
//* Object              : menu for Audio extention board
//*
//* 1.0 16/01/02 JPP    : Creation,
//*----------------------------------------------------------------------------

//* --------------------------- include file ----------------------------------
#include    "menu.h"
extern void test_menu(void);

//*----------------------------------------------------------------------------
//* Function Name       : print_default
//* Object              : print default message
//* Input Parameters    : none
//* Output Parameters   : none
//*----------------------------------------------------------------------------
void print_default(void)
{//* Begin
        at91_print(&COM0,"Invalid command entered. Please enter new command!\n\r");
}//* End
//*----------------------------------------------------------------------------
//* Function Name       : get_info
//* Object              : Get keyboard info
//* Input Parameters    : none
//* Output Parameters   : none
//*----------------------------------------------------------------------------
int get_info(void)
{//* Begin

	//* read Usart interface
    return at91_getch(&COM0,&command);

}//* End

//*----------------------------------------------------------------------------
//* Function Name       : main_menu
//* Object              : Main function of Polling USART 0
//* Input Parameters    : none
//* Output Parameters   : True
//*----------------------------------------------------------------------------
void main_menu( void )
{//* Begin
    //init global data

	for (;;)
  	{

    at91_print(&COM0,"\n\r0)Xmodem\n\r1)Test\n\r");

	while (get_info()) {}
    	switch (command)
    	{
        case'0':
			flash_menu();
        break;
        case'1':
          test_menu();
        break;

		default:
			 print_default();
        break;
    	} //* End switch
  	}//* End while
}//* End

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?