Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: PinDetect libmDot mbed-rtos mbed
common.h File Reference
contains constants and prototypes needed by other files. More...
Go to the source code of this file.
Data Structures | |
| struct | parameterInfo |
| < paramter information structure More... | |
Typedefs | |
| typedef uint8(* | Read )(void) |
| read function template to return 8 bit unsigned int | |
| typedef uint16(* | ReadRegLength )(uint16 regAddress, uint8 *regData, uint16 length) |
| read function template to return 8 bit unsigned int | |
| typedef void(* | Write8 )(uint8 value) |
| write function template to write 8 bit unsigned value | |
| typedef void(* | WriteReg8 )(uint16 regAddress, uint8 *regData) |
| write function template to write 8 bit unsigned value | |
| typedef void(* | Write16 )(uint16 value) |
| write function template to write 16 bit unsigned value | |
| typedef void(* | WriteAnalog )(float fltValue) |
| write function template to write analog value | |
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. | |
| void | setDate (char *str) |
| gets current time and date. | |
| void | date (void) |
| gets current time and date. | |
| 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. | |
| float | strtofloat (char *str) |
| converts an ASCII string to float. | |
| uint16 | power (uint8 num, uint8 pow) |
| takes number(num) to power(pow) | |
| void | displayParameter (uint8 num) |
| displays information about a parameter | |
Variables | |
| char * | c_time_string |
| relatine time and date string | |
| char | time_string [] |
| relatine time only string | |
| char | TransmitBuffer [TRANSMIT_BUFFER_SIZE] |
| charaters to be sent to the console | |
| time_t | epoch |
| time in seconds since epoch | |
| struct parameterInfo | parameters [] |
| array of structures of valid parameters | |
Detailed Description
contains constants and prototypes needed by other files.
Definition in file common.h.
Typedef Documentation
| typedef uint8(* Read)(void) |
| typedef uint16(* ReadRegLength)(uint16 regAddress, uint8 *regData, uint16 length) |
| typedef void(* Write16)(uint16 value) |
| typedef void(* Write8)(uint8 value) |
| typedef void(* WriteAnalog)(float fltValue) |
| typedef void(* WriteReg8)(uint16 regAddress, uint8 *regData) |
Function Documentation
| void date | ( | void | ) |
gets current time and date.
gets date current time and date since last set date command. there is no real time clock in the system so date is relative.
- Returns:
- None
Definition at line 32 of file utilities.cpp.
| 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.
| void 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.
| int8 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.
| uint8 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.
| uint16 power | ( | uint8 | num, |
| uint8 | pow | ||
| ) |
takes number(num) to power(pow)
This routine takes an 8 bit integer num and raises it ot the power pow.
- Parameters:
-
[in] num - 8 bit integer number [in] pow - 8 bit power to raise num
- Returns:
- uint16 - 16 bit num to the power pow
Definition at line 193 of file utilities.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.
| void setDate | ( | char * | str ) |
gets current time and date.
gets date current time and date since last set date command. there is no real time clock in the system so date is relative.
- Returns:
- None
Definition at line 51 of file utilities.cpp.
| float strtofloat | ( | char * | str ) |
converts an ASCII string to float.
This routine converts a floating point number in the form xx.yy to a floating point number.
- Parameters:
-
[in] str - pointer to a character string containing the floating point number
- Returns:
- float - converted number
Definition at line 106 of file utilities.cpp.
Variable Documentation
| char* c_time_string |
relatine time and date string
Definition at line 24 of file globals.cpp.
| time_t epoch |
time in seconds since epoch
Definition at line 26 of file globals.cpp.
| struct parameterInfo parameters[] |
array of structures of valid parameters
Definition at line 108 of file globals.cpp.
| char time_string[] |
relatine time only string
Definition at line 25 of file globals.cpp.
| char TransmitBuffer[TRANSMIT_BUFFER_SIZE] |
charaters to be sent to the console
Definition at line 37 of file commandline.cpp.
Generated on Sat Jul 16 2022 13:04:30 by
1.7.2