aboutsummaryrefslogtreecommitdiff
path: root/shared/serial_parse.c
diff options
context:
space:
mode:
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;
}
}
-