mirror of
https://github.com/openstenoproject/qmk
synced 2024-11-23 00:44:38 +00:00
arm_atsam ADC0 factory calibration correction
Factory calibration data was not being loaded properly for ADC0, which affects the accuracy of 5V readings.
This commit is contained in:
parent
9e784841c0
commit
60ae309ced
1 changed files with 3 additions and 3 deletions
|
@ -74,9 +74,9 @@ void ADC0_init(void)
|
||||||
while (ADC0->SYNCBUSY.bit.SAMPCTRL) { DBGC(DC_ADC0_SAMPCTRL_SYNCING_1); }
|
while (ADC0->SYNCBUSY.bit.SAMPCTRL) { DBGC(DC_ADC0_SAMPCTRL_SYNCING_1); }
|
||||||
|
|
||||||
//Load factory calibration data
|
//Load factory calibration data
|
||||||
ADC0->CALIB.bit.BIASCOMP = (ADC0_FUSES_BIASCOMP_ADDR >> ADC0_FUSES_BIASCOMP_Pos) & ADC0_FUSES_BIASCOMP_Msk;
|
ADC0->CALIB.bit.BIASCOMP = ((*(uint32_t *)ADC0_FUSES_BIASCOMP_ADDR) & ADC0_FUSES_BIASCOMP_Msk) >> ADC0_FUSES_BIASCOMP_Pos;
|
||||||
ADC0->CALIB.bit.BIASR2R = (ADC0_FUSES_BIASR2R_ADDR >> ADC0_FUSES_BIASR2R_Pos) & ADC0_FUSES_BIASR2R_Msk;
|
ADC0->CALIB.bit.BIASR2R = ((*(uint32_t *)ADC0_FUSES_BIASR2R_ADDR) & ADC0_FUSES_BIASR2R_Msk) >> ADC0_FUSES_BIASR2R_Pos;
|
||||||
ADC0->CALIB.bit.BIASREFBUF = (ADC0_FUSES_BIASREFBUF_ADDR >> ADC0_FUSES_BIASREFBUF_Pos) & ADC0_FUSES_BIASREFBUF_Msk;
|
ADC0->CALIB.bit.BIASREFBUF = ((*(uint32_t *)ADC0_FUSES_BIASREFBUF_ADDR) & ADC0_FUSES_BIASREFBUF_Msk) >> ADC0_FUSES_BIASREFBUF_Pos;
|
||||||
|
|
||||||
//Enable
|
//Enable
|
||||||
ADC0->CTRLA.bit.ENABLE = 1;
|
ADC0->CTRLA.bit.ENABLE = 1;
|
||||||
|
|
Loading…
Reference in a new issue