1 /**
2   ******************************************************************************
3   * @file    stm32l0xx_hal_dac_ex.h
4   * @author  MCD Application Team
5   * @brief   Header file of DAC HAL Extension module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2016 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   ******************************************************************************
17   */
18 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef __STM32L0xx_HAL_DAC_EX_H
21 #define __STM32L0xx_HAL_DAC_EX_H
22 
23 #ifdef __cplusplus
24  extern "C" {
25 #endif
26 
27 #if !defined(STM32L010xB) && !defined (STM32L010x8) && !defined (STM32L010x6) && !defined (STM32L010x4) && !defined (STM32L011xx) && !defined (STM32L021xx) && !defined (STM32L031xx) && !defined (STM32L041xx) && !defined (STM32L051xx) && !defined (STM32L071xx) && !defined (STM32L081xx)
28 
29 /* Includes ------------------------------------------------------------------*/
30 #include "stm32l0xx_hal_def.h"
31 
32 /** @addtogroup STM32L0xx_HAL_Driver
33   * @{
34   */
35 
36 /** @defgroup DACEx DACEx
37   * @{
38   */
39 
40 /* Exported types ------------------------------------------------------------*/
41 
42 /* Exported constants --------------------------------------------------------*/
43 
44 /** @defgroup DACEx_Exported_Constants DACEx Exported Constants
45   * @{
46   */
47 
48 /** @defgroup DACEx_lfsrunmask_triangleamplitude DACEx lfsrunmask triangleamplitude
49   * @{
50   */
51 #define DAC_LFSRUNMASK_BIT0                (0x00000000U) /*!< Unmask DAC channel LFSR bit0 for noise wave generation */
52 #define DAC_LFSRUNMASK_BITS1_0             (DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[1:0] for noise wave generation */
53 #define DAC_LFSRUNMASK_BITS2_0             (DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[2:0] for noise wave generation */
54 #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 */
55 #define DAC_LFSRUNMASK_BITS4_0             (DAC_CR_MAMP1_2) /*!< Unmask DAC channel LFSR bit[4:0] for noise wave generation */
56 #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 */
57 #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 */
58 #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 */
59 #define DAC_LFSRUNMASK_BITS8_0             (DAC_CR_MAMP1_3) /*!< Unmask DAC channel LFSR bit[8:0] for noise wave generation */
60 #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 */
61 #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 */
62 #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 */
63 #define DAC_TRIANGLEAMPLITUDE_1            (0x00000000U) /*!< Select max triangle amplitude of 1 */
64 #define DAC_TRIANGLEAMPLITUDE_3            (DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 3 */
65 #define DAC_TRIANGLEAMPLITUDE_7            (DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 7 */
66 #define DAC_TRIANGLEAMPLITUDE_15           ((uint32_t)DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 15 */
67 #define DAC_TRIANGLEAMPLITUDE_31           (DAC_CR_MAMP1_2) /*!< Select max triangle amplitude of 31 */
68 #define DAC_TRIANGLEAMPLITUDE_63           ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 63 */
69 #define DAC_TRIANGLEAMPLITUDE_127          ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 127 */
70 #define DAC_TRIANGLEAMPLITUDE_255          ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 255 */
71 #define DAC_TRIANGLEAMPLITUDE_511          (DAC_CR_MAMP1_3) /*!< Select max triangle amplitude of 511 */
72 #define DAC_TRIANGLEAMPLITUDE_1023         ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 1023 */
73 #define DAC_TRIANGLEAMPLITUDE_2047         ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 2047 */
74 #define DAC_TRIANGLEAMPLITUDE_4095         ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 4095 */
75 
76 #define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUNMASK_BIT0) || \
77                                                       ((VALUE) == DAC_LFSRUNMASK_BITS1_0) || \
78                                                       ((VALUE) == DAC_LFSRUNMASK_BITS2_0) || \
79                                                       ((VALUE) == DAC_LFSRUNMASK_BITS3_0) || \
80                                                       ((VALUE) == DAC_LFSRUNMASK_BITS4_0) || \
81                                                       ((VALUE) == DAC_LFSRUNMASK_BITS5_0) || \
82                                                       ((VALUE) == DAC_LFSRUNMASK_BITS6_0) || \
83                                                       ((VALUE) == DAC_LFSRUNMASK_BITS7_0) || \
84                                                       ((VALUE) == DAC_LFSRUNMASK_BITS8_0) || \
85                                                       ((VALUE) == DAC_LFSRUNMASK_BITS9_0) || \
86                                                       ((VALUE) == DAC_LFSRUNMASK_BITS10_0) || \
87                                                       ((VALUE) == DAC_LFSRUNMASK_BITS11_0) || \
88                                                       ((VALUE) == DAC_TRIANGLEAMPLITUDE_1) || \
89                                                       ((VALUE) == DAC_TRIANGLEAMPLITUDE_3) || \
90                                                       ((VALUE) == DAC_TRIANGLEAMPLITUDE_7) || \
91                                                       ((VALUE) == DAC_TRIANGLEAMPLITUDE_15) || \
92                                                       ((VALUE) == DAC_TRIANGLEAMPLITUDE_31) || \
93                                                       ((VALUE) == DAC_TRIANGLEAMPLITUDE_63) || \
94                                                       ((VALUE) == DAC_TRIANGLEAMPLITUDE_127) || \
95                                                       ((VALUE) == DAC_TRIANGLEAMPLITUDE_255) || \
96                                                       ((VALUE) == DAC_TRIANGLEAMPLITUDE_511) || \
97                                                       ((VALUE) == DAC_TRIANGLEAMPLITUDE_1023) || \
98                                                       ((VALUE) == DAC_TRIANGLEAMPLITUDE_2047) || \
99                                                       ((VALUE) == DAC_TRIANGLEAMPLITUDE_4095))
100 /**
101   * @}
102   */
103 
104 
105 /**
106   * @}
107   */
108 
109 /* Exported macro ------------------------------------------------------------*/
110 
111 /* Exported functions --------------------------------------------------------*/
112 
113 /** @defgroup DACEx_Exported_Functions DACEx Exported Functions
114   * @{
115   */
116 
117 /** @defgroup DACEx_Exported_Functions_Group1  Extended features functions
118   * @{
119   */
120 /* Extension features functions ***********************************************/
121 HAL_StatusTypeDef HAL_DACEx_TriangleWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Amplitude);
122 HAL_StatusTypeDef HAL_DACEx_NoiseWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Amplitude);
123 
124 #if defined (DAC_CHANNEL2_SUPPORT)
125 uint32_t HAL_DACEx_DualGetValue(DAC_HandleTypeDef* hdac);
126 HAL_StatusTypeDef HAL_DACEx_DualSetValue(DAC_HandleTypeDef* hdac, uint32_t Alignment, uint32_t Data1, uint32_t Data2);
127 void HAL_DACEx_ConvCpltCallbackCh2(DAC_HandleTypeDef* hdac);
128 void HAL_DACEx_ConvHalfCpltCallbackCh2(DAC_HandleTypeDef* hdac);
129 void HAL_DACEx_ErrorCallbackCh2(DAC_HandleTypeDef* hdac);
130 void HAL_DACEx_DMAUnderrunCallbackCh2(DAC_HandleTypeDef* hdac);
131 #endif
132 
133 /**
134   * @}
135   */
136 
137 /**
138   * @}
139   */
140 /* Define the private group ***********************************/
141 /**************************************************************/
142 /** @defgroup DACEx_Private DACEx Private
143   * @{
144   */
145 /**
146   * @}
147   */
148 /**************************************************************/
149 
150 /**
151   * @}
152   */
153 
154 /**
155   * @}
156   */
157 #endif /* !STM32L010xB && !STM32L010x8 && !STM32L010x6 && !STM32L010x4 && !STM32L011xx && !STM32L021xx && !STM32L031xx && !STM32L041xx && !STM32L051xx && !STM32L071xx && !STM32L081xx*/
158 
159 #ifdef __cplusplus
160 }
161 #endif
162 
163 #endif /*__STM32L0xx_HAL_DAC_EX_H */
164 
165 
166