#include <stdbool.h> //Permite usar funciones booleanas de C++
#include <stdint.h> //Permite usar funciones generales de C++
* @brief Function for application main entry.
/** @} */
Hello to everyone.
I have a doubt about the function of NRF_LOG library in nRF52 DK.I´m trying to display the voltaje value from pin P0.26 on Termite, so I saw in this page that NRF_LOG_ENABLED and NRF_LOG_BACKEND_UART_ENABLED must be in 1 on sdk_config.h, so that´s ready.Then I try to use NRF_LOG_INFO() to display the value but I found that NRF_LOG_INFO() it´s only for char parameters.My question is, does NRF_LOG library has a function to be used with integer value or there´s a way to convert int values into char? (line 20).This project is the "ble_app_blinky_pca10040_s132", so contains its sdk_config.h file, but I replaced the .c file with one mine.I hope you can help me.
I´m sorry, the first 4 lines are wrong. Please don´t pay attention to them.
Correction about the mistake: isn't line 20, I'm talking about line 24.
If you want to get the state of the pin, you need to read the pin and store its value to a variable. You can then pass the variable to NRF_LOG:
uint32_t pin_state = nrf_gpio_pin_read(26);
NRF_LOG_INFO("Pin state: %d", pin_state);
NRF_LOG use printf format to format the strings.
Hello Jorgen, thank you for answer.I can compile the program now, but I can´t see anything in Termite. I´m using a sdk_config.h file from an example that doesn´t need SoftDevice (blinky / PCA100040 / blank).The original config file didn´t has the NRF_LOG_ENABLED and NRF_LOG_BACKEND_UART_ENABLED lines, so I added them copying from another sdk_config.h file (ble_app_blinky / PCA100040 / s132), but only those two functions.I need to copy all the NRF_LOG functions? like BAUDRATE and TEMP_BUFFER_SIZE?My question is because I´m not sure I´m using the correct Baudrate to link with Termite.
I see that you have not initialized the log module in your application. You need to add this header file to the top of main.c:
and these lines in start of main-loop:
uint32_t err_code = NRF_LOG_INIT(NULL);