rfLPC
A low level library for using NXP's LPC17xx SoC. Config is given for MBED prototyping board
dac.h
Go to the documentation of this file.
1 /* This file is part of rflpc. Copyright 2010-2011 Michael Hauspie
2  *
3  * rflpc is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * rflpc is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with rflpc. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
21 #ifndef __RFLPC_DAC_H__
22 #define __RFLPC_DAC_H__
23 
24 /*
25  Author: Christophe Bacara <christophe.bacara@etudiant.univ-lille1.fr
26 */
27 
28 #ifdef RFLPC_CONFIG_ENABLE_DAC
29 
30 #include "../rflpc17xx.h"
31 
46 extern void rflpc_dac_init(uint8_t clock_divider);
47 
53 static inline void rflpc_dac_write(uint16_t value)
54 {
55  RFLPC_SET_BITS_VAL (LPC_DAC->DACR, 6, (value & 0x3FF), 10);
56 }
57 
58 #endif /* RFLPC_CONFIG_ENABLE_DAC */
59 
62 #endif /* __RFLPC_DAC_H__ */
void rflpc_dac_init(uint8_t clock_divider)
Initializes the Digital To Analog Converter.
static void rflpc_dac_write(uint16_t value)
Set the value of DAC register.
Definition: dac.h:53
#define RFLPC_SET_BITS_VAL(val, bit_pos, bit_val, bit_count)
Sets some bits values from the position of the LSB bit and the number of bits to set.
Definition: tools.h:45