diff --git a/include/libopencm3/stm32/adc.h b/include/libopencm3/stm32/adc.h index 54388be8..e03bae0e 100644 --- a/include/libopencm3/stm32/adc.h +++ b/include/libopencm3/stm32/adc.h @@ -28,6 +28,8 @@ # include #elif defined(STM32F4) # include +#elif defined(STM32L0) +# include #elif defined(STM32L1) # include #else diff --git a/include/libopencm3/stm32/l0/adc.h b/include/libopencm3/stm32/l0/adc.h new file mode 100644 index 00000000..a7b3f1fa --- /dev/null +++ b/include/libopencm3/stm32/l0/adc.h @@ -0,0 +1,76 @@ +/** @defgroup adc_defines ADC Defines + * + * @brief Defined Constants and Types for the STM32L0xx Analog to Digital + * Converter + * + * @ingroup STM32L0xx_defines + * + * @version 1.0.0 + * + * @date 16 Oct 2015 + * + * LGPL License Terms @ref lgpl_license + */ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2015 Karl Palsson + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +#ifndef LIBOPENCM3_ADC_H +#define LIBOPENCM3_ADC_H + +#include +#include + +/** @defgroup adc_reg_base ADC register base addresses + * @ingroup adc_defines + * + *@{*/ +#define ADC1 ADC1_BASE +/**@}*/ + + +/** @defgroup adc_channel ADC Channel Numbers + * @ingroup adc_defines + * + *@{*/ +#define ADC_CHANNEL_VLCD 16 +#define ADC_CHANNEL_VREF 17 +#define ADC_CHANNEL_TEMP 18 +/**@}*/ + +/* Calibration Factors */ +#define ADC_CALFACT(adc) MMIO32((adc) + 0xB4) + +/* Register values */ +/* ADC_CFGR2 Values ---------------------------------------------------------*/ + +#define ADC_CFGR2_CKMODE_SHIFT 30 +#define ADC_CFGR2_CKMODE (3 << ADC_CFGR2_CKMODE_SHIFT) +#define ADC_CFGR2_CKMODE_CK_ADC (0 << ADC_CFGR2_CKMODE_SHIFT) +#define ADC_CFGR2_CKMODE_PCLK_DIV2 (1 << ADC_CFGR2_CKMODE_SHIFT) +#define ADC_CFGR2_CKMODE_PCLK_DIV4 (2 << ADC_CFGR2_CKMODE_SHIFT) +#define ADC_CFGR2_CKMODE_PCLK (3 << ADC_CFGR2_CKMODE_SHIFT) + + +BEGIN_DECLS + + +END_DECLS + + +#endif diff --git a/lib/stm32/l0/Makefile b/lib/stm32/l0/Makefile index fa87b253..6cf194e3 100644 --- a/lib/stm32/l0/Makefile +++ b/lib/stm32/l0/Makefile @@ -39,6 +39,7 @@ OBJS = gpio.o rcc.o desig.o OBJS += pwr_common_all.o pwr_common_l01.o OBJS += gpio_common_all.o gpio_common_f0234.o rcc_common_all.o +OBJS += adc_common_v2.o OBJS += crs_common_all.o OBJS += usb.o usb_control.o usb_standard.o