ringbuffer and tests
This commit is contained in:
17
cube/User/Src/logger.c
Normal file
17
cube/User/Src/logger.c
Normal file
@ -0,0 +1,17 @@
|
||||
#include <main.h>
|
||||
#include <usart.h>
|
||||
#include <logger.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void log(char *msg) {
|
||||
uint16_t len = strlen(msg);
|
||||
|
||||
if (HAL_UART_Transmit_IT(&debugUart, msg, len) != HAL_OK) {
|
||||
if(RingBuffer_Write(&txBuf, msg, len) != RING_BUFFER_OK)
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
Reference in New Issue
Block a user