-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
60 lines (39 loc) · 1.1 KB
/
main.cpp
File metadata and controls
60 lines (39 loc) · 1.1 KB
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
57
58
59
#include <iostream>
#include <thread>
#include "BoardArduino/main.ino"
#include "BoardST32/main.cpp"
#include "libs/include/Log.h"
void arduino_wrapper(){
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
Logger::dbg("Starting Arduino setup");
setup();
Logger::dbg("Arduino setup finished");
for(;;){
Logger::dbg("Starting Arduino Loop");
loop();
}
#pragma clang diagnostic pop
}
/*
* Connect board pins
* */
void connections(){
// connect pin 1 and pin 2
Arduino::_pinMap[0].connect(mbed::_pinMap[A0]);
Arduino::_pinMap[1].connect(mbed::_pinMap[A1]);
mbed::_Serial.connect(Arduino::Serial);
Arduino::Serial.connect(mbed::_Serial);
}
int main() {
Logger::severity = Logger::INFO;
connections();
Logger::dbg("Starting ST32 in another thread");
std::thread stMain (st_main);
Logger::dbg("ST32 main started");
std::thread arduinoLoop (arduino_wrapper);
Logger::info("press CTRL-D to exit (CTRL-Z on windows)");
char c;
while (std::cin >> c);
Logger::info("Exiting....");
}