meh
Fork of mbed by
TARGET_RBLAB_NRF51822/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/nrf-sdk/app_common/app_trace.h@89:552587b429a1, 2014-09-12 (annotated)
- Committer:
- bogdanm
- Date:
- Fri Sep 12 16:41:52 2014 +0100
- Revision:
- 89:552587b429a1
Release 89 of the mbed library
Main changes:
- low power optimizations for Nordic targets
- code structure changes for Freescale K64F targets
- bug fixes in various backends
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 89:552587b429a1 | 1 | #ifndef __DEBUG_H_ |
bogdanm | 89:552587b429a1 | 2 | #define __DEBUG_H_ |
bogdanm | 89:552587b429a1 | 3 | |
bogdanm | 89:552587b429a1 | 4 | #include <stdint.h> |
bogdanm | 89:552587b429a1 | 5 | #include <stdio.h> |
bogdanm | 89:552587b429a1 | 6 | |
bogdanm | 89:552587b429a1 | 7 | /** |
bogdanm | 89:552587b429a1 | 8 | * @defgroup app_trace Debug Logger |
bogdanm | 89:552587b429a1 | 9 | * @ingroup app_common |
bogdanm | 89:552587b429a1 | 10 | * @{ |
bogdanm | 89:552587b429a1 | 11 | * @brief Enables debug logs/ trace over UART. |
bogdanm | 89:552587b429a1 | 12 | * @details Enables debug logs/ trace over UART. Tracing is enabled only if |
bogdanm | 89:552587b429a1 | 13 | * ENABLE_DEBUG_LOG_SUPPORT is defined in the project. |
bogdanm | 89:552587b429a1 | 14 | */ |
bogdanm | 89:552587b429a1 | 15 | #ifdef ENABLE_DEBUG_LOG_SUPPORT |
bogdanm | 89:552587b429a1 | 16 | /** |
bogdanm | 89:552587b429a1 | 17 | * @brief Module Initialization. |
bogdanm | 89:552587b429a1 | 18 | * |
bogdanm | 89:552587b429a1 | 19 | * @details Initializes the module to use UART as trace output. |
bogdanm | 89:552587b429a1 | 20 | * |
bogdanm | 89:552587b429a1 | 21 | * @warning This function will configure UART using default board configuration (described in @ref nrf51_setups). |
bogdanm | 89:552587b429a1 | 22 | * Do not call this function if UART is configured from a higher level in the application. |
bogdanm | 89:552587b429a1 | 23 | */ |
bogdanm | 89:552587b429a1 | 24 | void app_trace_init(void); |
bogdanm | 89:552587b429a1 | 25 | |
bogdanm | 89:552587b429a1 | 26 | /** |
bogdanm | 89:552587b429a1 | 27 | * @brief Log debug messages. |
bogdanm | 89:552587b429a1 | 28 | * |
bogdanm | 89:552587b429a1 | 29 | * @details This API logs messages over UART. The module must be initialized before using this API. |
bogdanm | 89:552587b429a1 | 30 | * |
bogdanm | 89:552587b429a1 | 31 | * @note Though this is currently a macro, it should be used used and treated as function. |
bogdanm | 89:552587b429a1 | 32 | */ |
bogdanm | 89:552587b429a1 | 33 | #define app_trace_log printf |
bogdanm | 89:552587b429a1 | 34 | |
bogdanm | 89:552587b429a1 | 35 | /** |
bogdanm | 89:552587b429a1 | 36 | * @brief Dump auxiliary byte buffer to the debug trace. |
bogdanm | 89:552587b429a1 | 37 | * |
bogdanm | 89:552587b429a1 | 38 | * @details This API logs messages over UART. The module must be initialized before using this API. |
bogdanm | 89:552587b429a1 | 39 | * |
bogdanm | 89:552587b429a1 | 40 | * @param[in] p_buffer Buffer to be dumped on the debug trace. |
bogdanm | 89:552587b429a1 | 41 | * @param[in] len Size of the buffer. |
bogdanm | 89:552587b429a1 | 42 | */ |
bogdanm | 89:552587b429a1 | 43 | void app_trace_dump(uint8_t * p_buffer, uint32_t len); |
bogdanm | 89:552587b429a1 | 44 | |
bogdanm | 89:552587b429a1 | 45 | #else // ENABLE_DEBUG_LOG_SUPPORT |
bogdanm | 89:552587b429a1 | 46 | |
bogdanm | 89:552587b429a1 | 47 | #define app_trace_init(...) |
bogdanm | 89:552587b429a1 | 48 | #define app_trace_log(...) |
bogdanm | 89:552587b429a1 | 49 | #define app_trace_dump(...) |
bogdanm | 89:552587b429a1 | 50 | |
bogdanm | 89:552587b429a1 | 51 | #endif // ENABLE_DEBUG_LOG_SUPPORT |
bogdanm | 89:552587b429a1 | 52 | |
bogdanm | 89:552587b429a1 | 53 | /** @} */ |
bogdanm | 89:552587b429a1 | 54 | |
bogdanm | 89:552587b429a1 | 55 | #endif //__DEBUG_H_ |