|
|
#pragma once
#ifdef __cplusplus
extern "C" { #endif
#include <stdbool.h>
#include <stdint.h>
#include "chip.h"
#include "delay.h"
/***********************************************************************************************************************
* =======================================================鏃ュ織======================================================== * ***********************************************************************************************************************/ extern bool g_enable_log; #define ZLOG_RELEASE(TAG, fmt, ...) \
if (g_enable_log) { \ printf(TAG "" fmt "\n", ##__VA_ARGS__); \ } #define ZLOGI(TAG, fmt, ...) \
if (g_enable_log) { \ printf("%08u INFO [%-8s] " fmt "\n", ifly_get_ticket(), TAG, ##__VA_ARGS__); \ } #define ZLOGD(TAG, fmt, ...) \
if (g_enable_log) { \ printf("%08u DEBU [%-8s] " fmt "\n", ifly_get_ticket(), TAG, ##__VA_ARGS__); \ } #define ZLOGE(TAG, fmt, ...) \
if (g_enable_log) { \ printf("%08u ERRO [%-8s] " fmt "\n", ifly_get_ticket(), TAG, ##__VA_ARGS__); \ }
#define ZLOGI_HEX(TAG, hextable, table_size) \
if (g_enable_log) { \ printf("%08u INFO [%-8s] \t", ifly_get_ticket(), TAG); \ for (int i = 0; i < table_size; i++) { \ printf(" %02X", hextable[i]); \ } \ printf("\n"); \ }
#define ZASSERT(cond) \
if (!(cond)) { \ while (1) { \ printf("ASSERT: %s [%s:%d]\n", #cond, __FILE__, __LINE__); \ ifly_delay_ms(1000); \ } \ }
void ifly_loggger_init(UART_HandleTypeDef *huart); void ifly_loggger_enable(bool enable);
#ifdef __cplusplus
} #endif
|