File tree 1 file changed +5
-0
lines changed
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -437,6 +437,8 @@ void analogReference(eAnalogReference mode)
437
437
syncADC ();
438
438
439
439
// Start conversion, since The first conversion after the reference is changed must not be used.
440
+ uint32_t valueRead __attribute__((unused ));
441
+
440
442
#if (SAMC21 || SAMD51 )
441
443
ADC0 -> CTRLA .bit .ENABLE = 0x01 ; // Enable ADC
442
444
ADC1 -> CTRLA .bit .ENABLE = 0x01 ; // Enable ADC
@@ -445,6 +447,8 @@ void analogReference(eAnalogReference mode)
445
447
ADC1 -> SWTRIG .bit .START = 1 ;
446
448
syncADC ();
447
449
while ((ADC0 -> INTFLAG .bit .RESRDY == 0 ) || (ADC1 -> INTFLAG .bit .RESRDY == 0 )); // Waiting for conversion to complete
450
+ valueRead = ADC0 -> RESULT .reg ; // Dummy read (will also clear the Data Ready flag)
451
+ valueRead = ADC1 -> RESULT .reg ; // Dummy read (will also clear the Data Ready flag)
448
452
ADC0 -> CTRLA .bit .ENABLE = 0x00 ; // Disable ADC
449
453
ADC1 -> CTRLA .bit .ENABLE = 0x00 ; // Disable ADC
450
454
#else
@@ -453,6 +457,7 @@ void analogReference(eAnalogReference mode)
453
457
ADC -> SWTRIG .bit .START = 1 ;
454
458
syncADC ();
455
459
while (ADC -> INTFLAG .bit .RESRDY == 0 ); // Waiting for conversion to complete
460
+ valueRead = ADC -> RESULT .reg ; // Dummy read (will also clear the Data Ready flag)
456
461
ADC -> CTRLA .bit .ENABLE = 0x00 ; // Disable ADC
457
462
#endif
458
463
syncADC ();
You can’t perform that action at this time.
0 commit comments