all three accelerometer channels working now, using burst conversion on MAT0.1
[fw/openalt] / dac / dac.c
1 #include "FreeRTOS.h"
2
3 #include "dac.h"
4
5 //
6 //
7 //
8 void dacInit (void)
9 {
10   PCB_PINSEL1 |= PCB_PINSEL1_P025_AOUT;
11
12   DAC_CR = 0;
13 }
14
15 unsigned int dacSet (unsigned int newValue)
16 {
17   unsigned int dacCR;
18   unsigned int dacCurrentValue;
19
20   dacCR = DAC_CR;
21   dacCurrentValue = (dacCR & DAC_CR_VALUEMASK) >> DAC_CR_VALUESHIFT;
22   dacCR = (dacCR & ~DAC_CR_VALUEMASK) | ((newValue << DAC_CR_VALUESHIFT) & DAC_CR_VALUEMASK);
23   DAC_CR = dacCR;
24
25   return dacCurrentValue;
26 }