Fix STM32F1 ADC read temperature error (#15026)

…after USB CDC connect.
This commit is contained in:
BigTreeTech 2019-08-24 14:33:16 +08:00 committed by Scott Lahteine
parent 04a9962cb5
commit 848dd740ba

View file

@ -93,7 +93,7 @@ uint16_t HAL_adc_result;
// ------------------------ // ------------------------
STM32ADC adc(ADC1); STM32ADC adc(ADC1);
uint8_t adc_pins[] = { const uint8_t adc_pins[] = {
#if HAS_TEMP_ADC_0 #if HAS_TEMP_ADC_0
TEMP_0_PIN, TEMP_0_PIN,
#endif #endif
@ -270,7 +270,7 @@ void HAL_adc_init(void) {
#else #else
adc.setSampleRate(ADC_SMPR_41_5); // 41.5 ADC cycles adc.setSampleRate(ADC_SMPR_41_5); // 41.5 ADC cycles
#endif #endif
adc.setPins(adc_pins, ADC_PIN_COUNT); adc.setPins((uint8_t *)adc_pins, ADC_PIN_COUNT);
adc.setDMA(HAL_adc_results, (uint16_t)ADC_PIN_COUNT, (uint32_t)(DMA_MINC_MODE | DMA_CIRC_MODE), nullptr); adc.setDMA(HAL_adc_results, (uint16_t)ADC_PIN_COUNT, (uint32_t)(DMA_MINC_MODE | DMA_CIRC_MODE), nullptr);
adc.setScanMode(); adc.setScanMode();
adc.setContinuous(); adc.setContinuous();