add notion on existential types, update interface
[msc-thesis1617.git] / listings / interface.h
1 #ifndef INTERFACE_H
2 #define INTERFACE_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #include <stdbool.h>
9 #include <stdint.h>
10 #include <stdarg.h>
11
12 #ifdef LINUX
13 #define APINS 128
14 #define DPINS 128
15 #define STACKSIZE 1024
16 #define MEMSIZE 1024
17 #define HAVELED 1
18 #define HAVEHB 1
19 #elif defined STM
20 ...
21 #endif
22
23 /* Communication */
24 bool input_available(void);
25 uint8_t read_byte(void);
26 void write_byte(uint8_t b);
27
28 /* Analog and digital pins */
29 #if DPINS > 0
30 void write_dpin(uint8_t i, bool b);
31 bool read_dpin(uint8_t i);
32 #endif
33 #if APINS > 0
34 void write_apin(uint8_t i, uint8_t a);
35 uint8_t read_apin(uint8_t i);
36 #endif
37
38 /* UserLED */
39 #if HAVELED == 1
40 void led_on(uint8_t i);
41 void led_off(uint8_t i);
42 #endif
43
44 #if HAVEHB == 1
45 uint16_t get_hb();
46 bool valid_hb();
47 uint16_t get_spo2();
48 bool valid_spo2();
49 #endif
50
51 /* Delay and communication */
52 unsigned long getmillis(void);
53 void msdelay(unsigned long ms);
54
55 /* Auxilliary */
56 void real_setup(void);
57 void real_debug(char *fmt, ...);
58 void pdie(char *s);
59 void die(char *fmt, ...);
60 void reset(void);
61
62 #ifdef __cplusplus
63 }
64 #endif
65 #endif