[NUCLEO_L152RE] Enable HSI clock for ADC

pull/478/head
bcostm 2014-09-05 11:03:56 +02:00
parent 4e3b149f79
commit 35660622d9
1 changed files with 5 additions and 0 deletions

View File

@ -81,6 +81,11 @@ void analogin_init(analogin_t *obj, PinName pin) {
// Get ADC registers structure address
adc = (ADC_TypeDef *)(obj->adc);
// Enable the HSI
RCC_HSICmd(ENABLE);
// Wait until HSI oscillator is ready
while(RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET) {}
// Enable ADC clock
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);