From 87900d6787f8e0af8d37cc313c4e0510ef0b1bf8 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 25 May 2022 19:02:23 +0200 Subject: serial receive working with empty handlers --- shared/bin.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'shared/bin.c') diff --git a/shared/bin.c b/shared/bin.c index 44c2e94..dac8415 100644 --- a/shared/bin.c +++ b/shared/bin.c @@ -15,8 +15,6 @@ #define _BYTE_2 ((uint32_t)(0xff << (_SHIFT_2B))) #define _BYTE_3 ((uint32_t)(0xff << (_SHIFT_3B))) -const uint8_t W2_STRUCT_T_SIZES[] = {sizeof(uint8_t), sizeof(uint16_t), sizeof(uint32_t)}; - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshift-count-overflow" w2_s_bin *w2_bin_from_uint8_t(uint8_t data) { @@ -70,3 +68,13 @@ w2_s_bin *w2_bin_s_alloc(uint16_t bytes, uint8_t *data) { memcpy(&temp->data, data, bytes); return temp; } + +w2_s_bin *w2_bin_s_cat(w2_s_bin *a, w2_s_bin *b) { + uint8_t data[a->bytes + b->bytes]; + memcpy(data, a->data, a->bytes); + memcpy(data + a->bytes, b->data, b->bytes); + w2_s_bin* c = w2_bin_s_alloc(a->bytes + b->bytes, data); + free(a); + free(b); + return c; +} -- cgit v1.2.3