59 lines
1.4 KiB
C
59 lines
1.4 KiB
C
/** @file debug.h
|
|
* Module handling various debug functions
|
|
*
|
|
* The module provides a range of functions and tools to make debug more
|
|
* convenient
|
|
*/
|
|
|
|
#ifndef _DEBUG_H_
|
|
#define _DEBUG_H_
|
|
|
|
//--includes--------------------------------------------------------------------
|
|
|
|
#include "../drv/usart.h"
|
|
#include "../drv/gpio.h"
|
|
|
|
#define DEBUG_TRACE 1
|
|
#define DEBUG_WARN 0
|
|
#define DEBUG_ERROR 0
|
|
|
|
|
|
//--type definitions------------------------------------------------------------
|
|
|
|
#if DEBUG_TRACE || DEBUG_WARN || DEBUG_ERROR
|
|
#define debug_init(usart, tx_port, tx_pin) _debug_init(usart, tx_port, tx_pin)
|
|
#else
|
|
#define debug_init(usart) do {} while (0)
|
|
#endif
|
|
|
|
#if DEBUG_TRACE
|
|
#define debug_trace(format, ...) _debug_trace(format __VA_OPT__(,) __VA_ARGS__)
|
|
#else
|
|
#define debug_trace(format, ...) do {} while (0)
|
|
#endif
|
|
|
|
#if DEBUG_WARN
|
|
#define debug_warn(format, ...) _debug_warn(format __VA_OPT__(,) __VA_ARGS__)
|
|
#else
|
|
#define debug_warn(format, ...) do {} while (0)
|
|
#endif
|
|
|
|
#if DEBUG_ERROR
|
|
#define debug_error(format, ...) _debug_error(format __VA_OPT__(,) __VA_ARGS__)
|
|
#else
|
|
#define debug_error(format, ...) do {} while (0)
|
|
#endif
|
|
|
|
|
|
//--functions-------------------------------------------------------------------
|
|
|
|
void _debug_init(enum UsartPeriph usart, enum GpioPort tx_port,
|
|
enum GpioPin tx_pin);
|
|
void _debug_trace(char* format, ...);
|
|
void _debug_warn(char* format, ...);
|
|
void _debug_error(char* format, ...);
|
|
|
|
|
|
#endif //_DEBUG_H_
|
|
|