From 54d98a4c68b04a1440e54d5254ab8b81ba14b48c Mon Sep 17 00:00:00 2001 From: Fabian Nack Date: Wed, 11 Mar 2015 13:52:22 +0100 Subject: [PATCH] boards/msbiot: Add DAC feature --- boards/msbiot/Makefile.features | 2 +- boards/msbiot/include/periph_conf.h | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/boards/msbiot/Makefile.features b/boards/msbiot/Makefile.features index 7d5d2559d5..e6c82f7d30 100644 --- a/boards/msbiot/Makefile.features +++ b/boards/msbiot/Makefile.features @@ -1,5 +1,5 @@ FEATURES_PROVIDED += cpp FEATURES_PROVIDED += periph_uart periph_gpio periph_spi periph_i2c periph_pwm periph_random \ - periph_adc + periph_adc periph_dac FEATURES_PROVIDED += transceiver FEATURES_MCU_GROUP = cortex_m4 diff --git a/boards/msbiot/include/periph_conf.h b/boards/msbiot/include/periph_conf.h index d24f41961d..6135a7f3b8 100644 --- a/boards/msbiot/include/periph_conf.h +++ b/boards/msbiot/include/periph_conf.h @@ -114,6 +114,26 @@ extern "C" { #define ADC_0_CH1_PIN 1 /** @} */ +/** + * @name DAC configuration + * @{ + */ +#define DAC_NUMOF (1U) +#define DAC_0_EN 1 +#define DAC_MAX_CHANNELS 2 + +/* DAC 0 configuration */ +#define DAC_0_DEV DAC +#define DAC_0_CHANNELS 2 +#define DAC_0_CLKEN() (RCC->APB1ENR |= (RCC_APB1ENR_DACEN)) +#define DAC_0_CLKDIS() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN)) +#define DAC_0_PORT GPIOA +#define DAC_0_PORT_CLKEN() (RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN) +/* DAC 0 channel config */ +#define DAC_0_CH0_PIN 4 +#define DAC_0_CH1_PIN 5 +/** @} */ + /** * @name Random Number Generator configuration * @{