From f4e5f016ac31aadb597e0b49f846638b41b306a2 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Tue, 28 Apr 2020 01:48:30 +0200 Subject: [PATCH] boards/samd21-xpro: enable DAC samd21-xpro exposes PA02 on the EXT3 pin header, so we can enable the DAC --- boards/samd21-xpro/Makefile.features | 1 + boards/samd21-xpro/include/periph_conf.h | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/boards/samd21-xpro/Makefile.features b/boards/samd21-xpro/Makefile.features index 27a8b83bb7..e24a5fcae4 100644 --- a/boards/samd21-xpro/Makefile.features +++ b/boards/samd21-xpro/Makefile.features @@ -3,6 +3,7 @@ CPU_MODEL = samd21j18a # Put defined MCU peripherals here (in alphabetical order) FEATURES_PROVIDED += periph_adc +FEATURES_PROVIDED += periph_dac FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_rtc diff --git a/boards/samd21-xpro/include/periph_conf.h b/boards/samd21-xpro/include/periph_conf.h index 33e30efa36..5db595e851 100644 --- a/boards/samd21-xpro/include/periph_conf.h +++ b/boards/samd21-xpro/include/periph_conf.h @@ -347,6 +347,15 @@ static const adc_conf_chan_t adc_channels[] = { #define ADC_NUMOF ARRAY_SIZE(adc_channels) /** @} */ +/** + * @name DAC configuration + * @{ + */ +#define DAC_CLOCK SAM0_GCLK_1MHZ + /* use Vcc as reference voltage */ +#define DAC_VREF DAC_CTRLB_REFSEL_AVCC +/** @} */ + #ifdef __cplusplus } #endif