I understand that the BLE-stack takes the highest processing priority on the nRF52 (nRF52840 in my case). So data read on one of the GPIO pins of the nRF52 may be "lost" if the BLE-stack directs away/overrides the running data-read program loop. I have a data-read loop that needs to be uninterrupted for at least 2ms (milli-seconds) to generate a value which will be sent over the BLE-stack. The data on the GPIO comes only once in every few seconds.
1. Is there a way to make the data-read process "atomic", as in the AVRs, where an outside event CAN'T influence it for a given period of time (i.e. 2 ms)?
2. Or is there a way to "store" the read vale until the BLE-stack handes back the processing priority to my data-read process and I can send that data via BLE?
3. Or, if I set the nRF52 in "central' mode" instead of 'client", would I be able to control when the BLE-stack would run? Instead of it responding to an outside request at any given time, thus breaking away from my data-read subroutine and potentially compromising the data.
Note: the BLE's only task in my code is to send that one data that is being read on the GPIO pin.