my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
filartrix
Date:
Wed Apr 08 14:12:53 2015 +0000
Revision:
97:4298809c7c9e
Parent:
90:cb3d968589d8
First reale BlueNRG module for nucleo 401 board

Who changed what in which revision?

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