summaryrefslogtreecommitdiff
path: root/serial_link/protocol/byte_stuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'serial_link/protocol/byte_stuffer.c')
-rw-r--r--serial_link/protocol/byte_stuffer.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/serial_link/protocol/byte_stuffer.c b/serial_link/protocol/byte_stuffer.c
index f0071b1f77..dfd5942ebc 100644
--- a/serial_link/protocol/byte_stuffer.c
+++ b/serial_link/protocol/byte_stuffer.c
@@ -24,7 +24,7 @@ SOFTWARE.
#include "protocol/byte_stuffer.h"
#include "protocol/frame_validator.h"
-#include <stdio.h>
+#include "protocol/physical.h"
// This implements the "Consistent overhead byte stuffing protocol"
// https://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing
@@ -92,3 +92,13 @@ void recv_byte(byte_stuffer_state_t* state, uint8_t data) {
}
}
}
+
+void send_frame(uint8_t* data, uint16_t size) {
+ if (size > 0) {
+ uint8_t numZeroes = size + 1;
+ const uint8_t zero = 0;
+ send_data(&numZeroes, 1);
+ send_data(data, size);
+ send_data(&zero, 1);
+ }
+}