aboutsummaryrefslogtreecommitdiff
path: root/robot/sercomm.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-05-26 15:34:58 +0200
committerlonkaars <loek@pipeframe.xyz>2022-05-26 15:34:58 +0200
commitf073c9d3848dab915bed4844e9d13684aa5e23eb (patch)
treeb98e96d8a3d56f2ba75189dbb65740e0091b6705 /robot/sercomm.c
parent1913a240aab3a2ad72d477aa6fff840afdcad7a3 (diff)
implement direct control
Diffstat (limited to 'robot/sercomm.c')
-rw-r--r--robot/sercomm.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/robot/sercomm.c b/robot/sercomm.c
index c9c6194..2786b85 100644
--- a/robot/sercomm.c
+++ b/robot/sercomm.c
@@ -4,6 +4,7 @@
#include "../shared/bin.h"
#include "../shared/serial_parse.h"
#include "hypervisor.h"
+#include "mode_dirc.h"
#include "modes.h"
#include "orangutan_shim.h"
#include "sercomm.h"
@@ -76,7 +77,13 @@ void w2_cmd_mode_rx(w2_s_bin *data) {
void w2_cmd_sped_rx(w2_s_bin *data) { return; }
-void w2_cmd_dirc_rx(w2_s_bin *data) { return; }
+void w2_cmd_dirc_rx(w2_s_bin *data) {
+ w2_s_cmd_dirc_rx *message = malloc(w2_cmd_sizeof(data->data, data->bytes));
+ memcpy(message, data->data, data->bytes);
+
+ g_w2_mode_dirc_motor_l = w2_bin_ntoh16(message->left);
+ g_w2_mode_dirc_motor_r = w2_bin_ntoh16(message->right);
+}
void w2_cmd_cord_rx(w2_s_bin *data) { return; }