diff options
author | HoodieJeansJordans <104365411+HoodieJeansJordans@users.noreply.github.com> | 2022-06-05 13:21:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-05 13:21:09 +0200 |
commit | bc283424c699effcfa84816c609ca7f00ed5259a (patch) | |
tree | ff67ced022120ae05997c1b1f3a49db992e4fcbf /shared/protocol.h | |
parent | 5692ca8c65f5f5617d6987b610e425a32c0d8e1d (diff) | |
parent | 38d71eb97dbd8f895ed483128b332f018a5ae1d4 (diff) |
Merge branch 'lonkaars:master' into master
Diffstat (limited to 'shared/protocol.h')
-rw-r--r-- | shared/protocol.h | 60 |
1 files changed, 6 insertions, 54 deletions
diff --git a/shared/protocol.h b/shared/protocol.h index 7aa5e9f..93e53f4 100644 --- a/shared/protocol.h +++ b/shared/protocol.h @@ -1,14 +1,14 @@ #pragma once +/** @file protocol.h */ + #include <stdint.h> #include <stdlib.h> #include "bin.h" +#include "bool.h" #include "consts.h" - -typedef uint8_t bool; -#define false 0 /* NOLINT */ -#define true 1 /* NOLINT */ +#include "io.h" #define W2_SERIAL_START_BYTE 0xff @@ -52,56 +52,6 @@ typedef enum { #pragma pack(push, 1) -/** momentary button input struct */ -typedef struct { - bool pressed; -} w2_s_i_push; - -/** qtr contrast sensor input struct */ -typedef struct { - uint16_t range; -} w2_s_i_contrast; - -/** distance sensor input struct */ -typedef struct { - uint16_t detection; -} w2_s_i_distance; - -/** battery input struct */ -typedef struct { - uint16_t charge_level; -} w2_s_i_battery; - -/** motor output struct */ -typedef struct { - int16_t speed; -} w2_s_o_motor; - -/** underside led output struct */ -typedef struct { - bool on; -} w2_s_o_led; - -/** lcd output struct */ -typedef struct { - char text[16]; -} w2_s_o_display; - -/** struct containing all i/o */ -typedef struct { - w2_s_i_push button[5]; - w2_s_i_contrast qtr[5]; - w2_s_i_distance front_distance; - w2_s_i_distance side_distance; - w2_s_i_battery battery; - - w2_s_o_motor motor_left; - w2_s_o_motor motor_right; - w2_s_o_led led_red; - w2_s_o_led led_green; - w2_s_o_display lcd; -} w2_s_io_all; - typedef struct { uint8_t opcode; uint8_t id; @@ -164,6 +114,8 @@ typedef struct { uint8_t status; } w2_s_cmd_bomd_tx; +#define W2_CMD_SRES_RX_TYPE_REINITGS 0 +#define W2_CMD_SRES_RX_TYPE_PREVMODE 1 typedef struct { uint8_t opcode; uint8_t type; |