Adicionar primeiro
This commit is contained in:
58
components/logger/include/logger.h
Executable file
58
components/logger/include/logger.h
Executable file
@@ -0,0 +1,58 @@
|
||||
#ifndef LOGGER_H_
|
||||
#define LOGGER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/event_groups.h"
|
||||
|
||||
#define LOGGER_SERIAL_BIT BIT0
|
||||
|
||||
/**
|
||||
* @brief Logger event group LOGGER_SERIAL_BIT
|
||||
*
|
||||
*/
|
||||
extern EventGroupHandle_t logger_event_group;
|
||||
|
||||
/**
|
||||
* @brief Initialize logger
|
||||
*
|
||||
*/
|
||||
void logger_init(void);
|
||||
|
||||
/**
|
||||
* @brief Print
|
||||
*
|
||||
* @param str
|
||||
*/
|
||||
void logger_print(const char* str);
|
||||
|
||||
/**
|
||||
* @brief Print va
|
||||
*
|
||||
* @param str
|
||||
* @param l
|
||||
* @return int
|
||||
*/
|
||||
int logger_vprintf(const char* str, va_list l);
|
||||
|
||||
/**
|
||||
* @brief Get entries count
|
||||
*
|
||||
* @return uint16_t
|
||||
*/
|
||||
uint16_t logger_count(void);
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
||||
|
||||
#endif /* LOGGER_H_ */
|
||||
24
components/logger/include/output_buffer.h
Executable file
24
components/logger/include/output_buffer.h
Executable file
@@ -0,0 +1,24 @@
|
||||
#ifndef OUTPUT_BUFFER_H_
|
||||
#define OUTPUT_BUFFER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct {
|
||||
uint16_t size;
|
||||
uint16_t count;
|
||||
uint8_t* data;
|
||||
uint8_t* append;
|
||||
} output_buffer_t;
|
||||
|
||||
output_buffer_t* output_buffer_create(uint16_t size);
|
||||
|
||||
void output_buffer_delete(output_buffer_t* buffer);
|
||||
|
||||
void output_buffer_append_buf(output_buffer_t* buffer, const char* buf, uint16_t len);
|
||||
|
||||
void output_buffer_append_str(output_buffer_t* buffer, const char* str);
|
||||
|
||||
bool output_buffer_read(output_buffer_t* buffer, uint16_t *index, char **str, uint16_t* len);
|
||||
|
||||
#endif /* OUTPUT_BUFFER_H_ */
|
||||
Reference in New Issue
Block a user