Test using the base BLE_HeartRate example to see the effect of increasing the "ticker" rate on stability (intending to do AnalogIn around 1ms rate)
Dependencies: BLE_API mbed nRF51822
Diff: main.cpp
- Revision:
- 9:1cfd6c7055b5
- Parent:
- 8:7407b18dfc5d
- Child:
- 10:c9a78ca03515
--- a/main.cpp Wed Oct 01 07:34:46 2014 +0000 +++ b/main.cpp Wed Oct 01 07:40:55 2014 +0000 @@ -62,11 +62,11 @@ { callbackCount = 0; indicatorLed1 = !indicatorLed1; - /* Note that the periodicCallback() executes in interrupt context, so it is safer to do - * heavy-weight sensor polling from the main thread. */ - triggerSensorPolling = true; } + /* Note that the periodicCallback() executes in interrupt context, so it is safer to do + * heavy-weight sensor polling from the main thread. */ + triggerSensorPolling = true; // sampleTimeout.attach_us(periodicCallback, sampleIntervalUs); } @@ -109,9 +109,10 @@ { triggerSensorPolling = false; bleUpdateCount++; - if (bleUpdateCount >= 1) + if (bleUpdateCount >= 500) { bleUpdateCount = 0; + indicatorLed2 = !indicatorLed2; updateNow = true; } } @@ -125,7 +126,6 @@ hrmCounter = 100; } - indicatorLed2 = !indicatorLed2; hrService.updateHeartRate(hrmCounter); } else