You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
724 B

#include "log.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
static UART_HandleTypeDef *m_huart;
bool g_enable_log;
/*********************************************************************
* @fn _write
*
* @brief Support Printf Function
*
* @param *buf - UART send Data.
* size - Data length
*
* @return size: Data length
*/
__attribute__((used)) int _write(int fd, char *buf, int size) {
int i;
for (i = 0; i < size; i++) {
uint8_t c = *buf++;
if (m_huart != NULL) HAL_UART_Transmit(m_huart, &c, 1, 100);
}
return size;
}
void ifly_loggger_init(UART_HandleTypeDef *huart) { m_huart = huart; }
void ifly_loggger_enable(bool enable) { g_enable_log = enable; }