Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: acd52832_SAADC_Differential_input_2
Fork of acn_nrf52_saadc by
Diff: acd_nrf52_saadc.cpp
- Revision:
- 4:616c6590bbd2
- Parent:
- 3:fcada8b3b567
- Child:
- 6:57e342aaaca7
--- a/acd_nrf52_saadc.cpp Wed Aug 23 08:49:09 2017 +0000
+++ b/acd_nrf52_saadc.cpp Wed Aug 23 09:22:17 2017 +0000
@@ -17,12 +17,15 @@
NRF_SAADC->TASKS_START = 1;
while(!NRF_SAADC->EVENTS_STARTED);
NRF_SAADC->TASKS_SAMPLE = 1;
- while(!NRF_SAADC->EVENTS_RESULTDONE);
- while(!NRF_SAADC->EVENTS_DONE);
- while(!NRF_SAADC->EVENTS_END);
- while(NRF_SAADC->STATUS == 1); // while conversion is is progress
- //NRF_SAADC->TASKS_STOP = 1;
- //while(!NRF_SAADC->EVENTS_STOPPED);
+ for(uint8_t i = 0; i < NRF_SAADC->RESULT.MAXCNT; ++i)
+ {
+ while(!NRF_SAADC->EVENTS_RESULTDONE);
+ while(!NRF_SAADC->EVENTS_DONE);
+ while(!NRF_SAADC->EVENTS_END);
+ while(NRF_SAADC->STATUS == 1); // while conversion is is progress
+ }
+ NRF_SAADC->TASKS_STOP = 1;
+ while(!NRF_SAADC->EVENTS_STOPPED);
}
bool NRF52_SAADC::addChannel(uint8_t pin){
