summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatrickmt <40182064+patrickmt@users.noreply.github.com>2019-01-28 19:07:22 +0100
committerDrashna Jaelre <drashna@live.com>2019-01-29 02:16:33 +0100
commit60ae309ced682edd659a4e1479c176625136db53 (patch)
treef647c2a3f3beca0d2feaf2f55012da6f238e1206
parent9e784841c026d3f05df9a5e58668b4244885386f (diff)
downloadqmk_firmware-60ae309ced682edd659a4e1479c176625136db53.tar.gz
qmk_firmware-60ae309ced682edd659a4e1479c176625136db53.tar.xz
arm_atsam ADC0 factory calibration correction
Factory calibration data was not being loaded properly for ADC0, which affects the accuracy of 5V readings.
-rw-r--r--tmk_core/protocol/arm_atsam/adc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tmk_core/protocol/arm_atsam/adc.c b/tmk_core/protocol/arm_atsam/adc.c
index ab77f9240..cb5c349b7 100644
--- a/tmk_core/protocol/arm_atsam/adc.c
+++ b/tmk_core/protocol/arm_atsam/adc.c
@@ -74,9 +74,9 @@ void ADC0_init(void)
while (ADC0->SYNCBUSY.bit.SAMPCTRL) { DBGC(DC_ADC0_SAMPCTRL_SYNCING_1); }
//Load factory calibration data
- ADC0->CALIB.bit.BIASCOMP = (ADC0_FUSES_BIASCOMP_ADDR >> ADC0_FUSES_BIASCOMP_Pos) & ADC0_FUSES_BIASCOMP_Msk;
- ADC0->CALIB.bit.BIASR2R = (ADC0_FUSES_BIASR2R_ADDR >> ADC0_FUSES_BIASR2R_Pos) & ADC0_FUSES_BIASR2R_Msk;
- ADC0->CALIB.bit.BIASREFBUF = (ADC0_FUSES_BIASREFBUF_ADDR >> ADC0_FUSES_BIASREFBUF_Pos) & ADC0_FUSES_BIASREFBUF_Msk;
+ ADC0->CALIB.bit.BIASCOMP = ((*(uint32_t *)ADC0_FUSES_BIASCOMP_ADDR) & ADC0_FUSES_BIASCOMP_Msk) >> ADC0_FUSES_BIASCOMP_Pos;
+ ADC0->CALIB.bit.BIASR2R = ((*(uint32_t *)ADC0_FUSES_BIASR2R_ADDR) & ADC0_FUSES_BIASR2R_Msk) >> ADC0_FUSES_BIASR2R_Pos;
+ ADC0->CALIB.bit.BIASREFBUF = ((*(uint32_t *)ADC0_FUSES_BIASREFBUF_ADDR) & ADC0_FUSES_BIASREFBUF_Msk) >> ADC0_FUSES_BIASREFBUF_Pos;
//Enable
ADC0->CTRLA.bit.ENABLE = 1;