From 3ab83bc07869dbb3291a721fdb9dc2b1c64a0ddf Mon Sep 17 00:00:00 2001 From: Stephen Holdaway Date: Tue, 29 Jun 2021 23:40:23 +1200 Subject: [PATCH] stm32g0: Support DAC Nothing extra needed to be defined here - this might've just been missed when adding STM32G0 support. Tested and works well on an STM32G051. Registers in `stm32/common/dac_common_v1.h` match the STM32G0x1 reference manual. --- include/libopencm3/stm32/dac.h | 2 ++ include/libopencm3/stm32/g0/dac.h | 41 +++++++++++++++++++++++++++++++ lib/stm32/g0/Makefile | 1 + 3 files changed, 44 insertions(+) create mode 100644 include/libopencm3/stm32/g0/dac.h diff --git a/include/libopencm3/stm32/dac.h b/include/libopencm3/stm32/dac.h index a3efb12e..dacb7dfa 100644 --- a/include/libopencm3/stm32/dac.h +++ b/include/libopencm3/stm32/dac.h @@ -36,6 +36,8 @@ # include #elif defined(STM32L4) # include +#elif defined(STM32G0) +# include #elif defined(STM32G4) # include #elif defined(STM32H7) diff --git a/include/libopencm3/stm32/g0/dac.h b/include/libopencm3/stm32/g0/dac.h new file mode 100644 index 00000000..1726d4ad --- /dev/null +++ b/include/libopencm3/stm32/g0/dac.h @@ -0,0 +1,41 @@ +/** @defgroup dac_defines DAC Defines + * + * @brief Defined Constants and Types for the STM32G0xx Digital-to-Analog Converter + * + * @ingroup STM32G0xx_defines + * + * 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 + +/**@{*/ + +/** @defgroup dac_reg_base DAC register base addresses +@{*/ +#define DAC1 DAC_BASE +/**@}*/ + +/**@}*/ + +#endif + diff --git a/lib/stm32/g0/Makefile b/lib/stm32/g0/Makefile index b302aeea..710f379c 100644 --- a/lib/stm32/g0/Makefile +++ b/lib/stm32/g0/Makefile @@ -35,6 +35,7 @@ TGT_CFLAGS += $(STANDARD_FLAGS) ARFLAGS = rcs OBJS += adc.o adc_common_v2.o OBJS += crc_common_all.o +OBJS += dac_common_all.o dac_common_v1.o OBJS += desig_common_all.o desig_common_v1.o OBJS += dma_common_l1f013.o OBJS += dmamux.o