comparison Common/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dac_ex.h @ 160:e3ca52b8e7fa

Merge with FlipDisplay
author heinrichsweikamp
date Thu, 07 Mar 2019 15:06:43 +0100
parents c78bcbd5deda
children
comparison
equal deleted inserted replaced
80:cc2bb7bb8456 160:e3ca52b8e7fa
1 /**
2 ******************************************************************************
3 * @file stm32f4xx_hal_dac.h
4 * @author MCD Application Team
5 * @brief Header file of DAC HAL Extension module.
6 ******************************************************************************
7 * @attention
8 *
9 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
10 *
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
13 * 1. Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 ******************************************************************************
34 */
35
36 /* Define to prevent recursive inclusion -------------------------------------*/
37 #ifndef __STM32F4xx_HAL_DAC_EX_H
38 #define __STM32F4xx_HAL_DAC_EX_H
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
45 defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
46 defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) ||\
47 defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F413xx) || defined(STM32F423xx)
48
49 /* Includes ------------------------------------------------------------------*/
50 #include "stm32f4xx_hal_def.h"
51
52 /** @addtogroup STM32F4xx_HAL_Driver
53 * @{
54 */
55
56 /** @addtogroup DACEx
57 * @{
58 */
59
60 /* Exported types ------------------------------------------------------------*/
61 /* Exported constants --------------------------------------------------------*/
62 /** @defgroup DACEx_Exported_Constants DAC Exported Constants
63 * @{
64 */
65
66 /** @defgroup DACEx_lfsrunmask_triangleamplitude DAC LFS Run Mask Triangle Amplitude
67 * @{
68 */
69 #define DAC_LFSRUNMASK_BIT0 0x00000000U /*!< Unmask DAC channel LFSR bit0 for noise wave generation */
70 #define DAC_LFSRUNMASK_BITS1_0 ((uint32_t)DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[1:0] for noise wave generation */
71 #define DAC_LFSRUNMASK_BITS2_0 ((uint32_t)DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[2:0] for noise wave generation */
72 #define DAC_LFSRUNMASK_BITS3_0 ((uint32_t)DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0)/*!< Unmask DAC channel LFSR bit[3:0] for noise wave generation */
73 #define DAC_LFSRUNMASK_BITS4_0 ((uint32_t)DAC_CR_MAMP1_2) /*!< Unmask DAC channel LFSR bit[4:0] for noise wave generation */
74 #define DAC_LFSRUNMASK_BITS5_0 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[5:0] for noise wave generation */
75 #define DAC_LFSRUNMASK_BITS6_0 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[6:0] for noise wave generation */
76 #define DAC_LFSRUNMASK_BITS7_0 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[7:0] for noise wave generation */
77 #define DAC_LFSRUNMASK_BITS8_0 ((uint32_t)DAC_CR_MAMP1_3) /*!< Unmask DAC channel LFSR bit[8:0] for noise wave generation */
78 #define DAC_LFSRUNMASK_BITS9_0 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[9:0] for noise wave generation */
79 #define DAC_LFSRUNMASK_BITS10_0 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[10:0] for noise wave generation */
80 #define DAC_LFSRUNMASK_BITS11_0 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[11:0] for noise wave generation */
81 #define DAC_TRIANGLEAMPLITUDE_1 0x00000000U /*!< Select max triangle amplitude of 1 */
82 #define DAC_TRIANGLEAMPLITUDE_3 ((uint32_t)DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 3 */
83 #define DAC_TRIANGLEAMPLITUDE_7 ((uint32_t)DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 7 */
84 #define DAC_TRIANGLEAMPLITUDE_15 ((uint32_t)DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 15 */
85 #define DAC_TRIANGLEAMPLITUDE_31 ((uint32_t)DAC_CR_MAMP1_2) /*!< Select max triangle amplitude of 31 */
86 #define DAC_TRIANGLEAMPLITUDE_63 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 63 */
87 #define DAC_TRIANGLEAMPLITUDE_127 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 127 */
88 #define DAC_TRIANGLEAMPLITUDE_255 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 255 */
89 #define DAC_TRIANGLEAMPLITUDE_511 ((uint32_t)DAC_CR_MAMP1_3) /*!< Select max triangle amplitude of 511 */
90 #define DAC_TRIANGLEAMPLITUDE_1023 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 1023 */
91 #define DAC_TRIANGLEAMPLITUDE_2047 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 2047 */
92 #define DAC_TRIANGLEAMPLITUDE_4095 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 4095 */
93 /**
94 * @}
95 */
96
97 /**
98 * @}
99 */
100
101 /* Exported macro ------------------------------------------------------------*/
102 /* Exported functions --------------------------------------------------------*/
103 /** @addtogroup DACEx_Exported_Functions
104 * @{
105 */
106
107 /** @addtogroup DACEx_Exported_Functions_Group1
108 * @{
109 */
110 /* Extension features functions ***********************************************/
111 uint32_t HAL_DACEx_DualGetValue(DAC_HandleTypeDef* hdac);
112 HAL_StatusTypeDef HAL_DACEx_TriangleWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Amplitude);
113 HAL_StatusTypeDef HAL_DACEx_NoiseWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Amplitude);
114 HAL_StatusTypeDef HAL_DACEx_DualSetValue(DAC_HandleTypeDef* hdac, uint32_t Alignment, uint32_t Data1, uint32_t Data2);
115
116 void HAL_DACEx_ConvCpltCallbackCh2(DAC_HandleTypeDef* hdac);
117 void HAL_DACEx_ConvHalfCpltCallbackCh2(DAC_HandleTypeDef* hdac);
118 void HAL_DACEx_ErrorCallbackCh2(DAC_HandleTypeDef* hdac);
119 void HAL_DACEx_DMAUnderrunCallbackCh2(DAC_HandleTypeDef* hdac);
120 /**
121 * @}
122 */
123
124 /**
125 * @}
126 */
127 /* Private types -------------------------------------------------------------*/
128 /* Private variables ---------------------------------------------------------*/
129 /* Private constants ---------------------------------------------------------*/
130 /** @defgroup DACEx_Private_Constants DAC Private Constants
131 * @{
132 */
133
134 /**
135 * @}
136 */
137
138 /* Private macros ------------------------------------------------------------*/
139 /** @defgroup DACEx_Private_Macros DAC Private Macros
140 * @{
141 */
142 #define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUNMASK_BIT0) || \
143 ((VALUE) == DAC_LFSRUNMASK_BITS1_0) || \
144 ((VALUE) == DAC_LFSRUNMASK_BITS2_0) || \
145 ((VALUE) == DAC_LFSRUNMASK_BITS3_0) || \
146 ((VALUE) == DAC_LFSRUNMASK_BITS4_0) || \
147 ((VALUE) == DAC_LFSRUNMASK_BITS5_0) || \
148 ((VALUE) == DAC_LFSRUNMASK_BITS6_0) || \
149 ((VALUE) == DAC_LFSRUNMASK_BITS7_0) || \
150 ((VALUE) == DAC_LFSRUNMASK_BITS8_0) || \
151 ((VALUE) == DAC_LFSRUNMASK_BITS9_0) || \
152 ((VALUE) == DAC_LFSRUNMASK_BITS10_0) || \
153 ((VALUE) == DAC_LFSRUNMASK_BITS11_0) || \
154 ((VALUE) == DAC_TRIANGLEAMPLITUDE_1) || \
155 ((VALUE) == DAC_TRIANGLEAMPLITUDE_3) || \
156 ((VALUE) == DAC_TRIANGLEAMPLITUDE_7) || \
157 ((VALUE) == DAC_TRIANGLEAMPLITUDE_15) || \
158 ((VALUE) == DAC_TRIANGLEAMPLITUDE_31) || \
159 ((VALUE) == DAC_TRIANGLEAMPLITUDE_63) || \
160 ((VALUE) == DAC_TRIANGLEAMPLITUDE_127) || \
161 ((VALUE) == DAC_TRIANGLEAMPLITUDE_255) || \
162 ((VALUE) == DAC_TRIANGLEAMPLITUDE_511) || \
163 ((VALUE) == DAC_TRIANGLEAMPLITUDE_1023) || \
164 ((VALUE) == DAC_TRIANGLEAMPLITUDE_2047) || \
165 ((VALUE) == DAC_TRIANGLEAMPLITUDE_4095))
166 /**
167 * @}
168 */
169
170 /* Private functions ---------------------------------------------------------*/
171 /** @defgroup DACEx_Private_Functions DAC Private Functions
172 * @{
173 */
174 void DAC_DMAConvCpltCh2(DMA_HandleTypeDef *hdma);
175 void DAC_DMAErrorCh2(DMA_HandleTypeDef *hdma);
176 void DAC_DMAHalfConvCpltCh2(DMA_HandleTypeDef *hdma);
177 /**
178 * @}
179 */
180 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx ||\
181 STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||\
182 STM32F410xx || STM32F446xx || STM32F469xx || STM32F479xx ||\
183 STM32F413xx || STM32F423xx */
184
185 /**
186 * @}
187 */
188
189 /**
190 * @}
191 */
192
193 #ifdef __cplusplus
194 }
195 #endif
196
197 #endif /*__STM32F4xx_HAL_DAC_EX_H */
198
199 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/