uc-sdk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lpc17xx_dac.h
Go to the documentation of this file.
1 /***********************************************************************/
21 /* Peripheral group ----------------------------------------------------------- */
27 #ifndef LPC17XX_DAC_H_
28 #define LPC17XX_DAC_H_
29 
30 /* Includes ------------------------------------------------------------------- */
31 #include "LPC17xx.h"
32 #include "lpc_types.h"
33 
34 
35 #ifdef __cplusplus
36 extern "C"
37 {
38 #endif
39 
40 /* Public Macros -------------------------------------------------------------- */
48 #define DAC_VALUE(n) ((uint32_t)((n&0x3FF)<<6))
49 
53 #define DAC_BIAS_EN ((uint32_t)(1<<16))
54 
55 #define DAC_CCNT_VALUE(n) ((uint32_t)(n&0xffff))
56 
58 #define DAC_DBLBUF_ENA ((uint32_t)(1<<1))
59 
60 #define DAC_CNT_ENA ((uint32_t)(1<<2))
61 
62 #define DAC_DMA_ENA ((uint32_t)(1<<3))
63 
64 #define DAC_DACCTRL_MASK ((uint32_t)(0x0F))
65 
67 #define PARAM_DACx(n) (((uint32_t *)n)==((uint32_t *)LPC_DAC))
68 
70 #define PARAM_DAC_CURRENT_OPT(OPTION) ((OPTION == DAC_MAX_CURRENT_700uA)\
71 ||(OPTION == DAC_MAX_CURRENT_350uA))
72 
75 /* Public Types --------------------------------------------------------------- */
82 typedef enum
83 {
89 
92 typedef struct
93 {
94 
95  uint8_t DBLBUF_ENA;
99  uint8_t CNT_ENA;
103  uint8_t DMA_ENA;
107  uint8_t RESERVED;
108 
110 
115 /* Public Functions ----------------------------------------------------------- */
120 void DAC_Init(LPC_DAC_TypeDef *DACx);
121 void DAC_UpdateValue (LPC_DAC_TypeDef *DACx, uint32_t dac_value);
122 void DAC_SetBias (LPC_DAC_TypeDef *DACx,uint32_t bias);
123 void DAC_ConfigDAConverterControl (LPC_DAC_TypeDef *DACx,DAC_CONVERTER_CFG_Type *DAC_ConverterConfigStruct);
124 void DAC_SetDMATimeOut(LPC_DAC_TypeDef *DACx,uint32_t time_out);
125 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 
135 #endif /* LPC17XX_DAC_H_ */
136 
141 /* --------------------------------- End Of File ------------------------------ */
142