add start of message to log

This commit is contained in:
Michele Balistreri 2023-03-15 19:05:56 +01:00
parent 511803d2e6
commit 55a32ffb44
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
1 changed files with 4 additions and 1 deletions

View File

@ -1,11 +1,14 @@
#include "log.h"
#include "hal.h"
const uint8_t LOG_MSG_START[] = { 0xa5, 0xca, 0xfe, 0x5a };
void _log(log_type_t type, const uint8_t* data, size_t len) {
uint8_t header[5];
header[0] = type;
memcpy(&header[1], &len, 4);
//hal_uart_send(UART_LOG, header, 5);
hal_uart_send(UART_LOG, LOG_MSG_START, 4);
hal_uart_send(UART_LOG, header, 5);
hal_uart_send(UART_LOG, data, len);
}