Timothy Mulrooney / Mbed 2 deprecated frdm_i2c_test

Dependencies:   PinDetect libmDot mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

commandline.cpp File Reference

commandline.cpp File Reference

command line - contains all functions related to the command line. More...

Go to the source code of this file.

Functions

uint8 getLine ()
 Reads characters from UART and retuns a line when new line seen.
void executeCmd ()
 executes the command in line array.
int8 getCmd ()
 parses command line to find position of command in validCmds array.
int8 getParameter (char *param)
 searches parameters array to find position of command in parameters array.
int8 findParameter (char *string)
 finds all parameters with string in the name.
uint8 readParam (uint8 paramNum)
 reads in parameter at position paramNum.
void displayParameter (uint8 num)
 displays information about a parameter

Variables

char line [LINE_SIZE]
 character array read
char lastLine [NUM_LINES][LINE_SIZE]
 array of previous command lines
int8 indexNextLineIn = 0
 index of next position to save current command line
int8 indexNextLineOut = 0
 index of next position to read out saved comman dlines
int8 linesInBuffer = 0
 number of lines in command line buffer
uint8 escapeSeen = 0
 escape character seen
int8 charCount
 number of characters in the current command line
int8 cursorPosition
 current cursor position in the current command line
char TransmitBuffer [TRANSMIT_BUFFER_SIZE]
 charaters to be sent to the console
uint8 binaryParameter
 result of any 8 bit integer read operation
uint16 digitalParameter
 result of any 16 bit integer read operation
float analogParameter
 result of any floating point read operation
char * validCmds [] = {"help","version","read","readReg","write","writeReg","info","find","run","stop","date","hvstate"}
 array of valid commands - case insensitive

Detailed Description

command line - contains all functions related to the command line.

Definition in file commandline.cpp.


Function Documentation

void displayParameter ( uint8  num )

displays information about a parameter

This routine all of the information in the parameters array for the selected parameter.

Parameters:
[in]num- 8 bit integer location in the parameters array
Returns:
uint16 - 16 bit num to the power pow

Definition at line 926 of file commandline.cpp.

executeCmd (  )

executes the command in line array.

calls getCmd to parse command and then switches to proper command handler. command list kept short for simplicity.

read, write, and info command will read and verify parametsr on command line.

Returns:
None

Definition at line 214 of file commandline.cpp.

int8 findParameter ( char *  string )

finds all parameters with string in the name.

searches the entire parameters array for all names that contain string.

Parameters:
[in]string- pointer to a string.
Returns:
int8 - 0 string found in some names. -1 if string not found in any name

Definition at line 742 of file commandline.cpp.

getCmd (  )

parses command line to find position of command in validCmds array.

copies line array into cmd array until a space or end of line then searches cmd array for a match in validCmds array.

Returns:
int8 - position of command in command array if found. -1 if not found

Definition at line 671 of file commandline.cpp.

getLine (  )

Reads characters from UART and retuns a line when new line seen.

if enableCLI == 1 - process input characters

if enableCLI == 0 - return 0

will call UART_1_CetChar() to get the next character.

if ch == 0 - no character available

if ch != 0 - add ch to line array

features:

up arrow will go through last NUM_LINES commands.

backspace will remove last typed character

Returns:
uint8 - 0 - no character ready or line not finished, 1 - line complete (CR seen)

Definition at line 64 of file commandline.cpp.

int8 getParameter ( char *  param )

searches parameters array to find position of command in parameters array.

searches the entire parameters array for a name match with param.

Parameters:
[in]param- pointer to an array containing the parameter name.
Returns:
int8 - position of command in command array if found. -1 if not found

Definition at line 712 of file commandline.cpp.

uint8 readParam ( uint8  paramNum )

reads in parameter at position paramNum.

This will only be called if there was a valid parameter match found. will read correct parameter based on parameter type. This will call the correct read function specified in the paramter array. A parameter will be read into one of binaryParameter, digitalParameter, or analogParameter based on type.

Parameters:
[in]paramNum- pointer to a character string containing parameter name
Returns:
uint8 - type of parameter

Definition at line 786 of file commandline.cpp.


Variable Documentation

result of any floating point read operation

Definition at line 41 of file commandline.cpp.

result of any 8 bit integer read operation

Definition at line 39 of file commandline.cpp.

int8 charCount

number of characters in the current command line

Definition at line 35 of file commandline.cpp.

current cursor position in the current command line

Definition at line 36 of file commandline.cpp.

result of any 16 bit integer read operation

Definition at line 40 of file commandline.cpp.

uint8 escapeSeen = 0

escape character seen

Definition at line 34 of file commandline.cpp.

int8 indexNextLineIn = 0

index of next position to save current command line

Definition at line 30 of file commandline.cpp.

int8 indexNextLineOut = 0

index of next position to read out saved comman dlines

Definition at line 31 of file commandline.cpp.

char lastLine[NUM_LINES][LINE_SIZE]

array of previous command lines

Definition at line 29 of file commandline.cpp.

char line[LINE_SIZE]

character array read

Definition at line 28 of file commandline.cpp.

int8 linesInBuffer = 0

number of lines in command line buffer

Definition at line 32 of file commandline.cpp.

char TransmitBuffer[TRANSMIT_BUFFER_SIZE]

charaters to be sent to the console

Definition at line 37 of file commandline.cpp.

char* validCmds[] = {"help","version","read","readReg","write","writeReg","info","find","run","stop","date","hvstate"}

array of valid commands - case insensitive

Definition at line 42 of file commandline.cpp.