diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-05-29 16:27:29 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-05-29 16:27:29 +0200 |
commit | 3b2c2cf6b2af9e76b343a5a8fc8e9245f240690d (patch) | |
tree | f257a9a03b8205f55301901d00c5865f8b179607 /client/setup.c | |
parent | f466856892d94f5b42bf2369cae0fd73dd468dfa (diff) |
serial parsing working on client
Diffstat (limited to 'client/setup.c')
-rw-r--r-- | client/setup.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/client/setup.c b/client/setup.c new file mode 100644 index 0000000..d7314e8 --- /dev/null +++ b/client/setup.c @@ -0,0 +1,29 @@ +#include <stdio.h> +#include <stdlib.h> + +#include "serial.h" +#include "setup.h" +#include "../shared/bin.h" +#include "../shared/protocol.h" + +// pointers for endianness check +static const uint16_t _test = 1; +static const uint8_t *_ptest = (uint8_t *)&_test; +uint8_t g_w2_endianness; + +void w2_client_setup(int argc, char** argv) { + if (argc < 2) { + printf("usage: %s <serial port>\n", argv[0]); + exit(1); + } + + if (w2_serial_open(argv[1]) == 0) { + printf("serial port open fout\n"); + exit(1); + } + + w2_cmd_setup_handlers(); + + // check endianness + g_w2_endianness = *_ptest; +} |