aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/dac.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmaple/dac.c')
-rw-r--r--libmaple/dac.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/libmaple/dac.c b/libmaple/dac.c
index 5a00590..d802d2b 100644
--- a/libmaple/dac.c
+++ b/libmaple/dac.c
@@ -2,7 +2,7 @@
* The MIT License
*
* Copyright (c) 2010 Bryan Newbold.
- * Copyright (c) 2011 LeafLabs, LLC.
+ * Copyright (c) 2011, 2012 LeafLabs, LLC.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -30,21 +30,16 @@
* @brief Digital to analog converter support.
*/
+#include <libmaple/dac.h>
#include <libmaple/libmaple.h>
#include <libmaple/gpio.h>
-#include <libmaple/dac.h>
-
-#ifdef STM32_HIGH_DENSITY
-
-/**
- * @brief DAC peripheral routines.
- */
+#if STM32_HAVE_DAC
dac_dev dac = {
.regs = DAC_BASE,
};
-/** DAC device. */
const dac_dev *DAC = &dac;
+#endif
/**
* @brief Initialize the digital to analog converter
@@ -98,11 +93,11 @@ void dac_enable_channel(const dac_dev *dev, uint8 channel) {
*/
switch (channel) {
case 1:
- gpio_set_mode(GPIOA, 4, GPIO_INPUT_ANALOG);
+ gpio_set_mode(GPIOA, 4, GPIO_MODE_ANALOG);
dev->regs->CR |= DAC_CR_EN1;
break;
case 2:
- gpio_set_mode(GPIOA, 5, GPIO_INPUT_ANALOG);
+ gpio_set_mode(GPIOA, 5, GPIO_MODE_ANALOG);
dev->regs->CR |= DAC_CR_EN2;
break;
}
@@ -123,5 +118,3 @@ void dac_disable_channel(const dac_dev *dev, uint8 channel) {
break;
}
}
-
-#endif /* STM32_HIGH_DENSITY */