Implements Fraise device protocol on the serial device.
More...
Implements Fraise device protocol on the serial device.
|
char | fraiseSend (const unsigned char *buf, unsigned char len) |
| Put a message into the Fraise TX queue. More...
|
|
|
void | fraiseSendBroadcast (const unsigned char *buf, unsigned char len) |
| Broadcast a message to every connected fruit; this fonction is blocking (it returns when the message is sent) More...
|
|
|
User may define any of these four functions, that are called when the device receives a message. Each input function is 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.
|
|
|
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.
|
|
#define | fraiseGetInt() |
| Get next 16 bit integer from receive buffer.
|
|
#define | fraiseGetLong() |
| Get next 32 bit long integer from receive buffer.
|
|
|
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
|
|
◆ fraiseInit()
Init fraise device stack. Normally automatically called by fruitInit().
Configure serial port as a fraise device.
◆ fraiseService()
void fraiseService |
( |
void |
| ) |
|
Fraise device service routine.
Check for input data from Fraise. This function calls input functions when the device receives a message from master.
Normal users shouldn't call fraiseService() directly, but use fruitService() instead.
◆ fraiseSend()
char fraiseSend |
( |
const unsigned char * |
buf, |
|
|
unsigned char |
len |
|
) |
| |
Put a message into the Fraise TX queue.
- Parameters
-
buf | Address of the bytes buffer; the buffer must start with either 'C' (string message) or 'B' (raw bytes) |
len | Number of bytes in the buffer |
- Returns
- 0 : success
-
-1 : TX queue overload
-
-2 : TX buffer format error
◆ fraiseSendBroadcast()
void fraiseSendBroadcast |
( |
const unsigned char * |
buf, |
|
|
unsigned char |
len |
|
) |
| |
Broadcast a message to every connected fruit; this fonction is blocking (it returns when the message is sent)
- Parameters
-
buf | Address of the bytes buffer; the buffer must start with either 'C' (string message) or 'B' (raw bytes) |
len | Number of bytes in the buffer |