Fraise  2.1
FRAmework for Interfacing Software and Electronics
fraisedevice.h File Reference
#include <core.h>

Go to the source code of this file.

Macros

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
 

Functions

Initialization
void fraiseInit (void)
 Init fraise device stack. Normally automatically called by fruitInit(). More...
 
Service
void fraiseService (void)
 Fraise device service routine. More...
 
Fraise output to master
char fraiseSend (const unsigned char *buf, unsigned char len)
 Put a message into the Fraise TX queue. More...
 
Broadcast output
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...
 
Input Functions prototypes

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.
 

Input routines

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

#define fraiseGetInt()
 Get next 16 bit integer from receive buffer.
 
#define fraiseGetLong()
 Get next 32 bit long integer from receive buffer.
 
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.