summaryrefslogtreecommitdiff
path: root/firmware/src/data_link.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/src/data_link.c')
-rw-r--r--firmware/src/data_link.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/firmware/src/data_link.c b/firmware/src/data_link.c
index a6d091a..330e973 100644
--- a/firmware/src/data_link.c
+++ b/firmware/src/data_link.c
@@ -1,7 +1,19 @@
+#include <string.h>
#include <zephyr/drivers/uart.h>
#include "data_link.h"
+ssize_t dl_encode_frame(uint8_t *payload, size_t len, uint8_t *dst) {
+ // FIXME check for maximum size
+
+ size_t flen = 8 + 8 + 2 + len + 4;
+
+ memset(dst, 0, flen);
+ memcpy((void *)(dst + 18), payload, len);
+
+ return flen;
+}
+
void dl_send_frame(const struct device *const uart_dev, uint8_t *buffer,
size_t len) {
for (size_t i = 0; i < len; i++) {