mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-15 08:23:41 +00:00
machine/atsamd21: correct issue with invalid first reading coming from ADC
Signed-off-by: Ron Evans <ron@hybridgroup.com>
This commit is contained in:
@@ -192,6 +192,11 @@ func (a ADC) Get() uint16 {
|
|||||||
sam.ADC.SWTRIG.SetBits(sam.ADC_SWTRIG_START)
|
sam.ADC.SWTRIG.SetBits(sam.ADC_SWTRIG_START)
|
||||||
waitADCSync()
|
waitADCSync()
|
||||||
|
|
||||||
|
// wait for first conversion to finish to fix same issue as
|
||||||
|
// https://github.com/arduino/ArduinoCore-samd/issues/446
|
||||||
|
for !sam.ADC.INTFLAG.HasBits(sam.ADC_INTFLAG_RESRDY) {
|
||||||
|
}
|
||||||
|
|
||||||
// Clear the Data Ready flag
|
// Clear the Data Ready flag
|
||||||
sam.ADC.INTFLAG.SetBits(sam.ADC_INTFLAG_RESRDY)
|
sam.ADC.INTFLAG.SetBits(sam.ADC_INTFLAG_RESRDY)
|
||||||
waitADCSync()
|
waitADCSync()
|
||||||
|
|||||||
Reference in New Issue
Block a user