16 lines
485 B
C
16 lines
485 B
C
uint32_t SingleChannel(ADC_HandleTypeDef* hadc){
|
|
HAL_ADC_Start(&hadc);
|
|
HAL_ADC_PollForConversion (hadc, 100);
|
|
uint32_t x = HAL_ADC_GetValue(hadc);
|
|
HAL_ADC_Stop(&hadc);
|
|
return x;
|
|
}
|
|
|
|
void MultiChannel(ADC_HandleTypeDef *hadc, uint32_t *outbuffer, uint8_t n_of_channels){
|
|
HAL_ADC_Start(hadc);
|
|
for(uint8_t i = 0; i<n_of_channels; i++){
|
|
HAL_ADC_PollForConversion (hadc, 100);
|
|
outbuffer[i] = HAL_ADC_GetValue(hadc);
|
|
HAL_ADC_Stop(hadc);
|
|
}
|
|
} |