File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed
bootloaders/metroM4/.vs/samdx1_sam_ba/v14
libraries/SAMD_AnalogCorrection/src Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 1
1
* .bz2
2
+ * .atsuo
2
3
3
4
bootloaders /* /build /
4
5
* ~
Original file line number Diff line number Diff line change 20
20
21
21
void analogReadCorrection (int offset, uint16_t gain)
22
22
{
23
+ Adc *adc;
24
+ #if defined (__SAMD51__)
25
+ adc = ADC0;
26
+ #else
27
+ adc = ADC;
28
+ #endif
23
29
// Set correction values
24
- ADC ->OFFSETCORR .reg = ADC_OFFSETCORR_OFFSETCORR (offset);
25
- ADC ->GAINCORR .reg = ADC_GAINCORR_GAINCORR (gain);
30
+ adc ->OFFSETCORR .reg = ADC_OFFSETCORR_OFFSETCORR (offset);
31
+ adc ->GAINCORR .reg = ADC_GAINCORR_GAINCORR (gain);
26
32
27
33
// Enable digital correction logic
28
- ADC->CTRLB .bit .CORREN = 1 ;
29
- while (ADC->STATUS .bit .SYNCBUSY );
34
+ adc->CTRLB .bit .CORREN = 1 ;
35
+
36
+ #if defined (__SAMD51__)
37
+ while (adc->SYNCBUSY .bit .OFFSETCORR || adc->SYNCBUSY .bit .GAINCORR );
38
+ #else
39
+ while (adc->STATUS .bit .SYNCBUSY );
40
+ #endif
30
41
}
31
42
You can’t perform that action at this time.
0 commit comments