File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -343,6 +343,21 @@ void SystemInit( void )
343
343
PM -> APBCSEL .reg = PM_APBCSEL_APBCDIV_DIV1_Val ;
344
344
345
345
SystemCoreClock = VARIANT_MCK ;
346
+
347
+ /* ----------------------------------------------------------------------------------------------
348
+ * 8) Load ADC factory calibration values
349
+ */
350
+
351
+ // ADC Bias Calibration
352
+ uint32_t bias = (* ((uint32_t * ) ADC_FUSES_BIASCAL_ADDR ) & ADC_FUSES_BIASCAL_Msk ) >> ADC_FUSES_BIASCAL_Pos ;
353
+
354
+ // ADC Linearity bits 4:0
355
+ uint32_t linearity = (* ((uint32_t * ) ADC_FUSES_LINEARITY_0_ADDR ) & ADC_FUSES_LINEARITY_0_Msk ) >> ADC_FUSES_LINEARITY_0_Pos ;
356
+
357
+ // ADC Linearity bits 7:5
358
+ linearity |= ((* ((uint32_t * ) ADC_FUSES_LINEARITY_1_ADDR ) & ADC_FUSES_LINEARITY_1_Msk ) >> ADC_FUSES_LINEARITY_1_Pos ) << 5 ;
359
+
360
+ ADC -> CALIB .reg = ADC_CALIB_BIAS_CAL (bias ) | ADC_CALIB_LINEARITY_CAL (linearity );
346
361
}
347
362
348
363
/**
You can’t perform that action at this time.
0 commit comments