Loading...
Searching...
No Matches
Go to the documentation of this file.
110 #define ANSI_RESET "\033[0m"
111 #define ANSI_RED "\033[31m"
112 #define ANSI_GREEN "\033[32m"
113 #define ANSI_YELLOW "\033[33m"
114 #define ANSI_BLUE "\033[34m"
115 #define ANSI_MAGENTA "\033[35m"
116 #define ANSI_CYAN "\033[36m"
117 #define ANSI_BOLD "\033[1m"
118 #define ANSI_UNDER "\033[4m"
137 #define DBG_MOD_SYS (1 << 0)
138 #define DBG_MOD_IRQ (1 << 1)
139 #define DBG_MOD_FAULT (1 << 2)
140 #define DBG_MOD_UART (1 << 3)
141 #define DBG_MOD_I2C (1 << 4)
142 #define DBG_MOD_SPI (1 << 5)
143 #define DBG_MOD_SPI_FLASH (1 << 6)
144 #define DBG_MOD_RTC (1 << 7)
145 #define DBG_MOD_CAM (1 << 8)
146 #define DBG_MOD_SENSOR (1 << 9)
147 #define DBG_MOD_MAIN (1 << 10)
150 #define DBG_MOD_ALL \
151 ( DBG_MOD_SYS | DBG_MOD_IRQ | DBG_MOD_FAULT | DBG_MOD_UART | \
152 DBG_MOD_I2C | DBG_MOD_SPI | DBG_MOD_SPI_FLASH | DBG_MOD_RTC | \
153 DBG_MOD_CAM | DBG_MOD_SENSOR | DBG_MOD_MAIN )
172 #define DBG_LVL_ALL 0
173 #define DBG_LVL_WARN 1
174 #define DBG_LVL_ERR 2
175 #define DBG_LVL_NONE 3
184#if (DEBUG_MODE == 1) || defined(__DOXYGEN__)
187 #if !defined(ACTIVE_DEBUG_MOD) || !defined(ACTIVE_MIN_LVL)
191 #define ACTIVE_DEBUG_MOD 0
195 #define ACTIVE_MIN_LVL DBG_LVL_NONE
197 #warning "Missing ACTIVE_DEBUG_MOD or ACTIVE_MIN_LVL in userDef.h — debug disabled."
209 #define SHOULD_LOG(mod, lvl) \
210 ( ((ACTIVE_DEBUG_MOD) & (mod)) && ((lvl) >= (ACTIVE_MIN_LVL)) )
218 #define BSP_ASSERT(cond, msg) \
221 const char *_p = (msg); \
222 while (*_p) bsp_putChar(*_p++); \
233 #define LOG_INFO(mod, fmt, ...) \
235 if (SHOULD_LOG(mod, DBG_LVL_ALL)) \
236 printf(ANSI_GREEN "INFO: " fmt ANSI_RESET "\n", ##__VA_ARGS__); \
245 #define LOG_WARN(mod, fmt, ...) \
247 if (SHOULD_LOG(mod, DBG_LVL_WARN)) \
248 printf(ANSI_YELLOW "WRN: " fmt ANSI_RESET "\n", ##__VA_ARGS__); \
257 #define LOG_ERR(mod, fmt, ...) \
259 if (SHOULD_LOG(mod, DBG_LVL_ERR)) \
260 printf(ANSI_RED "ERR: " fmt ANSI_RESET "\n", ##__VA_ARGS__); \
268 #define BSP_ASSERT(cond, msg) ((void)0)
269 #define LOG_INFO(mod, fmt, ...) ((void)0)
270 #define LOG_WARN(mod, fmt, ...) ((void)0)
271 #define LOG_ERR(mod, fmt, ...) ((void)0)
#define bsp_putChar(c)
Map standard character output to the physical UART.