Nordic stack and drivers for the mbed BLE API

Dependents:   idd_hw5_bleFanProto

Fork of nRF51822 by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers app_trace.h Source File

app_trace.h

00001 #ifndef __DEBUG_H_
00002 #define __DEBUG_H_
00003 
00004 #include <stdint.h>
00005 #include <stdio.h>
00006 
00007 /**
00008  * @defgroup app_trace Debug Logger
00009  * @ingroup app_common
00010  * @{
00011  * @brief Enables debug logs/ trace over UART.
00012  * @details Enables debug logs/ trace over UART. Tracing is enabled only if 
00013  *          ENABLE_DEBUG_LOG_SUPPORT is defined in the project.
00014  */
00015 #ifdef ENABLE_DEBUG_LOG_SUPPORT
00016 /**
00017  * @brief Module Initialization.
00018  *
00019  * @details Initializes the module to use UART as trace output.
00020  * 
00021  * @warning This function will configure UART using default board configuration (described in @ref nrf51_setups). 
00022  *          Do not call this function if UART is configured from a higher level in the application. 
00023  */
00024 void app_trace_init(void);
00025 
00026 /**
00027  * @brief Log debug messages.
00028  *
00029  * @details This API logs messages over UART. The module must be initialized before using this API.
00030  *
00031  * @note Though this is currently a macro, it should be used used and treated as function.
00032  */
00033 #define app_trace_log printf
00034 
00035 /**
00036  * @brief Dump auxiliary byte buffer to the debug trace.
00037  *
00038  * @details This API logs messages over UART. The module must be initialized before using this API.
00039  * 
00040  * @param[in] p_buffer  Buffer to be dumped on the debug trace.
00041  * @param[in] len       Size of the buffer.
00042  */
00043 void app_trace_dump(uint8_t * p_buffer, uint32_t len);
00044 
00045 #else // ENABLE_DEBUG_LOG_SUPPORT
00046 
00047 #define app_trace_init(...)
00048 #define app_trace_log(...)
00049 #define app_trace_dump(...)
00050 
00051 #endif // ENABLE_DEBUG_LOG_SUPPORT
00052 
00053 /** @} */
00054 
00055 #endif //__DEBUG_H_