The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

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