Skip to content

Commit f39d042

Browse files
bors[bot]Dirbaio
andauthored
Merge #298
298: saadc: Clear events_calibratedone before calibration r=Yatekii a=Dirbaio Without this, if you initialize SAADC for a second time, the events_calibratedone is still set from before, so the while loop doesn't wait for calibration to be done. This causes garbage readings if you read immediately after, because calibration is still running. Co-authored-by: Dario Nieuwenhuis <[email protected]>
2 parents b4eae29 + c59d05f commit f39d042

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

nrf-hal-common/src/saadc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ impl Saadc {
8787
saadc.ch[0].pseln.write(|w| w.pseln().nc());
8888

8989
// Calibrate
90+
saadc.events_calibratedone.reset();
9091
saadc.tasks_calibrateoffset.write(|w| unsafe { w.bits(1) });
9192
while saadc.events_calibratedone.read().bits() == 0 {}
9293

0 commit comments

Comments
 (0)