Macros

#define BASENAME(_file)   ((strrchr(_file, '/') ? : (strrchr(_file, '\\') ? : _file))+1)
 
#define csp_assert(exp)
 
#define CONSTSTR(data)   data
 
#define csp_debug(...)   do {} while (0)
 
#define csp_log_error(...)   do {} while (0)
 
#define csp_log_warn(...)   do {} while (0)
 
#define csp_log_info(...)   do {} while (0)
 
#define csp_log_buffer(...)   do {} while (0)
 
#define csp_log_packet(...)   do {} while (0)
 
#define csp_log_protocol(...)   do {} while (0)
 
#define csp_log_lock(...)   do {} while (0)
 

Enumerations

enum  csp_debug_level_t {
  CSP_ERROR = 0, CSP_WARN = 1, CSP_INFO = 2, CSP_BUFFER = 3,
  CSP_PACKET = 4, CSP_PROTOCOL = 5, CSP_LOCK = 6
}
 Debug levels. More...
 

Functions

void csp_assert_fail_action (char *assertion, const char *file, int line)
 
void do_csp_debug (csp_debug_level_t level, const char *format,...)
 This function should not be used directly, use csp_log_<level>() macro instead. More...
 
void csp_debug_toggle_level (csp_debug_level_t level)
 Toggle debug level on/off. More...
 
void csp_debug_set_level (csp_debug_level_t level, bool value)
 Set debug level. More...
 
int csp_debug_get_level (csp_debug_level_t level)
 Get current debug level value. More...
 

Variables

unsigned char csp_debug_level_enabled []
 

Macro Definition Documentation

#define BASENAME (   _file)    ((strrchr(_file, '/') ? : (strrchr(_file, '\\') ? : _file))+1)
#define CONSTSTR (   data)    data
#define csp_assert (   exp)
Value:
do { \
if (!(exp)) { \
char *assertion = #exp; \
const char *file = BASENAME(__FILE__); \
int line = __LINE__; \
printf("\E[1;31m[%02"PRIu8"] Assertion \'%s\' failed in %s:%d\E[0m\r\n", \
csp_get_address(), assertion, file, line); \
csp_assert_fail_action(assertion, file, line); \
} \
} while (0)
#define BASENAME(_file)
Definition: csp_debug.h:51
uint8_t csp_get_address(void)
csp_get_address Get the systems own address
void csp_assert_fail_action(char *assertion, const char *file, int line)
#define csp_debug (   ...)    do {} while (0)
#define csp_log_buffer (   ...)    do {} while (0)
#define csp_log_error (   ...)    do {} while (0)
#define csp_log_info (   ...)    do {} while (0)
#define csp_log_lock (   ...)    do {} while (0)
#define csp_log_packet (   ...)    do {} while (0)
#define csp_log_protocol (   ...)    do {} while (0)
#define csp_log_warn (   ...)    do {} while (0)

Enumeration Type Documentation

Debug levels.

Enumerator
CSP_ERROR 
CSP_WARN 
CSP_INFO 
CSP_BUFFER 
CSP_PACKET 
CSP_PROTOCOL 
CSP_LOCK 

Function Documentation

void csp_assert_fail_action ( char *  assertion,
const char *  file,
int  line 
)
int csp_debug_get_level ( csp_debug_level_t  level)

Get current debug level value.

Parameters
levelLevel value to get
Returns
Level value
void csp_debug_set_level ( csp_debug_level_t  level,
bool  value 
)

Set debug level.

Parameters
levelLevel to set
valueNew level value
void csp_debug_toggle_level ( csp_debug_level_t  level)

Toggle debug level on/off.

Parameters
levelLevel to toggle
void do_csp_debug ( csp_debug_level_t  level,
const char *  format,
  ... 
)

This function should not be used directly, use csp_log_<level>() macro instead.

Parameters
level
format

Variable Documentation

unsigned char csp_debug_level_enabled[]