aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/dac.c
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-09-27 00:40:44 -0400
committerMarti Bolivar <mbolivar@mit.edu>2010-09-27 00:40:44 -0400
commit753f89de354eff212d84f3f2aff41146865da342 (patch)
tree095e2183ce956bac028083d056c9c4b7ee8a8d84 /libmaple/dac.c
parent849bc0f8f6abf42567a152cf6e01bf7349902aac (diff)
downloadlibrambutan-753f89de354eff212d84f3f2aff41146865da342.tar.gz
librambutan-753f89de354eff212d84f3f2aff41146865da342.zip
whitespace cleanups
Diffstat (limited to 'libmaple/dac.c')
-rw-r--r--libmaple/dac.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/libmaple/dac.c b/libmaple/dac.c
index ffc34f8..4c00edb 100644
--- a/libmaple/dac.c
+++ b/libmaple/dac.c
@@ -1,5 +1,4 @@
-
-/* *****************************************************************************
+/******************************************************************************
* The MIT License
*
* Copyright (c) 2010 Bryan Newbold.
@@ -21,47 +20,44 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
- * ****************************************************************************/
+ *****************************************************************************/
#include "libmaple.h"
#include "rcc.h"
#include "gpio.h"
#include "dac.h"
-// Only one, so global to this file
+/* Only one, so global to this file */
DAC_Map *dac = (DAC_Map*)(DAC_BASE);
-// This numbering follows the registers (1-indexed)
+/* This numbering follows the registers (1-indexed) */
#define DAC_CHA 1
#define DAC_CHB 2
-// Sets up the DAC peripheral
+/* Sets up the DAC peripheral */
void dac_init(void) {
-
- // First turn on the clock
+ /* First turn on the clock */
rcc_clk_enable(RCC_DAC);
- // Then setup ANALOG mode on PA4 and PA5
+ /* Then setup ANALOG mode on PA4 and PA5 */
gpio_set_mode(GPIOA_BASE, 4, CNF_INPUT_ANALOG);
gpio_set_mode(GPIOA_BASE, 5, CNF_INPUT_ANALOG);
- // Then do register stuff.
- // Default does no triggering, and buffered output, so all good.
+ /* Then do register stuff. Default does no triggering, and
+ * buffered output, so all good. */
dac->CR |= DAC_CR_EN1;
dac->CR |= DAC_CR_EN2;
-
}
void dac_write(uint8 chan, uint16 val) {
-
switch(chan) {
- case DAC_CHA:
- dac->DHR12R1 = 0x0FFF & val;
- break;
- case DAC_CHB:
- dac->DHR12R2 = 0x0FFF & val;
- break;
- default:
- ASSERT(0); // Shouldn't get here
+ case DAC_CHA:
+ dac->DHR12R1 = 0x0FFF & val;
+ break;
+ case DAC_CHB:
+ dac->DHR12R2 = 0x0FFF & val;
+ break;
+ default:
+ ASSERT(0); // can't happen
}
}