new upgrade
This commit is contained in:
@@ -3,56 +3,45 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/event_groups.h"
|
||||
|
||||
#define LOGGER_SERIAL_BIT BIT0
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Logger event group LOGGER_SERIAL_BIT
|
||||
*
|
||||
*/
|
||||
extern EventGroupHandle_t logger_event_group;
|
||||
#define LOGGER_SERIAL_BIT BIT0
|
||||
|
||||
/**
|
||||
* @brief Initialize logger
|
||||
*
|
||||
*/
|
||||
void logger_init(void);
|
||||
extern EventGroupHandle_t logger_event_group;
|
||||
|
||||
/**
|
||||
* @brief Print
|
||||
*
|
||||
* @param str
|
||||
*/
|
||||
void logger_print(const char* str);
|
||||
void logger_init(void);
|
||||
|
||||
/**
|
||||
* @brief Print va
|
||||
*
|
||||
* @param str
|
||||
* @param l
|
||||
* @return int
|
||||
*/
|
||||
int logger_vprintf(const char* str, va_list l);
|
||||
void logger_print(const char *str);
|
||||
|
||||
/**
|
||||
* @brief Get entries count
|
||||
*
|
||||
* @return uint16_t
|
||||
*/
|
||||
uint16_t logger_count(void);
|
||||
int logger_vprintf(const char *fmt, va_list args);
|
||||
|
||||
/**
|
||||
* @brief Read line from index, set index for reading next entry
|
||||
*
|
||||
* @param index
|
||||
* @param str
|
||||
* @param v
|
||||
* @return true When has next entry
|
||||
* @return false When no entry left
|
||||
*/
|
||||
bool logger_read(uint16_t *index, char **str, uint16_t* len);
|
||||
uint16_t logger_count(void);
|
||||
|
||||
// opcional: quantas mensagens foram dropadas por contenção de mutex
|
||||
uint32_t logger_dropped_count(void);
|
||||
|
||||
#endif /* LOGGER_H_ */
|
||||
/**
|
||||
* ⚠️ API antiga (não recomendada): devolve ponteiro interno.
|
||||
* Pode ficar inválido se houver novas escritas/rotação.
|
||||
*/
|
||||
bool logger_read(uint16_t *index, char **str, uint16_t *len);
|
||||
|
||||
/**
|
||||
* ✅ API recomendada: copia a entrada para buffer do caller (safe).
|
||||
* out é sempre terminado com '\0' (se out_sz > 0).
|
||||
*/
|
||||
bool logger_read_copy(uint16_t *index, char *out, uint16_t out_sz, uint16_t *out_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LOGGER_H_ */
|
||||
|
||||
Reference in New Issue
Block a user