mediCAL's first BLE project

Dependents:   BLE_mediCAL

Fork of nRF51822 by Nordic Semiconductor

Committer:
antoniorohit
Date:
Sun Nov 02 20:43:14 2014 +0000
Revision:
69:d9f51b65a3c8
Parent:
37:c29c330d942c
First rev of BLE program for nRF51822 which provides BLE connectivity for team mediCAL's PILLar;

Who changed what in which revision?

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