mirror of https://github.com/ARMmbed/mbed-os.git
STM32L1 ADC internal channels update
parent
4d3a54443d
commit
881a8e31ff
|
@ -35,12 +35,9 @@
|
|||
#include "pinmap.h"
|
||||
#include "mbed_error.h"
|
||||
#include "PeripheralPins.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
void analogin_init(analogin_t *obj, PinName pin)
|
||||
{
|
||||
static bool adc_hsi_inited = false;
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
uint32_t function = (uint32_t)NC;
|
||||
|
||||
// ADC Internal Channels "pins" (Temperature, Vref, Vbat, ...)
|
||||
|
@ -92,10 +89,9 @@ void analogin_init(analogin_t *obj, PinName pin)
|
|||
error("Cannot initialize ADC");
|
||||
}
|
||||
|
||||
// This section is done only once
|
||||
if (!adc_hsi_inited) {
|
||||
adc_hsi_inited = true;
|
||||
if (!__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY)) {
|
||||
// Enable the HSI (to clock the ADC)
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
|
||||
|
|
|
@ -44,6 +44,9 @@
|
|||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l1xx_hal_def.h"
|
||||
|
||||
/* Include low level driver */
|
||||
#include "stm32l1xx_ll_adc.h"
|
||||
|
||||
/** @addtogroup STM32L1xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue