Fraise  2.1
FRAmework for Interfacing Software and Electronics
 All Classes Files Functions Typedefs Groups
fraisedevice.h
1 /*********************************************************************
2  *
3  * Fraise device firmware v2.1
4  *
5  *********************************************************************
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software Foundation,
18  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20 *********************************************************************
21  * Copyright (c) Antoine Rousseau 2009 - 2015
22  ********************************************************************/
23 
24 #ifndef FRAISEDEV_H
25 #define FRAISEDEV_H
26 #include <core.h>
27 
34 //-------------- SYSTEM -------------
35 
36 void fraiseInit(void);
37 
42 void fraiseService(void); // to be called by the main loop.
43 void fraiseSetID(unsigned char id); // normally you don't have to use this.
44 void fraiseISR(); //to be called by low priority interrupt.
45 void fraiseSetInterruptEnable(char enable); //fraiseInit automatically enables interrupt.
46 char fraiseGetInterruptEnable(void);
47 
48 //-------------- OUT ----------------
49 
57 char fraiseSend(const unsigned char *buf,unsigned char len);
58 
59 
60 //-------------- IN ----------------
67 void fraiseReceiveChar();
68 void fraiseReceive();
70 
75 unsigned char fraiseGetChar();
76 unsigned char fraisePeekChar();
77 unsigned char fraiseGetIndex();
78 unsigned char fraiseGetAt(unsigned char i);
79 unsigned char fraiseGetLen();
80 void fraiseSendCopy();
81 
82 
83 
88 #define PARAM_CHAR(n,p) case n: p = fraiseGetChar();
90 #define PARAM_INT(n,p) case n: p = fraiseGetChar() << 8; p += fraiseGetChar();
92 #define PARAM_LONG(n,p) case n: p = ((unsigned long)( \
94  (((unsigned int)fraiseGetChar()) << 8) + fraiseGetChar()) ) << 16 | \
95  (((unsigned int)fraiseGetChar()) << 8) + fraiseGetChar();
96 
98 #define GETPARAM(n, p, i) case n: i = p; break
99 
100 
104 #endif //FRAISEDEV_H
105 
void fraiseReceive()
Raw message to this device.
void fraiseService(void)
Fraise device service routine.
Definition: fraisedevice.c:642
void fraiseReceiveBroadcast()
Raw message to every device.
void fraiseReceiveChar()
String message to this device.
char fraiseSend(const unsigned char *buf, unsigned char len)
Put a message into the Fraise TX queue.
Definition: fraisedevice.c:287
unsigned char fraiseGetChar()
Get next char from receive buffer.
Definition: fraisedevice.c:533
unsigned char fraiseGetLen()
Get total length of current receive packet.
Definition: fraisedevice.c:548
unsigned char fraisePeekChar()
See next char (but keep it in the buffer).
Definition: fraisedevice.c:543
void fraiseReceiveCharBroadcast()
String message to every device.
unsigned char fraiseGetAt(unsigned char i)
Get RXbuffer content at a given place.
Definition: fraisedevice.c:558
void fraiseSendCopy()
Copy the RX buffer to TX buffer, in char mode, from first RX byte to the one before current index (do...
Definition: fraisedevice.c:563
unsigned char fraiseGetIndex()
Get read index in RXbuffer.
Definition: fraisedevice.c:553