Skip to content

Commit

Permalink
Bugfix - waiting for first ADC read to complete after ADC enable.
Browse files Browse the repository at this point in the history
  • Loading branch information
zuyan9 authored Sep 15, 2021
1 parent bafcb36 commit 6ddfddf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cores/arduino/wiring_analog.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ uint32_t analogRead(uint32_t pin)
syncADC();
ADC->SWTRIG.bit.START = 1;

// Waiting for the 1st conversion to complete
while (ADC->INTFLAG.bit.RESRDY == 0);

// Clear the Data Ready flag
ADC->INTFLAG.reg = ADC_INTFLAG_RESRDY;

Expand Down

0 comments on commit 6ddfddf

Please sign in to comment.