]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/ThirdParty/CMSISv2p10_LPC18xx_DriverLib/inc/lpc18xx_dac.h
df47bdf6b84788ea46def4427a00a8a8beae78ee
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC / ThirdParty / CMSISv2p10_LPC18xx_DriverLib / inc / lpc18xx_dac.h
1 /**********************************************************************\r
2 * $Id$          lpc18xx_dac.h                   2011-06-02\r
3 *//**\r
4 * @file         lpc18xx_dac.h\r
5 * @brief        Contains all macro definitions and function prototypes\r
6 *                       support for DAC firmware library on LPC18xx\r
7 * @version      1.0\r
8 * @date         02. June. 2011\r
9 * @author       NXP MCU SW Application Team\r
10 *\r
11 * Copyright(C) 2011, NXP Semiconductor\r
12 * All rights reserved.\r
13 *\r
14 ***********************************************************************\r
15 * Software that is described herein is for illustrative purposes only\r
16 * which provides customers with programming information regarding the\r
17 * products. This software is supplied "AS IS" without any warranties.\r
18 * NXP Semiconductors assumes no responsibility or liability for the\r
19 * use of the software, conveys no license or title under any patent,\r
20 * copyright, or mask work right to the product. NXP Semiconductors\r
21 * reserves the right to make changes in the software without\r
22 * notification. NXP Semiconductors also make no representation or\r
23 * warranty that such application will be suitable for the specified\r
24 * use without further testing or modification.\r
25 **********************************************************************/\r
26 \r
27 /* Peripheral group ----------------------------------------------------------- */\r
28 /** @defgroup DAC DAC (Digital to Analog Converter)\r
29  * @ingroup LPC1800CMSIS_FwLib_Drivers\r
30  * @{\r
31  */\r
32 \r
33 #ifndef LPC18XX_DAC_H_\r
34 #define LPC18XX_DAC_H_\r
35 \r
36 /* Includes ------------------------------------------------------------------- */\r
37 #include "LPC18xx.h"\r
38 #include "lpc_types.h"\r
39 \r
40 \r
41 #ifdef __cplusplus\r
42 extern "C"\r
43 {\r
44 #endif\r
45 \r
46 /* Public Macros -------------------------------------------------------------- */\r
47 /** @defgroup DAC_Private_Macros DAC Private Macros\r
48  * @{\r
49  */\r
50 \r
51 /** After the selected settling time after this field is written with a\r
52 new VALUE, the voltage on the AOUT pin (with respect to VSSA)\r
53 is VALUE/1024 × VREF */\r
54 #define DAC_VALUE(n)            ((uint32_t)((n&0x3FF)<<6))\r
55 /** If this bit = 0: The settling time of the DAC is 1 microsecond max,\r
56  * and the maximum current is 700 microAmpere\r
57  * If this bit = 1: The settling time of the DAC is 2.5 microsecond\r
58  * and the maximum current is 350 microAmpere */\r
59 #define DAC_BIAS_EN                     ((uint32_t)(1<<16))\r
60 /** Value to reload interrupt DMA counter */\r
61 #define DAC_CCNT_VALUE(n)  ((uint32_t)(n&0xffff))\r
62 \r
63 /** DCAR double buffering */\r
64 #define DAC_DBLBUF_ENA          ((uint32_t)(1<<1))\r
65 /** DCAR Time out count enable */\r
66 #define DAC_CNT_ENA                     ((uint32_t)(1<<2))\r
67 /** DCAR DMA access */\r
68 #define DAC_DMA_ENA                     ((uint32_t)(1<<3))\r
69 /** DCAR DACCTRL mask bit */\r
70 #define DAC_DACCTRL_MASK        ((uint32_t)(0x0F))\r
71 \r
72 /** Macro to determine if it is valid DAC peripheral */\r
73 #define PARAM_DACx(n)   (((uint32_t *)n)==((uint32_t *)LPC_DAC))\r
74 \r
75 /** Macro to check DAC current optional parameter */\r
76 #define PARAM_DAC_CURRENT_OPT(OPTION) ((OPTION == DAC_MAX_CURRENT_700uA)\\r
77 ||(OPTION == DAC_MAX_CURRENT_350uA))\r
78 \r
79 /**\r
80  * @}\r
81  */\r
82 /* Public Types --------------------------------------------------------------- */\r
83 /** @defgroup DAC_Public_Types DAC Public Types\r
84  * @{\r
85  */\r
86 \r
87 /**\r
88  * @brief Current option in DAC configuration option */\r
89 typedef enum\r
90 {\r
91         DAC_MAX_CURRENT_700uA = 0,      /*!< The settling time of the DAC is 1 us max,\r
92                                                                 and the maximum current is 700 uA */\r
93         DAC_MAX_CURRENT_350uA           /*!< The settling time of the DAC is 2.5 us\r
94                                                                 and the maximum current is 350 uA */\r
95 } DAC_CURRENT_OPT;\r
96 \r
97 /**\r
98  * @brief Configuration for DAC converter control register */\r
99 typedef struct\r
100 {\r
101 \r
102         uint8_t  DBLBUF_ENA;            /**<\r
103                                                 -0: Disable DACR double buffering\r
104                                                 -1: when bit CNT_ENA, enable DACR double buffering feature\r
105                                                                 */\r
106         uint8_t  CNT_ENA;                       /*!<\r
107                                                 -0: Time out counter is disable\r
108                                                 -1: Time out conter is enable\r
109                                                                 */\r
110         uint8_t  DMA_ENA;                       /*!<\r
111                                                 -0: DMA access is disable\r
112                                                 -1: DMA burst request\r
113                                                                 */\r
114         uint8_t RESERVED;\r
115 \r
116 } DAC_CONVERTER_CFG_Type;\r
117 \r
118 /**\r
119  * @}\r
120  */\r
121 \r
122 /* Public Functions ----------------------------------------------------------- */\r
123 /** @defgroup DAC_Public_Functions DAC Public Functions\r
124  * @{\r
125  */\r
126 \r
127 void    DAC_Init(LPC_DAC_Type *DACx);\r
128 void    DAC_UpdateValue (LPC_DAC_Type *DACx, uint32_t dac_value);\r
129 void    DAC_SetBias (LPC_DAC_Type *DACx,uint32_t bias);\r
130 void    DAC_ConfigDAConverterControl (LPC_DAC_Type *DACx,DAC_CONVERTER_CFG_Type *DAC_ConverterConfigStruct);\r
131 void    DAC_SetDMATimeOut(LPC_DAC_Type *DACx,uint32_t time_out);\r
132 \r
133 /**\r
134  * @}\r
135  */\r
136 \r
137 #ifdef __cplusplus\r
138 }\r
139 #endif\r
140 \r
141 \r
142 #endif /* LPC18XX_DAC_H_ */\r
143 \r
144 /**\r
145  * @}\r
146  */\r
147 \r
148 /* --------------------------------- End Of File ------------------------------ */\r
149 \r