Merge pull request #14478 from jeromecoutant/PR_L1_ADC_DEEP

STM32L1 : enable ADC after deepsleep
pull/14463/head
Martin Kojtal 2021-04-07 09:38:30 +02:00 committed by GitHub
commit dce643be92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -76,6 +76,11 @@ void analogin_init(analogin_t *obj, PinName pin)
if (HAL_ADC_Init(&obj->handle) != HAL_OK) {
error("Cannot initialize ADC");
}
}
uint16_t adc_read(analogin_t *obj)
{
ADC_ChannelConfTypeDef sConfig = {0};
if (!__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY)) {
// Enable the HSI (to clock the ADC)
@ -86,11 +91,6 @@ void analogin_init(analogin_t *obj, PinName pin)
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
HAL_RCC_OscConfig(&RCC_OscInitStruct);
}
}
uint16_t adc_read(analogin_t *obj)
{
ADC_ChannelConfTypeDef sConfig = {0};
// Configure ADC channel
sConfig.Rank = ADC_REGULAR_RANK_1;