-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathmain.cpp
56 lines (44 loc) · 935 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <Arduino.h>
extern "C" {
void forth(void);
void raw_putchar(char c) {
Serial.write(c);
}
int kbhit(void) {
return Serial.available();
}
int getkey(void) {
while (!Serial.available()) continue;
return Serial.read();
}
void pin_output(int pin) {
pinMode(pin, OUTPUT);
}
void pin_input(int pin) {
pinMode(pin, INPUT);
}
void pin_input_pullup(int pin) {
pinMode(pin, INPUT_PULLUP);
}
unsigned long get_msecs(void) {
return millis();
}
void delay_microseconds(unsigned int usec) {
delayMicroseconds(usec);
}
}
void setup() {
Serial.begin(115200);
#ifdef DEBUG_SETUP_PAUSE
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
Serial.println("src/main.cpp:setup() pause");
digitalWrite(13, HIGH);
while (Serial.read() != ' ') continue;
digitalWrite(13, LOW);
Serial.println("src/main.cpp:setup() continue");
#endif
}
void loop() {
forth();
}