From 3d422a930fde20bf1de177d663d93eb532c9a117 Mon Sep 17 00:00:00 2001 From: Eric Van Albert Date: Mon, 10 Jun 2019 23:06:33 -0400 Subject: [PATCH] stm32l4: add common DAC support Replace the DAC1_BASE style, only used on l4 with the standard DAC_BASE used on all other targets. Reviewed-by: Karl Palsson --- include/libopencm3/stm32/dac.h | 2 ++ include/libopencm3/stm32/l4/dac.h | 37 +++++++++++++++++++++++++ include/libopencm3/stm32/l4/memorymap.h | 2 +- lib/stm32/l4/Makefile | 1 + 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 include/libopencm3/stm32/l4/dac.h diff --git a/include/libopencm3/stm32/dac.h b/include/libopencm3/stm32/dac.h index 962210f3..6a17a738 100644 --- a/include/libopencm3/stm32/dac.h +++ b/include/libopencm3/stm32/dac.h @@ -34,6 +34,8 @@ # include #elif defined(STM32L1) # include +#elif defined(STM32L4) +# include #else # error "stm32 family not defined." #endif diff --git a/include/libopencm3/stm32/l4/dac.h b/include/libopencm3/stm32/l4/dac.h new file mode 100644 index 00000000..10b275a7 --- /dev/null +++ b/include/libopencm3/stm32/l4/dac.h @@ -0,0 +1,37 @@ +/** @defgroup dac_defines DAC Defines + +@brief Defined Constants and Types for the STM32L4xx DAC + +@ingroup STM32L4xx_defines + +@version 1.0.0 + +@date 8 June 2019 + +LGPL License Terms @ref lgpl_license + */ + +/* + * This file is part of the libopencm3 project. + * + * 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_DAC_H +#define LIBOPENCM3_DAC_H + +#include + +#endif + diff --git a/include/libopencm3/stm32/l4/memorymap.h b/include/libopencm3/stm32/l4/memorymap.h index 40567a34..baaa32f5 100644 --- a/include/libopencm3/stm32/l4/memorymap.h +++ b/include/libopencm3/stm32/l4/memorymap.h @@ -61,7 +61,7 @@ #define USB_DEV_FS_BASE (PERIPH_BASE_APB1 + 0x6800) #define USB_PMA_BASE (PERIPH_BASE_APB1 + 0x6c00) #define POWER_CONTROL_BASE (PERIPH_BASE_APB1 + 0x7000) -#define DAC1_BASE (PERIPH_BASE_APB1 + 0x7400) +#define DAC_BASE (PERIPH_BASE_APB1 + 0x7400) #define OPAMP_BASE (PERIPH_BASE_APB1 + 0x7800) #define LPTIM1_BASE (PERIPH_BASE_APB1 + 0x7c00) #define LPUART1_BASE (PERIPH_BASE_APB1 + 0x8000) diff --git a/lib/stm32/l4/Makefile b/lib/stm32/l4/Makefile index 1de6e320..43f4c831 100644 --- a/lib/stm32/l4/Makefile +++ b/lib/stm32/l4/Makefile @@ -54,6 +54,7 @@ OBJS += dma_common_l1f013.o OBJS += iwdg_common_all.o OBJS += rtc_common_l1f024.o OBJS += spi_common_all.o spi_common_v2.o +OBJS += dac_common_all.o OBJS += usb.o usb_control.o usb_standard.o usb_msc.o OBJS += st_usbfs_core.o st_usbfs_v2.o