SAADC library and drivers for nrf52832.
Dependents: acd52832_SAADC_Differential_input_EPD acd52832_Car_battery_ch acd52832_Car_battery_ch_2
Library to use aconno drivers for Nordic Semiconductor nrf52832 SAADC.
Revision 10:b763d9cfc063, committed 2017-10-04
- Comitter:
- jurica238814
- Date:
- Wed Oct 04 08:01:51 2017 +0000
- Parent:
- 9:a1eacc3f0cbb
- Commit message:
- Resolution and input range hardcoded.
Changed in this revision
| acd_nrf52_saadc.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/acd_nrf52_saadc.cpp Fri Sep 29 11:12:03 2017 +0000
+++ b/acd_nrf52_saadc.cpp Wed Oct 04 08:01:51 2017 +0000
@@ -16,11 +16,12 @@
// Do this for the first object only
NRF_SAADC->ENABLE = 1;
NRF_SAADC->RESULT.PTR =(uint32_t)data; // Pass pointer to results buffer
+ NRF_SAADC->RESOLUTION = 3;
calibrate();
}
if(channelCounter < 8){
NRF_SAADC->CH[channel].PSELP = analogIn + 1;
- NRF_SAADC->CH[channel].CONFIG = 0x00021500; // reset
+ NRF_SAADC->CH[channel].CONFIG = 0x00021000; // reset
channelCounter++;
NRF_SAADC->RESULT.MAXCNT = channelCounter;
}
@@ -31,12 +32,13 @@
// Do this for the first object only
NRF_SAADC->ENABLE = 1;
NRF_SAADC->RESULT.PTR =(uint32_t)data; // Pass pointer to results buffer
+ NRF_SAADC->RESOLUTION = 3;
calibrate();
}
if(channelCounter < 8){
NRF_SAADC->CH[channel].PSELP = pPin + 1;
NRF_SAADC->CH[channel].PSELN = nPin + 1;
- NRF_SAADC->CH[channel].CONFIG = 0x00121500; // differential input, Gain 1
+ NRF_SAADC->CH[channel].CONFIG = 0x00121200; // differential input, Gain 1
channelCounter++;
NRF_SAADC->RESULT.MAXCNT = channelCounter;
}