I have the next code, basically what it does is reading a button state and if it is pressed then the manufacturer data of the BLE package is lets say B, on the contrary when the button is not pressed the data is A.
while (true) {
printf("\r\n");
if ((int)nrf_gpio_pin_read(PIN_IN)) {
//Setting up the advertising data with scan response data = Null
err_code = sd_ble_gap_adv_data_set(Conectado, Conectado_length,
0, 0);
APP_ERROR_CHECK(err_code);
} else {
//Setting up the advertising data with scan response data = Null
err_code = sd_ble_gap_adv_data_set(Prueba,
Conectado_length, 0, 0);
APP_ERROR_CHECK(err_code);
}
power_manage();
}
The riddle comes if I comment the printf line, that as you can see doesn't do anything with the variable, then the manufacturer data is never changed even if the button is pressed for a long time. I've tried changing the printf for a delay, does not work, reading the state before and after this line doesn't matter, as long as I'm doing the instruction.
And for power consumption reasons I can't have the uart module working.
Thanks in advance for your help