summaryrefslogtreecommitdiff
path: root/client/main.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-05-29 16:27:29 +0200
committerlonkaars <loek@pipeframe.xyz>2022-05-29 16:27:29 +0200
commit3b2c2cf6b2af9e76b343a5a8fc8e9245f240690d (patch)
treef257a9a03b8205f55301901d00c5865f8b179607 /client/main.c
parentf466856892d94f5b42bf2369cae0fd73dd468dfa (diff)
serial parsing working on client
Diffstat (limited to 'client/main.c')
-rw-r--r--client/main.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/client/main.c b/client/main.c
index d51f30b..1060f7d 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1,29 +1,15 @@
+#include "setup.h"
+#include "../shared/errcatch.h"
+#include "main.h"
#include "serial.h"
-
-#include <stdio.h>
-#include <unistd.h>
+#include "ui.h"
int main(int argc, char **argv) {
- if (argc < 2) {
- printf("usage: %s <serial port>\n", argv[0]);
- return 1;
- }
-
- if (w2_serial_open(argv[1]) == 0) {
- printf("serial port open fout");
- return 1;
- }
-
- printf("writing...\n");
- bool success = w2_serial_write("\xff\x14", 2);
- printf("writing %s\n", success ? "succeeded" : "failed");
+ w2_client_setup(argc, argv);
- printf("reading...\n");
while (1) {
- int res = w2_serial_read();
- if (res == -1) continue;
-
- printf("%02x ", (uint8_t)res);
- fflush(stdout);
+ w2_serial_main();
+ w2_errcatch_main();
+ w2_ui_main();
}
}