22 lines
583 B
C
22 lines
583 B
C
//
|
||
// Created by ZK on 2023/3/14.
|
||
//
|
||
|
||
#include "InteriorADC.h"
|
||
|
||
|
||
bool InteriorADC_Init(void) {
|
||
//使能ADC注入
|
||
HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED);
|
||
HAL_ADCEx_Calibration_Start(&hadc2, ADC_SINGLE_ENDED);
|
||
|
||
HAL_Delay(100);
|
||
HAL_ADCEx_InjectedStart(&hadc1);
|
||
__HAL_ADC_ENABLE_IT(&hadc1, ADC_IT_JEOC);
|
||
__HAL_ADC_DISABLE_IT(&hadc1, ADC_IT_JEOS);//关闭ADC1的中断,避免ADC1_2_IRQHandler触发两次
|
||
HAL_ADCEx_InjectedStart(&hadc2);
|
||
__HAL_ADC_ENABLE_IT(&hadc2, ADC_IT_JEOC);
|
||
|
||
|
||
return 0;//返回值为零表示初始化成功
|
||
} |