The Shell functions
The shell contains the following functions:
The vConsoleLoop function
This function takes data from the serial line and performs the parser of the received string. A string was received after a Enter key was inserted. It executes the command inserted if any and, if an invalid command was inserted it prints the log “Invalid command”.
A valid command is defined in the ptCommandTbl. If the inserted string contains less character than the command name the parser also parses less character, but if two o more commands have the same “beginning” characters the procedure prints the log “Ambigous command”.
The vEchon function
Enable the echo on the serial line.
The vEchoff function
The iGetChar function
It returns the character received on the serial line.
The function parses the linefeed (replacing with CR) character and handles the backspace and cancel(0x7f) code. If no data is present in the receiver it loops until a character is received.
The function skips the control commands and if the echo is on it echoes the received character.
The iPutChar function
int iPutChar(int iChar)
Send the character iChar over the serial line.
(to be continued…)