summaryrefslogtreecommitdiff
path: root/shared/serial_parse.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-05-25 16:31:23 +0200
committerlonkaars <loek@pipeframe.xyz>2022-05-25 16:31:23 +0200
commitafa10fa556585d965e3a7d46c2fd5436d29cf3c6 (patch)
tree358191a988d0d23449d6a0381d3c1016048424f4 /shared/serial_parse.c
parent9cd83d662849fe72c83038a018107d9bbf5c2398 (diff)
`make format`
Diffstat (limited to 'shared/serial_parse.c')
-rw-r--r--shared/serial_parse.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/shared/serial_parse.c b/shared/serial_parse.c
index c8a3fae..0cda2d8 100644
--- a/shared/serial_parse.c
+++ b/shared/serial_parse.c
@@ -1,27 +1,27 @@
#include <stdbool.h>
+#include "bin.h"
#include "consts.h"
#include "serial_parse.h"
-#include "bin.h"
#ifdef W2_SIM
#include "../robot/orangutan_shim.h"
#endif
void w2_serial_handle(w2_s_bin *code) {
#ifdef W2_SIM
- serial_send((char*)code->data, code->bytes);
+ serial_send((char *)code->data, code->bytes);
// simprintf("yeah: %02x\n", code);
#endif
}
void w2_serial_parse(uint8_t byte) {
static uint8_t current_message[W2_SERIAL_READ_BUFFER_SIZE] = {0};
- static uint8_t current_message_index = 0;
- static uint8_t complete_message_length = 2;
+ static uint8_t current_message_index = 0;
+ static uint8_t complete_message_length = 2;
static bool attentive = false;
static bool listening = false;
-
+
if (byte == W2_SERIAL_START_BYTE) {
attentive = !attentive;
// if (attentive && listening) {
@@ -44,11 +44,10 @@ void w2_serial_parse(uint8_t byte) {
free(copy);
memset(&current_message, 0, W2_SERIAL_READ_BUFFER_SIZE);
- current_message_index = 0;
+ current_message_index = 0;
complete_message_length = 1;
- attentive = false;
- listening = false;
+ attentive = false;
+ listening = false;
return;
}
}
-