27 *c_outChar = c_inChar;
52 *c_outChar = c_inChar;
80 *c_outChar = c_inChar;
123 #ifndef MICROCONTROLLER 127 #define B_IS_SPEC b_isSpec 153 #if !defined(MICROCONTROLLER) || defined(__DOXYGEN__) 173 #ifndef MICROCONTROLLER 179 if (xferVar[u_index].pu8_data != NULL) {
180 free(xferVar[u_index].pu8_data);
181 free(xferVar[u_index].psz_format);
182 free(xferVar[u_index].psz_name);
183 free(xferVar[u_index].psz_desc);
189 #ifndef MICROCONTROLLER 196 memset(xferVar, 0,
sizeof(xferVar));
212 #if !defined(MICROCONTROLLER) || defined(__DOXYGEN__) 248 if (pu8_data == NULL) {
255 #ifdef MICROCONTROLLER 269 uint u_byteIndex = u_index / 8;
271 uint8_t u8_mask = 1 << (u_index % 8);
281 uint u_byteIndex = u_index / 8;
283 uint8_t u8_mask = 1 << (u_index % 8);
295 if (xferVar[
u_index].u8_size != (u_varLength - 1)) {
304 #ifndef MICROCONTROLLER 338 st_len = strlen(psz_s) + 1;
339 pXferVar->
psz_format = (
char*) malloc(
sizeof(
char)*st_len);
345 st_len = strlen(psz_s) + 1;
346 pXferVar->
psz_name = (
char*) malloc(
sizeof(
char)*st_len);
352 st_len = strlen(psz_s) + 1;
353 pXferVar->
psz_desc = (
char*) malloc(
sizeof(
char)*st_len);
378 static uint u_varLength;
380 static uint8_t* pu8_data = NULL;
381 #ifndef MICROCONTROLLER 383 static char c_lastCommand;
474 #ifdef MICROCONTROLLER 496 #ifndef MICROCONTROLLER 502 if (pu8_data == NULL)
525 if (--u_varLength == 0) {
528 #ifndef MICROCONTROLLER 538 #ifndef MICROCONTROLLER 544 if (pu8_data == NULL)
550 #ifndef MICROCONTROLLER 578 #ifndef MICROCONTROLLER 604 "interrupted command",
607 "variable size mismatch",
608 "read only variable",
609 "illegal variable specification",
The machine is waiting for an additional character; c_outChar is not valid.
RECEIVE_ERROR getReceiveMachineError()
The machine is waiting for another character; c_outChar is not valid.
void resetCommandFindMachine()
void clearReceiveMachineError()
#define VAR_SIZE_MASK
A mask which removes all but the variable size bits in the varBits field.
Reading the variable index for a long var command.
static uint u_specLength
The length of the var spec data.
unsigned int uint
An abbreviation for an unsigned integer.
void resetReceiveMachine()
A repeated command was received; c_outChar contains the command.
A character was received; c_outChar contains the character.
Reading the variable length for a long/specification command.
static BOOL validateLength(uint u_varLength)
#define CMD_SEND_RECEIVE_VAR
static void freeVariable(uint u_index)
static RECEIVE_ERROR receiveError
RECEIVE_STATE getReceiveMachineState()
static RECEIVE_STATE receiveState
Current state of the receive state machine.
static uint8_t * validateIndex()
const char * getReceiveErrorString()
Returns an error string matching the last error code.
static uint8_t au8_varSpecData[(UINT8_MAX+1)+3]
char * psz_desc
Description of this variable. PC only.
Reading data bytes in from a command.
uint8_t au8_xferVarWriteable[NUM_XFER_VARS/8+((NUM_XFER_VARS % 8) > 0)]
static CMD_STATE cmdState
The current state of the command-finding state machine.
At the start of the machine.
uint getReceiveMachineIndex()
XFER_VAR xferVar[NUM_XFER_VARS]
A table to hold the state of transfer variables.
CMD_OUTPUT stepCommandFindMachine(char c_inChar, char *c_outChar)
void clearReceiveStruct()
BOOL isReceiveMachineData()
char * psz_format
printf format string to use in displaying the variable. PC only.
The microcontroller is sent a variable specification.
BOOL isReceiveMachineChar()
The state machine produced no output, but is waiting for additional input.
void assignBit(uint u_index, BOOL b_bitVal)
The destination variable is read-only.
static void parseVarSpec()
Reading the variable index for a specification command.
RECEIVE_ERROR stepReceiveMachine(char c_inChar)
A command was received; c_outChar contains the command.
#define CHAR_RECEIVED_INDEX
Waiting for a command or escaped CMD_TOKEN.
BOOL isReceiveMachineSpec()
RECEIVE_ERROR notifyOfTimeout()
static CMD_OUTPUT cmdOutput
The current output of the command-finding state machine.
#define NUM_ERROR_CODES
Number of error codes in the RECEIVE_ERROR enum.
BOOL getReceiveMachineIsSpec()
unsigned char uint8_t
An abbreviation for an 8-bit unsigned integer.
Routines which implement the uC comm protocol.
uint8_t u8_size
Size of data in bytes - 1: 0 = 1 byte, etc.
static const char * apsz_errorDesc[NUM_ERROR_CODES]
char getReceiveMachineOutChar()
The machine is in its starting state.
BOOL isVarWriteable(uint u_index)
uint getVarIndex(char c_cmd)
uint getVarLength(char c_cmd)