I have been working with the pc-ble-driver on the PC. Now I want to move my code to the nRF51822 and nRF52840 chips. Starting with the DKs first.
On the PC when I get an ble_evt_t in the dispatch callback (usually called ble_evt_dispatch() in the SDK examples) I triggered a posix semaphone on certain events, for example the write of some command on a control point. I also used a similar semaphore when sending measurements. On an indication/notification event I would trigger the semaphore and in the measurement send method I would be waiting on that semaphore to send the next measurement.
For example on the Indication event
case BLE_GATTS_EVT_HVC: printf("Confirmation of indication on handle %d received at time %llu\n", p_ble_evt->evt.gatts_evt.params.hvc.handle, (GetTickCount64() - elapsedTimeStart)); fflush(stdout); sem_post(&indicateSem); break;
In the measurement sending method I would have a matching
sem_wait(&indicateSem);
These are the standard posix calls.
I want to do the same on the chips. Is there an equivalent to this 'semaphore' one can wait on and post?
Maybe these are not necessary? Usually timely returns on callbacks are 'mandatory'. However, having semaphores FORCES synchrony between the peripheral and central which is one of the main points here.
At the moment I am using SDK 12.3.0 and SoftDevice s130 (the latest SDK/SoftDevice for the nRF51822).
Its probably somewhere in the SDK documentation but the search function is so bad one will only hit the search if one is on the right page. The search routines do not work globally over the entire documentation which makes searching for items that you have no idea where they might be is next to impossible. It wont even find the word 'wait' when it is right in the text on the same page. I am not sure what the search is for. IN any case, I have had to turn to searching here to get results. Posix-like Semaphores seem to be a rare topic.
I do see this sd_app_evt_wait() in the example code on the power management.
Is there a call I can make that will cause this method to FHIR or is this something only SoftDevice can do?
Thanks