add specification sending
[mTask.git] / client / interface.h
1 #ifndef INTERFACE_H
2 #define INTERFACE_H
3
4 #include <stdbool.h>
5 #include <stdint.h>
6 #include <stdarg.h>
7
8 #ifdef LINUX
9 #define MAXTASKS 5
10 #define MAXSDSS 100
11 #define HAVELED 1
12 #define HAVEAIO 1
13 #define HAVEDIO 1
14
15 extern int gargc;
16 extern char **gargv;
17
18 #elif defined STM
19 #define MAXTASKS 5
20 #define MAXSDSS 100
21 #define HAVELED 1
22 #define HAVEAIO 1
23 #define HAVEDIO 1
24
25 #else
26 //Add you device here
27 #endif
28
29 #define read16() 256*(uint8_t)read_byte() + (uint8_t)read_byte()
30 #define from16(a, b) 256*a+b
31 #define write16(i) { write_byte((uint8_t)i/256); write_byte((uint8_t)i%256); }
32
33 /* Communication */
34 bool input_available(void);
35 uint8_t read_byte(void);
36 void write_byte(uint8_t b);
37
38 /* Analog and digital pins */
39 void write_dpin(uint8_t i, bool b);
40 bool read_dpin(uint8_t i);
41 void write_apin(uint8_t i, uint8_t a);
42 uint8_t read_apin(uint8_t i);
43
44 /* UserLED */
45 void led_on(uint8_t i);
46 void led_off(uint8_t i);
47
48 /* Delay and communication */
49 long millis(void);
50 void delay(long ms);
51
52 /* Auxilliary */
53 void setup(void);
54 void debug(char *fmt, ...);
55 void pdie(char *s);
56 void die(char *fmt, ...);
57
58 #endif