aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/dac.c
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-06-04 00:06:43 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-06-04 00:20:21 -0400
commit23d81a1044ac3c3694d58d7659be8476ebe9ee15 (patch)
tree9ab62e9244aae91d344eaca8cab926ce8c560287 /libmaple/dac.c
parent6ad1757e62dcfe112a473ef6474b9f4c1317cf9e (diff)
downloadlibrambutan-23d81a1044ac3c3694d58d7659be8476ebe9ee15.tar.gz
librambutan-23d81a1044ac3c3694d58d7659be8476ebe9ee15.zip
Bring back libmaple/dac.h.
Minor variations on F2: DMA underrun interrupts, and a status register to hold the notification bits. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
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 */