meh

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed May 13 08:08:21 2015 +0200
Revision:
99:dbbf35b96557
Parent:
90:cb3d968589d8
Child:
106:ba1f97679dad
Release 99 of the mbed library

Changes:
- new targets - MAXWSNENV, DISCO_L053C8
- STM32F4xx - ST Cube driver
- KSDK mcu - SPI timing fix
- Nordic - update to softdevice s130

Who changed what in which revision?

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