Fraise  2.1
FRAmework for Interfacing Software and Electronics
 All Classes Files Functions Typedefs Groups
Fraise device module.

Implements Fraise device protocol on the serial device.

Functions

void fraiseService (void)
 Fraise device service routine. More...
 
char fraiseSend (const unsigned char *buf, unsigned char len)
 Put a message into the Fraise TX queue. More...
 

Input Functions prototypes

User must define these four functions, that are called when the device receives a message. Each input function is called for a specific type of message. These functions then parse the received message using one of the Input Routines or Input Macros.

void fraiseReceiveCharBroadcast ()
 String message to every device.
 
void fraiseReceiveBroadcast ()
 Raw message to every device.
 
void fraiseReceiveChar ()
 String message to this device.
 
void fraiseReceive ()
 Raw message to this device.
 

Input routines

Use these functions when parsing the current message in Input Functions.

unsigned char fraiseGetChar ()
 Get next char from receive buffer.
 
unsigned char fraisePeekChar ()
 See next char (but keep it in the buffer).
 
unsigned char fraiseGetIndex ()
 Get read index in RXbuffer.
 
unsigned char fraiseGetAt (unsigned char i)
 Get RXbuffer content at a given place.
 
unsigned char fraiseGetLen ()
 Get total length of current receive packet.
 
void fraiseSendCopy ()
 Copy the RX buffer to TX buffer, in char mode, from first RX byte to the one before current index (don't add last fraiseGetChar). Used to return queried parameter setting.
 

Input macros (parameters set/get)

To be used in a switch() block.

#define PARAM_CHAR(n, p)
 in case n, assign next byte in the message to p
 
#define PARAM_INT(n, p)
 in case n, assign next 16 bit integer in the message to p
 
#define PARAM_LONG(n, p)
 in case n, assign next 32 bit integer in the message to p
 
#define GETPARAM(n, p, i)
 in case n, set i to the value of parameter p
 

Function Documentation

char fraiseSend ( const unsigned char *  buf,
unsigned char  len 
)

Put a message into the Fraise TX queue.

Parameters
bufAddress of the bytes buffer
lenNumber of bytes in the buffer
Returns
0 : success
-1 : TX queue overload
-2 : TX buffer format error
void fraiseService ( void  )

Fraise device service routine.

Check for input data from Fraise. Main loop should call this function peridically. This function will call input functions when the device receives a message from Fraise.