Loading...
Searching...
No Matches
Go to the documentation of this file.
86 #define ANSI_RESET "\033[0m"
87 #define ANSI_RED "\033[31m"
88 #define ANSI_GREEN "\033[32m"
89 #define ANSI_YELLOW "\033[33m"
90 #define ANSI_BLUE "\033[34m"
91 #define ANSI_MAGENTA "\033[35m"
92 #define ANSI_CYAN "\033[36m"
93 #define ANSI_BOLD "\033[1m"
94 #define ANSI_UNDER "\033[4m"
102 #define DBG_MOD_SYS (1 << 0)
103 #define DBG_MOD_IRQ (1 << 1)
104 #define DBG_MOD_FAULT (1 << 2)
105 #define DBG_MOD_UART (1 << 3)
106 #define DBG_MOD_I2C (1 << 4)
107 #define DBG_MOD_SPI (1 << 5)
108 #define DBG_MOD_SPI_FLASH (1 << 6)
109 #define DBG_MOD_RTC (1 << 7)
110 #define DBG_MOD_CAM (1 << 8)
111 #define DBG_MOD_SENSOR (1 << 9)
114 #define DBG_MOD_ALL (DBG_MOD_SYS | DBG_MOD_IRQ | DBG_MOD_FAULT | \
115 DBG_MOD_UART | DBG_MOD_I2C | DBG_MOD_SPI | \
116 DBG_MOD_SPI_FLASH | DBG_MOD_RTC | DBG_MOD_SENSOR)
124 #define DBG_LVL_ALL 0
125 #define DBG_LVL_WARN 1
126 #define DBG_LVL_ERR 2
127 #define DBG_LVL_NONE 3
154 #if (DEBUG_MODE == 1) || defined(__DOXYGEN__)
159 #if !defined(ACTIVE_DEBUG_MOD) || !defined(ACTIVE_MIN_LVL)
161 #define ACTIVE_DEBUG_MOD 0
162 #define ACTIVE_MIN_LVL DBG_LVL_NONE
166 #warning "Missing ACTIVE_DEBUG or ACTIVE_MIN_LVL in userDef.h! Disabling Debug."
178 #define BSP_ASSERT(cond, msg) \
181 const char *p = (msg); \
198 #define SHOULD_LOG(debug, lvl) \
199 ( ((ACTIVE_DEBUG_MOD) & (debug)) && ((lvl) >= (ACTIVE_MIN_LVL)) )
207 #define LOG_INFO(debug, fmt, ...) \
209 if (SHOULD_LOG(debug, DBG_LVL_ALL)) { \
210 printf(ANSI_GREEN "INFO: " fmt ANSI_RESET "\n", ##__VA_ARGS__); \
217 #define LOG_WARN(debug, fmt, ...) \
219 if (SHOULD_LOG(debug, DBG_LVL_WARN)) { \
220 printf(ANSI_YELLOW "WRN: " fmt ANSI_RESET "\n", ##__VA_ARGS__); \
227 #define LOG_ERR(debug, fmt, ...) \
229 if (SHOULD_LOG(debug, DBG_LVL_ERR)) { \
230 printf(ANSI_RED "ERR: " fmt ANSI_RESET "\n", ##__VA_ARGS__); \
236 #define BSP_ASSERT(cond, msg) ((void)0)
237 #define LOG_INFO(debug, fmt, ...) ((void)0)
238 #define LOG_WARN(debug, fmt, ...) ((void)0)
239 #define LOG_ERR(debug, fmt, ...) ((void)0)