テスト用です。

Dependencies:   mbed

Committer:
jksoft
Date:
Tue Oct 11 11:09:42 2016 +0000
Revision:
0:8468a4403fea
SB??ver;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:8468a4403fea 1 #ifndef __DEBUG_H_
jksoft 0:8468a4403fea 2 #define __DEBUG_H_
jksoft 0:8468a4403fea 3
jksoft 0:8468a4403fea 4 #include <stdint.h>
jksoft 0:8468a4403fea 5 #include <stdio.h>
jksoft 0:8468a4403fea 6
jksoft 0:8468a4403fea 7 /**
jksoft 0:8468a4403fea 8 * @defgroup app_trace Debug Logger
jksoft 0:8468a4403fea 9 * @ingroup app_common
jksoft 0:8468a4403fea 10 * @{
jksoft 0:8468a4403fea 11 * @brief Enables debug logs/ trace over UART.
jksoft 0:8468a4403fea 12 * @details Enables debug logs/ trace over UART. Tracing is enabled only if
jksoft 0:8468a4403fea 13 * ENABLE_DEBUG_LOG_SUPPORT is defined in the project.
jksoft 0:8468a4403fea 14 */
jksoft 0:8468a4403fea 15 #ifdef ENABLE_DEBUG_LOG_SUPPORT
jksoft 0:8468a4403fea 16 /**
jksoft 0:8468a4403fea 17 * @brief Module Initialization.
jksoft 0:8468a4403fea 18 *
jksoft 0:8468a4403fea 19 * @details Initializes the module to use UART as trace output.
jksoft 0:8468a4403fea 20 *
jksoft 0:8468a4403fea 21 * @warning This function will configure UART using default board configuration (described in @ref nrf51_setups).
jksoft 0:8468a4403fea 22 * Do not call this function if UART is configured from a higher level in the application.
jksoft 0:8468a4403fea 23 */
jksoft 0:8468a4403fea 24 void app_trace_init(void);
jksoft 0:8468a4403fea 25
jksoft 0:8468a4403fea 26 /**
jksoft 0:8468a4403fea 27 * @brief Log debug messages.
jksoft 0:8468a4403fea 28 *
jksoft 0:8468a4403fea 29 * @details This API logs messages over UART. The module must be initialized before using this API.
jksoft 0:8468a4403fea 30 *
jksoft 0:8468a4403fea 31 * @note Though this is currently a macro, it should be used used and treated as function.
jksoft 0:8468a4403fea 32 */
jksoft 0:8468a4403fea 33 #define app_trace_log printf
jksoft 0:8468a4403fea 34
jksoft 0:8468a4403fea 35 /**
jksoft 0:8468a4403fea 36 * @brief Dump auxiliary byte buffer to the debug trace.
jksoft 0:8468a4403fea 37 *
jksoft 0:8468a4403fea 38 * @details This API logs messages over UART. The module must be initialized before using this API.
jksoft 0:8468a4403fea 39 *
jksoft 0:8468a4403fea 40 * @param[in] p_buffer Buffer to be dumped on the debug trace.
jksoft 0:8468a4403fea 41 * @param[in] len Size of the buffer.
jksoft 0:8468a4403fea 42 */
jksoft 0:8468a4403fea 43 void app_trace_dump(uint8_t * p_buffer, uint32_t len);
jksoft 0:8468a4403fea 44
jksoft 0:8468a4403fea 45 #else // ENABLE_DEBUG_LOG_SUPPORT
jksoft 0:8468a4403fea 46
jksoft 0:8468a4403fea 47 #define app_trace_init(...)
jksoft 0:8468a4403fea 48 #define app_trace_log(...)
jksoft 0:8468a4403fea 49 #define app_trace_dump(...)
jksoft 0:8468a4403fea 50
jksoft 0:8468a4403fea 51 #endif // ENABLE_DEBUG_LOG_SUPPORT
jksoft 0:8468a4403fea 52
jksoft 0:8468a4403fea 53 /** @} */
jksoft 0:8468a4403fea 54
jksoft 0:8468a4403fea 55 #endif //__DEBUG_H_