Carmel (MAXREFDES18#) Code Documentation  V01.00
High Accuracy Analog Current/Voltage Output
 All Files Functions Variables Macros Pages
menu.h File Reference
#include "xbasic_types.h"
#include "xspi_l.h"
#include "stdio.h"
#include "MAXREFDES18.h"

Go to the source code of this file.

Macros

#define MODE_MENU   0
 Menu state machine state.
 
#define WAIT_KEYPRESS   1
 Menu state machine state.
 
#define CURRENT_RANGE_MENU   2
 Menu state machine state.
 
#define VOLTAGE_RANGE_MENU   3
 Menu state machine state.
 
#define CURRENT_RANGE_20_20_MENU   4
 Menu state machine state.
 
#define CURRENT_RANGE_0_20_MENU   5
 Menu state machine state.
 
#define CURRENT_RANGE_4_20_MENU   6
 Menu state machine state.
 
#define VOLTAGE_RANGE_10_10_MENU   13
 Menu state machine state.
 
#define VOLTAGE_RANGE_0_10_MENU   14
 Menu state machine state.
 
#define VOLTAGE_RANGE_0_5_MENU   15
 Menu state machine state.
 
#define KEYPRESS_ARROW_UP   240
 Assign up-arrow an extended ascii code which won't be used elsewhere.
 
#define KEYPRESS_ARROW_DOWN   241
 Assign up-arrow an extended ascii code which won't be used elsewhere.
 
#define KEYPRESS_ARROW_LEFT   242
 Assign up-arrow an extended ascii code which won't be used elsewhere.
 
#define KEYPRESS_ARROW_RIGHT   243
 Assign up-arrow an extended ascii code which won't be used elsewhere.
 
#define KEYPRESS_END   244
 Assign up-arrow an extended ascii code which won't be used elsewhere.
 

Functions

void menu_cls ()
 Function to clear the screen via Hyperterminal.
 
void menu_print_maxim_banner ()
 Print standard Maxim banner at top of Hyperterminal screen.
 
void menu_print_maxim_banner_big ()
 Print large Maxim banner at top of Hyperterminal screen.
 
void menu_print_prompt ()
 Print a standard prompt for keyboard input ">> ".
 
unsigned int menu_get_direct_entry (u32 nUartAddress, int nNumberBits)
 Retrieve keyboard entry of a value via the Hyperterminal connected UART.
 
u8 menu_retrieve_keypress (u32 nUartAddress)
 Get a single keypress via Hyperterminal.
 
void menu_print_mode_menu ()
 Print the mode menu.
 
void menu_print_current_range_menu ()
 Print the current range menu.
 
void menu_print_voltage_range_menu ()
 Print the voltage range menu.
 

Detailed Description


      Project: Carmel (MAXREFDES18#)
     Filename: menu.h
  Description: This module contains all the functions used to
               generate the menus and menu options used to run the
               MAXREFDES18# example firmware.

Revision History:
08-19-13 Rev 01.00 MG Initial Release


This code follows the following naming conventions:


char chPmodValue
char (array) sPmodString[16]
float fPmodValue
int nPmodValue
int (array) anPmodValue[16]
u16 uPmodValue
u16 (array) auPmodValue[16]
u8 uchPmodValue
u8 (array) auchPmodBuffer[16]
unsigned int unPmodValue
int * punPmodValue


Definition in file menu.h.

Macro Definition Documentation

#define CURRENT_RANGE_0_20_MENU   5

Menu state machine state.

Definition at line 74 of file menu.h.

#define CURRENT_RANGE_20_20_MENU   4

Menu state machine state.

Definition at line 73 of file menu.h.

#define CURRENT_RANGE_4_20_MENU   6

Menu state machine state.

Definition at line 75 of file menu.h.

#define CURRENT_RANGE_MENU   2

Menu state machine state.

Definition at line 71 of file menu.h.

#define KEYPRESS_ARROW_DOWN   241

Assign up-arrow an extended ascii code which won't be used elsewhere.

Definition at line 81 of file menu.h.

#define KEYPRESS_ARROW_LEFT   242

Assign up-arrow an extended ascii code which won't be used elsewhere.

Definition at line 82 of file menu.h.

#define KEYPRESS_ARROW_RIGHT   243

Assign up-arrow an extended ascii code which won't be used elsewhere.

Definition at line 83 of file menu.h.

#define KEYPRESS_ARROW_UP   240

Assign up-arrow an extended ascii code which won't be used elsewhere.

Definition at line 80 of file menu.h.

#define KEYPRESS_END   244

Assign up-arrow an extended ascii code which won't be used elsewhere.

Definition at line 84 of file menu.h.

#define MODE_MENU   0

Menu state machine state.

Definition at line 69 of file menu.h.

#define VOLTAGE_RANGE_0_10_MENU   14

Menu state machine state.

Definition at line 77 of file menu.h.

#define VOLTAGE_RANGE_0_5_MENU   15

Menu state machine state.

Definition at line 78 of file menu.h.

#define VOLTAGE_RANGE_10_10_MENU   13

Menu state machine state.

Definition at line 76 of file menu.h.

#define VOLTAGE_RANGE_MENU   3

Menu state machine state.

Definition at line 72 of file menu.h.

#define WAIT_KEYPRESS   1

Menu state machine state.

Definition at line 70 of file menu.h.

Function Documentation

void menu_cls ( )

Function to clear the screen via Hyperterminal.

Parameters
None
Return values
None

Definition at line 75 of file menu.c.

unsigned int menu_get_direct_entry ( u32  nUartAddress,
int  nNumberBits 
)

Retrieve keyboard entry of a value via the Hyperterminal connected UART.

Details
In most cases, this function is used to directly populate a register with a value. int nNumberBits equals the number of bits in the register. The value input by the user is capped to the maximum allowable for the given number of bits (e.g. - 6 bits => '64' max)
Parameters
[in]nUartAddress- address of the UART peripheral in the memory map
[in]nNumberBits- number of bits in register populate
Return values
Valueentered

Definition at line 171 of file menu.c.

void menu_print_current_range_menu ( )

Print the current range menu.

Parameters
None
Return values
None

Definition at line 287 of file menu.c.

void menu_print_maxim_banner ( )

Print standard Maxim banner at top of Hyperterminal screen.

Parameters
None
Return values
None

Definition at line 88 of file menu.c.

void menu_print_maxim_banner_big ( )

Print large Maxim banner at top of Hyperterminal screen.

Parameters
None
Return values
None

Definition at line 112 of file menu.c.

void menu_print_mode_menu ( )

Print the mode menu.

Parameters
None
Return values
None

Definition at line 269 of file menu.c.

void menu_print_prompt ( )

Print a standard prompt for keyboard input ">> ".

Parameters
None
Return values
None

Definition at line 145 of file menu.c.

void menu_print_voltage_range_menu ( )

Print the voltage range menu.

Parameters
None
Return values
None

Definition at line 307 of file menu.c.

u8 menu_retrieve_keypress ( u32  nUartAddress)

Get a single keypress via Hyperterminal.

Details
Returns ascii character corresponding to keypress with some preprocessing.
Escape sequences (Arrow keys and END) are mapped to decimal 240-244 (see defines)
Characters "0"-"9" converted to numbers 0-9
Lower case "a"-"z" converted to uppercase "A"-"Z"
Parameters
[in]nUartAddress- address of the UART peripheral in the memory map
Return values
Character,partiallydecoded.

Definition at line 225 of file menu.c.