3ac929ce8c33aa999e57f8e7a95fdbf7f0350e54
[mTask.git] / client / nodemcu / interface.cpp
1 #include <Arduino.h>
2 #include <stdbool.h>
3 #include <stdint.h>
4
5 unsigned long getmillis(void)
6 {
7 return millis();
8 }
9
10 void msdelay(unsigned long ms)
11 {
12 delay(ms);
13 }
14
15 bool input_available(void)
16 {
17 return Serial.available();
18 }
19
20 uint8_t read_byte(void)
21 {
22 return Serial.read();
23 }
24
25 void write_byte(uint8_t b)
26 {
27 Serial.write(b);
28 }
29
30 void real_setup(void)
31 {
32 Serial.begin(115200);
33 Serial.println("Hello world!");
34 }
35
36 void debug(char *fmt, ...)
37 {
38 Serial.print(fmt);
39 }
40
41 void die(char *fmt, ...)
42 {
43 Serial.print(fmt);
44 while(1){
45 msdelay(100);
46 Serial.print("die");
47 }
48 }
49
50 void pdie(char *s)
51 {
52 die(s);
53 }