Skip to content

Commit 232b0e2

Browse files
committed
First draft
1 parent 932ea14 commit 232b0e2

File tree

2 files changed

+80
-4
lines changed

2 files changed

+80
-4
lines changed

.vscode/settings.json

+63-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,67 @@
55
"C_Cpp.formatting": "clangFormat",
66
"C_Cpp.clang_format_style": "{BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 80}",
77
"C_Cpp.clang_format_sortIncludes": true,
8-
"C_Cpp.intelliSenseCacheSize": 0
8+
"C_Cpp.intelliSenseCacheSize": 0,
9+
"files.associations": {
10+
"atomic": "cpp",
11+
"array": "cpp",
12+
"*.tcc": "cpp",
13+
"bitset": "cpp",
14+
"cctype": "cpp",
15+
"chrono": "cpp",
16+
"clocale": "cpp",
17+
"cmath": "cpp",
18+
"condition_variable": "cpp",
19+
"csignal": "cpp",
20+
"cstdarg": "cpp",
21+
"cstddef": "cpp",
22+
"cstdint": "cpp",
23+
"cstdio": "cpp",
24+
"cstdlib": "cpp",
25+
"cstring": "cpp",
26+
"ctime": "cpp",
27+
"cwchar": "cpp",
28+
"cwctype": "cpp",
29+
"deque": "cpp",
30+
"forward_list": "cpp",
31+
"list": "cpp",
32+
"unordered_map": "cpp",
33+
"unordered_set": "cpp",
34+
"vector": "cpp",
35+
"exception": "cpp",
36+
"algorithm": "cpp",
37+
"any": "cpp",
38+
"functional": "cpp",
39+
"iterator": "cpp",
40+
"map": "cpp",
41+
"memory": "cpp",
42+
"memory_resource": "cpp",
43+
"numeric": "cpp",
44+
"optional": "cpp",
45+
"random": "cpp",
46+
"ratio": "cpp",
47+
"set": "cpp",
48+
"string": "cpp",
49+
"string_view": "cpp",
50+
"system_error": "cpp",
51+
"tuple": "cpp",
52+
"type_traits": "cpp",
53+
"utility": "cpp",
54+
"fstream": "cpp",
55+
"initializer_list": "cpp",
56+
"iomanip": "cpp",
57+
"iosfwd": "cpp",
58+
"iostream": "cpp",
59+
"istream": "cpp",
60+
"limits": "cpp",
61+
"mutex": "cpp",
62+
"new": "cpp",
63+
"ostream": "cpp",
64+
"sstream": "cpp",
65+
"stdexcept": "cpp",
66+
"streambuf": "cpp",
67+
"thread": "cpp",
68+
"cinttypes": "cpp",
69+
"typeinfo": "cpp"
70+
}
971
}

Core/Src/main.cpp

+17-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,32 @@
66

77
#include "ST-LIB.hpp"
88

9+
uint32_t local_serversocket_port = 8202;
10+
std::string localip = "127.0.0.1";
11+
std::unique_ptr<ServerSocket> serversocket = nullptr;
12+
StackPacket* inputpacket = nullptr;
13+
914
int main(void) {
1015
#ifdef SIM_ON
1116
SharedMemory::start();
1217
#endif
13-
14-
DigitalOutput led_on(PA1);
18+
DigitalInput input(PA1);
19+
bool value = false;
20+
serversocket = std::make_unique<ServerSocket>(localip,local_serversocket_port);
21+
StackPacket* mypacket = new StackPacket(15,&value);//Random id
1522
STLIB::start();
1623

17-
Time::register_low_precision_alarm(100, [&]() { led_on.toggle(); });
24+
Time::register_low_precision_alarm(100,[&](){
25+
if(mysocket->is_connected() == false){
26+
mysocket->reconnect();
27+
}
28+
});
1829

1930
while (1) {
31+
value = input.read_pin_state();
32+
serversocket->send_packet(mypacket);
2033
STLIB::update();
34+
std::this_thread::sleep_for(std::chrono::milliseconds(500));
2135
}
2236
}
2337

0 commit comments

Comments
 (0)