Debian Codegraph @

Patches/Arduino/iannix_lib.h

raw symbols SCIP
1 /*
2 This file is part of IanniX, a graphical real-time open-source sequencer for digital art
3 Copyright (C) 2010-2015 — IanniX Association
4
5 Project Manager: Thierry Coduys (http://www.le-hub.org)
6 Development: Guillaume Jacquemin (https://www.buzzinglight.com)
7
8 This file was written by Guillaume Jacquemin.
9
10 IanniX is a free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24 #ifndef IANNIX_LIB_H
25 #define IANNIX_LIB_H
26
27 #if defined(ARDUINO) && ARDUINO >= 100
28 #include "Arduino.h"
29 #else
30 #include "WProgram.h"
31 #include <pins_arduino.h>
32 #endif
33
34 #define iannixBufferDataIndexMax 16
35 #define iannixBufferArgumentIndexMax 10
36 #define iannixBufferCharEnd1 ';'
37 #define iannixBufferCharEnd2 '\n'
38 #define iannixBufferCharSeparator ' '
39
40 class IanniX {
41 public:
42 static char iannixBuffer[iannixBufferArgumentIndexMax][iannixBufferDataIndexMax];
43 static unsigned int iannixBufferDataIndex, iannixBufferArgumentIndex, iannixBufferArgumentIndexCache;
44 public:
45 static const int count() {
46 return iannixBufferArgumentIndexCache;
47 }
48 static char* toChar(const unsigned int argumentIndex) {
49 return iannixBuffer[argumentIndex];
50 }
51 static int toInt(const unsigned int argumentIndex) {
52 return atoi(iannixBuffer[argumentIndex]);
53 }
54 static float toFloat(const unsigned int argumentIndex) {
55 return atof(iannixBuffer[argumentIndex]);
56 }
57
58 public:
59 static boolean hasData();
60 static void setup() {
61 Serial.begin(115200);
62 }
63 static void send(const char* message) {
64 Serial.println(message);
65 }
66 };
67
68 #endif IANNIX_LIB_H
69
70