Library to output logging information over SEGGER's Real Time Transfer (RTT), UART, or raw UART.
More...
Library to output logging information over SEGGER's Real Time Transfer (RTT), UART, or raw UART.
This library provides macros that call the respective functions depending on which protocol is used. Define LOG_USES_RTT=1 to enable logging over RTT, NRF_LOG_USES_UART=1 to enable logging over UART, or NRF_LOG_USES_RAW_UART=1 to enable logging over raw UART. One of these defines must be set for any of the macros to have effect. If you choose to not output information, all logging macros can be left in the code without any cost; they will just be ignored.
void NRF_LOG |
( |
const char * |
msg | ) |
|
Macro for logging null-terminated strings.
This function is more efficient than using printf. The null termination will not be logged.
- Parameters
-
msg | Null-terminated string. |
int NRF_LOG_HAS_INPUT |
( |
void |
| ) |
|
Macro for checking if data is available in the input buffer.
- Note
- When NRF_LOG_USES_UART is set to 1, this macro is non-blocking. If too much data is sent, some characters might be skipped.
- Return values
-
1 | If characters are available to read. |
0 | If no characters are available. |
void NRF_LOG_HEX |
( |
uint32_t |
value | ) |
|
Macro for logging an integer value as HEX.
The output data is formatted as, for example, 0x89ABCDEF. This function is more efficient than printf.
- Note
- When NRF_LOG_USES_UART is set to 1, this macro is non-blocking. If too much data is sent, some characters might be skipped.
- Parameters
-
value | Integer value to be printed as HEX. |
void NRF_LOG_HEX_CHAR |
( |
uint8_t |
c | ) |
|
Macro for logging a single character as HEX.
The output string is formatted as, for example, AA.
- Note
- When NRF_LOG_USES_UART is set to 1, this macro is non-blocking. If too much data is sent, some characters might be skipped.
- Parameters
-
uint32_t NRF_LOG_INIT |
( |
void |
| ) |
|
Macro for initializing the logger.
- Return values
-
NRF_SUCCESS | If initialization was successful. |
NRF_ERROR | Otherwise. |
void NRF_LOG_PRINTF |
( |
const char * |
format_msg, |
|
|
|
... |
|
) |
| |
Macro for logging a printf string.
Printf requires more processor time than other logging functions. Therefore, applications that require logging but need it to interfere as little as possible with the execution, should avoid using printf.
- Note
- When NRF_LOG_USES_UART is set to 1, this macro is non-blocking. If too much data is sent, some characters might be skipped.
- Parameters
-
format_msg | Printf format string. |
... | Additional arguments replacing format specifiers in format_msg. |
uint32_t NRF_LOG_READ_INPUT |
( |
char * |
p_char | ) |
|
Macro for reading one character from the input buffer.
- Parameters
-
[out] | p_char | Pointer where to store the character. |
- Return values
-
NRF_SUCCESS | If the character was read out. |
NRF_ERROR_INVALID_DATA | If no character could be read. |