command: Add a command_encode_and_frame() helper

Add a helper function that calls command_encodef() followed by
command_add_frame().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor committed 2018-05-28 10:43:39 -04:00
1 parent cb4e165071
commit c8af3feee6
6 files changed
+17 -9

No files matched your search

+1 -2
View File
@@ -108,8 +108,7 @@ console_sendf(const struct command_encoder *ce, va_list args)
// Generate message
uint8_t *buf = &transmit_buf[tmax];
uint_fast8_t msglen = command_encodef(buf, ce, args);
command_add_frame(buf, msglen);
uint_fast8_t msglen = command_encode_and_frame(buf, ce, args);
// Start message transmit
writeb(&transmit_max, tmax + msglen);
+1 -2
View File
@@ -65,8 +65,7 @@ console_sendf(const struct command_encoder *ce, va_list args)
// Generate message
uint8_t *buf = &transmit_buf[tpos];
uint_fast8_t msglen = command_encodef(buf, ce, args);
command_add_frame(buf, msglen);
uint_fast8_t msglen = command_encode_and_frame(buf, ce, args);
// Start message transmit
transmit_pos = tpos + msglen;