Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions targets/TARGET_STM/TARGET_STM32L1/analogin_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down