The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Thu Nov 27 13:33:22 2014 +0000
Revision:
92:4fc01daae5a5
Parent:
86:04dd9b1680ae
Release 92 of the mbed libray

Main changes:

- nRF51822: fixed pin assignment issues
- ST targets moving to the STM32Cube driver
- LPC1439: fixed serial interrupt issue
- first Cortex-A platform supported in mbed (RZ_A1H)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 86:04dd9b1680ae 1 /**
bogdanm 86:04dd9b1680ae 2 ******************************************************************************
bogdanm 86:04dd9b1680ae 3 * @file stm32f3xx_hal_sdadc.h
bogdanm 86:04dd9b1680ae 4 * @author MCD Application Team
bogdanm 92:4fc01daae5a5 5 * @version V1.1.0
bogdanm 92:4fc01daae5a5 6 * @date 12-Sept-2014
bogdanm 86:04dd9b1680ae 7 * @brief This file contains all the functions prototypes for the SDADC
bogdanm 86:04dd9b1680ae 8 * firmware library.
bogdanm 86:04dd9b1680ae 9 ******************************************************************************
bogdanm 86:04dd9b1680ae 10 * @attention
bogdanm 86:04dd9b1680ae 11 *
bogdanm 86:04dd9b1680ae 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
bogdanm 86:04dd9b1680ae 13 *
bogdanm 86:04dd9b1680ae 14 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 86:04dd9b1680ae 15 * are permitted provided that the following conditions are met:
bogdanm 86:04dd9b1680ae 16 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 86:04dd9b1680ae 17 * this list of conditions and the following disclaimer.
bogdanm 86:04dd9b1680ae 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 86:04dd9b1680ae 19 * this list of conditions and the following disclaimer in the documentation
bogdanm 86:04dd9b1680ae 20 * and/or other materials provided with the distribution.
bogdanm 86:04dd9b1680ae 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 86:04dd9b1680ae 22 * may be used to endorse or promote products derived from this software
bogdanm 86:04dd9b1680ae 23 * without specific prior written permission.
bogdanm 86:04dd9b1680ae 24 *
bogdanm 86:04dd9b1680ae 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 86:04dd9b1680ae 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 86:04dd9b1680ae 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 86:04dd9b1680ae 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 86:04dd9b1680ae 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 86:04dd9b1680ae 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 86:04dd9b1680ae 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 86:04dd9b1680ae 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 86:04dd9b1680ae 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 86:04dd9b1680ae 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 86:04dd9b1680ae 35 *
bogdanm 86:04dd9b1680ae 36 ******************************************************************************
bogdanm 86:04dd9b1680ae 37 */
bogdanm 86:04dd9b1680ae 38
bogdanm 86:04dd9b1680ae 39 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 86:04dd9b1680ae 40 #ifndef __STM32F3xx_SDADC_H
bogdanm 86:04dd9b1680ae 41 #define __STM32F3xx_SDADC_H
bogdanm 86:04dd9b1680ae 42
bogdanm 86:04dd9b1680ae 43 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 44 extern "C" {
bogdanm 86:04dd9b1680ae 45 #endif
bogdanm 86:04dd9b1680ae 46
bogdanm 86:04dd9b1680ae 47 #if defined(STM32F373xC) || defined(STM32F378xx)
bogdanm 86:04dd9b1680ae 48
bogdanm 86:04dd9b1680ae 49 /* Includes ------------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 50 #include "stm32f3xx_hal_def.h"
bogdanm 86:04dd9b1680ae 51
bogdanm 86:04dd9b1680ae 52 /** @addtogroup STM32F3xx_HAL_Driver
bogdanm 86:04dd9b1680ae 53 * @{
bogdanm 86:04dd9b1680ae 54 */
bogdanm 86:04dd9b1680ae 55
bogdanm 86:04dd9b1680ae 56 /** @addtogroup SDADC
bogdanm 86:04dd9b1680ae 57 * @{
bogdanm 86:04dd9b1680ae 58 */
bogdanm 86:04dd9b1680ae 59
bogdanm 86:04dd9b1680ae 60 /* Exported types ------------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 61 /** @defgroup SDADC_Exported_Types SDADC Exported Types
bogdanm 92:4fc01daae5a5 62 * @{
bogdanm 92:4fc01daae5a5 63 */
bogdanm 92:4fc01daae5a5 64
bogdanm 86:04dd9b1680ae 65
bogdanm 86:04dd9b1680ae 66 /**
bogdanm 86:04dd9b1680ae 67 * @brief HAL SDADC States definition
bogdanm 86:04dd9b1680ae 68 */
bogdanm 86:04dd9b1680ae 69 typedef enum
bogdanm 86:04dd9b1680ae 70 {
bogdanm 86:04dd9b1680ae 71 HAL_SDADC_STATE_RESET = 0x00, /*!< SDADC not initialized */
bogdanm 86:04dd9b1680ae 72 HAL_SDADC_STATE_READY = 0x01, /*!< SDADC initialized and ready for use */
bogdanm 86:04dd9b1680ae 73 HAL_SDADC_STATE_CALIB = 0x02, /*!< SDADC calibration in progress */
bogdanm 86:04dd9b1680ae 74 HAL_SDADC_STATE_REG = 0x03, /*!< SDADC regular conversion in progress */
bogdanm 86:04dd9b1680ae 75 HAL_SDADC_STATE_INJ = 0x04, /*!< SDADC injected conversion in progress */
bogdanm 86:04dd9b1680ae 76 HAL_SDADC_STATE_REG_INJ = 0x05, /*!< SDADC regular and injected conversions in progress */
bogdanm 86:04dd9b1680ae 77 HAL_SDADC_STATE_ERROR = 0xFF, /*!< SDADC state error */
bogdanm 86:04dd9b1680ae 78 }HAL_SDADC_StateTypeDef;
bogdanm 86:04dd9b1680ae 79
bogdanm 86:04dd9b1680ae 80 /**
bogdanm 86:04dd9b1680ae 81 * @brief SDADC Init Structure definition
bogdanm 86:04dd9b1680ae 82 */
bogdanm 86:04dd9b1680ae 83 typedef struct
bogdanm 86:04dd9b1680ae 84 {
bogdanm 86:04dd9b1680ae 85 uint32_t IdleLowPowerMode; /*!< Specifies if SDADC can enter in power down or standby when idle.
bogdanm 86:04dd9b1680ae 86 This parameter can be a value of @ref SDADC_Idle_Low_Power_Mode */
bogdanm 86:04dd9b1680ae 87 uint32_t FastConversionMode; /*!< Specifies if Fast conversion mode is enabled or not.
bogdanm 86:04dd9b1680ae 88 This parameter can be a value of @ref SDADC_Fast_Conv_Mode */
bogdanm 86:04dd9b1680ae 89 uint32_t SlowClockMode; /*!< Specifies if slow clock mode is enabled or not.
bogdanm 86:04dd9b1680ae 90 This parameter can be a value of @ref SDADC_Slow_Clock_Mode */
bogdanm 86:04dd9b1680ae 91 uint32_t ReferenceVoltage; /*!< Specifies the reference voltage.
bogdanm 86:04dd9b1680ae 92 This parameter can be a value of @ref SDADC_Reference_Voltage */
bogdanm 86:04dd9b1680ae 93 }SDADC_InitTypeDef;
bogdanm 86:04dd9b1680ae 94
bogdanm 86:04dd9b1680ae 95 /**
bogdanm 86:04dd9b1680ae 96 * @brief SDADC handle Structure definition
bogdanm 86:04dd9b1680ae 97 */
bogdanm 86:04dd9b1680ae 98 typedef struct
bogdanm 86:04dd9b1680ae 99 {
bogdanm 86:04dd9b1680ae 100 SDADC_TypeDef *Instance; /*!< SDADC registers base address */
bogdanm 86:04dd9b1680ae 101 SDADC_InitTypeDef Init; /*!< SDADC init parameters */
bogdanm 86:04dd9b1680ae 102 DMA_HandleTypeDef *hdma; /*!< SDADC DMA Handle parameters */
bogdanm 86:04dd9b1680ae 103 uint32_t RegularContMode; /*!< Regular conversion continuous mode */
bogdanm 86:04dd9b1680ae 104 uint32_t InjectedContMode; /*!< Injected conversion continuous mode */
bogdanm 86:04dd9b1680ae 105 uint32_t InjectedChannelsNbr; /*!< Number of channels in injected sequence */
bogdanm 86:04dd9b1680ae 106 uint32_t InjConvRemaining; /*!< Injected conversion remaining */
bogdanm 86:04dd9b1680ae 107 uint32_t RegularTrigger; /*!< Current trigger used for regular conversion */
bogdanm 86:04dd9b1680ae 108 uint32_t InjectedTrigger; /*!< Current trigger used for injected conversion */
bogdanm 86:04dd9b1680ae 109 uint32_t ExtTriggerEdge; /*!< Rising, falling or both edges selected */
bogdanm 86:04dd9b1680ae 110 uint32_t RegularMultimode; /*!< current type of regular multimode */
bogdanm 86:04dd9b1680ae 111 uint32_t InjectedMultimode; /*!< Current type of injected multimode */
bogdanm 86:04dd9b1680ae 112 HAL_SDADC_StateTypeDef State; /*!< SDADC state */
bogdanm 86:04dd9b1680ae 113 uint32_t ErrorCode; /*!< SDADC Error code */
bogdanm 86:04dd9b1680ae 114 }SDADC_HandleTypeDef;
bogdanm 86:04dd9b1680ae 115
bogdanm 86:04dd9b1680ae 116 /**
bogdanm 86:04dd9b1680ae 117 * @brief SDADC Configuration Register Parameter Structure
bogdanm 86:04dd9b1680ae 118 */
bogdanm 86:04dd9b1680ae 119 typedef struct
bogdanm 86:04dd9b1680ae 120 {
bogdanm 86:04dd9b1680ae 121 uint32_t InputMode; /*!< Specifies the input mode (single ended, differential...)
bogdanm 86:04dd9b1680ae 122 This parameter can be any value of @ref SDADC_InputMode */
bogdanm 86:04dd9b1680ae 123 uint32_t Gain; /*!< Specifies the gain setting.
bogdanm 86:04dd9b1680ae 124 This parameter can be any value of @ref SDADC_Gain */
bogdanm 86:04dd9b1680ae 125 uint32_t CommonMode; /*!< Specifies the common mode setting (VSSA, VDDA, VDDA/2).
bogdanm 86:04dd9b1680ae 126 This parameter can be any value of @ref SDADC_CommonMode */
bogdanm 86:04dd9b1680ae 127 uint32_t Offset; /*!< Specifies the 12-bit offset value.
bogdanm 86:04dd9b1680ae 128 This parameter can be any value lower or equal to 0x00000FFF */
bogdanm 86:04dd9b1680ae 129 }SDADC_ConfParamTypeDef;
bogdanm 86:04dd9b1680ae 130
bogdanm 92:4fc01daae5a5 131 /**
bogdanm 92:4fc01daae5a5 132 * @}
bogdanm 92:4fc01daae5a5 133 */
bogdanm 92:4fc01daae5a5 134
bogdanm 92:4fc01daae5a5 135 /* Exported constants --------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 136
bogdanm 92:4fc01daae5a5 137 /** @defgroup SDADC_Exported_Constants SDADC Exported Constants
bogdanm 92:4fc01daae5a5 138 * @{
bogdanm 92:4fc01daae5a5 139 */
bogdanm 92:4fc01daae5a5 140
bogdanm 92:4fc01daae5a5 141 /** @defgroup SDADC_Idle_Low_Power_Mode SDADC Idle Low Power Mode
bogdanm 86:04dd9b1680ae 142 * @{
bogdanm 86:04dd9b1680ae 143 */
bogdanm 86:04dd9b1680ae 144 #define SDADC_LOWPOWER_NONE ((uint32_t)0x00000000)
bogdanm 86:04dd9b1680ae 145 #define SDADC_LOWPOWER_POWERDOWN SDADC_CR1_PDI
bogdanm 86:04dd9b1680ae 146 #define SDADC_LOWPOWER_STANDBY SDADC_CR1_SBI
bogdanm 86:04dd9b1680ae 147 #define IS_SDADC_LOWPOWER_MODE(LOWPOWER) (((LOWPOWER) == SDADC_LOWPOWER_NONE) || \
bogdanm 86:04dd9b1680ae 148 ((LOWPOWER) == SDADC_LOWPOWER_POWERDOWN) || \
bogdanm 86:04dd9b1680ae 149 ((LOWPOWER) == SDADC_LOWPOWER_STANDBY))
bogdanm 86:04dd9b1680ae 150 /**
bogdanm 86:04dd9b1680ae 151 * @}
bogdanm 86:04dd9b1680ae 152 */
bogdanm 86:04dd9b1680ae 153
bogdanm 92:4fc01daae5a5 154 /** @defgroup SDADC_Fast_Conv_Mode SDADC Fast Conversion Mode
bogdanm 86:04dd9b1680ae 155 * @{
bogdanm 86:04dd9b1680ae 156 */
bogdanm 86:04dd9b1680ae 157 #define SDADC_FAST_CONV_DISABLE ((uint32_t)0x00000000)
bogdanm 86:04dd9b1680ae 158 #define SDADC_FAST_CONV_ENABLE SDADC_CR2_FAST
bogdanm 86:04dd9b1680ae 159 #define IS_SDADC_FAST_CONV_MODE(FAST) (((FAST) == SDADC_FAST_CONV_DISABLE) || \
bogdanm 86:04dd9b1680ae 160 ((FAST) == SDADC_FAST_CONV_ENABLE))
bogdanm 86:04dd9b1680ae 161 /**
bogdanm 86:04dd9b1680ae 162 * @}
bogdanm 86:04dd9b1680ae 163 */
bogdanm 86:04dd9b1680ae 164
bogdanm 92:4fc01daae5a5 165 /** @defgroup SDADC_Slow_Clock_Mode SDADC Slow Clock Mode
bogdanm 86:04dd9b1680ae 166 * @{
bogdanm 86:04dd9b1680ae 167 */
bogdanm 86:04dd9b1680ae 168 #define SDADC_SLOW_CLOCK_DISABLE ((uint32_t)0x00000000)
bogdanm 86:04dd9b1680ae 169 #define SDADC_SLOW_CLOCK_ENABLE SDADC_CR1_SLOWCK
bogdanm 86:04dd9b1680ae 170 #define IS_SDADC_SLOW_CLOCK_MODE(MODE) (((MODE) == SDADC_SLOW_CLOCK_DISABLE) || \
bogdanm 86:04dd9b1680ae 171 ((MODE) == SDADC_SLOW_CLOCK_ENABLE))
bogdanm 86:04dd9b1680ae 172 /**
bogdanm 86:04dd9b1680ae 173 * @}
bogdanm 86:04dd9b1680ae 174 */
bogdanm 86:04dd9b1680ae 175
bogdanm 92:4fc01daae5a5 176 /** @defgroup SDADC_Reference_Voltage SDADC Reference Voltage
bogdanm 86:04dd9b1680ae 177 * @{
bogdanm 86:04dd9b1680ae 178 */
bogdanm 86:04dd9b1680ae 179 #define SDADC_VREF_EXT ((uint32_t)0x00000000) /*!< The reference voltage is forced externally using VREF pin */
bogdanm 86:04dd9b1680ae 180 #define SDADC_VREF_VREFINT1 SDADC_CR1_REFV_0 /*!< The reference voltage is forced internally to 1.22V VREFINT */
bogdanm 86:04dd9b1680ae 181 #define SDADC_VREF_VREFINT2 SDADC_CR1_REFV_1 /*!< The reference voltage is forced internally to 1.8V VREFINT */
bogdanm 86:04dd9b1680ae 182 #define SDADC_VREF_VDDA SDADC_CR1_REFV /*!< The reference voltage is forced internally to VDDA */
bogdanm 86:04dd9b1680ae 183 #define IS_SDADC_VREF(VREF) (((VREF) == SDADC_VREF_EXT) || \
bogdanm 86:04dd9b1680ae 184 ((VREF) == SDADC_VREF_VREFINT1) || \
bogdanm 86:04dd9b1680ae 185 ((VREF) == SDADC_VREF_VREFINT2) || \
bogdanm 86:04dd9b1680ae 186 ((VREF) == SDADC_VREF_VDDA))
bogdanm 86:04dd9b1680ae 187 /**
bogdanm 86:04dd9b1680ae 188 * @}
bogdanm 86:04dd9b1680ae 189 */
bogdanm 86:04dd9b1680ae 190
bogdanm 92:4fc01daae5a5 191 /** @defgroup SDADC_ConfIndex SDADC Configuration Index
bogdanm 86:04dd9b1680ae 192 * @{
bogdanm 86:04dd9b1680ae 193 */
bogdanm 86:04dd9b1680ae 194
bogdanm 86:04dd9b1680ae 195 #define SDADC_CONF_INDEX_0 ((uint32_t)0x00000000) /*!< Configuration 0 Register selected */
bogdanm 86:04dd9b1680ae 196 #define SDADC_CONF_INDEX_1 ((uint32_t)0x00000001) /*!< Configuration 1 Register selected */
bogdanm 86:04dd9b1680ae 197 #define SDADC_CONF_INDEX_2 ((uint32_t)0x00000002) /*!< Configuration 2 Register selected */
bogdanm 86:04dd9b1680ae 198
bogdanm 86:04dd9b1680ae 199 #define IS_SDADC_CONF_INDEX(CONF) (((CONF) == SDADC_CONF_INDEX_0) || \
bogdanm 86:04dd9b1680ae 200 ((CONF) == SDADC_CONF_INDEX_1) || \
bogdanm 86:04dd9b1680ae 201 ((CONF) == SDADC_CONF_INDEX_2))
bogdanm 86:04dd9b1680ae 202 /**
bogdanm 86:04dd9b1680ae 203 * @}
bogdanm 86:04dd9b1680ae 204 */
bogdanm 86:04dd9b1680ae 205
bogdanm 92:4fc01daae5a5 206 /** @defgroup SDADC_InputMode SDADC Input Mode
bogdanm 86:04dd9b1680ae 207 * @{
bogdanm 86:04dd9b1680ae 208 */
bogdanm 86:04dd9b1680ae 209 #define SDADC_INPUT_MODE_DIFF ((uint32_t)0x00000000) /*!< Conversions are executed in differential mode */
bogdanm 86:04dd9b1680ae 210 #define SDADC_INPUT_MODE_SE_OFFSET SDADC_CONF0R_SE0_0 /*!< Conversions are executed in single ended offset mode */
bogdanm 86:04dd9b1680ae 211 #define SDADC_INPUT_MODE_SE_ZERO_REFERENCE SDADC_CONF0R_SE0 /*!< Conversions are executed in single ended zero-volt reference mode */
bogdanm 86:04dd9b1680ae 212
bogdanm 86:04dd9b1680ae 213 #define IS_SDADC_INPUT_MODE(MODE) (((MODE) == SDADC_INPUT_MODE_DIFF) || \
bogdanm 86:04dd9b1680ae 214 ((MODE) == SDADC_INPUT_MODE_SE_OFFSET) || \
bogdanm 86:04dd9b1680ae 215 ((MODE) == SDADC_INPUT_MODE_SE_ZERO_REFERENCE))
bogdanm 86:04dd9b1680ae 216 /**
bogdanm 86:04dd9b1680ae 217 * @}
bogdanm 86:04dd9b1680ae 218 */
bogdanm 86:04dd9b1680ae 219
bogdanm 92:4fc01daae5a5 220 /** @defgroup SDADC_Gain SDADC Gain
bogdanm 86:04dd9b1680ae 221 * @{
bogdanm 86:04dd9b1680ae 222 */
bogdanm 86:04dd9b1680ae 223 #define SDADC_GAIN_1 ((uint32_t)0x00000000) /*!< Gain equal to 1 */
bogdanm 86:04dd9b1680ae 224 #define SDADC_GAIN_2 SDADC_CONF0R_GAIN0_0 /*!< Gain equal to 2 */
bogdanm 86:04dd9b1680ae 225 #define SDADC_GAIN_4 SDADC_CONF0R_GAIN0_1 /*!< Gain equal to 4 */
bogdanm 86:04dd9b1680ae 226 #define SDADC_GAIN_8 ((uint32_t)0x00300000) /*!< Gain equal to 8 */
bogdanm 86:04dd9b1680ae 227 #define SDADC_GAIN_16 SDADC_CONF0R_GAIN0_2 /*!< Gain equal to 16 */
bogdanm 86:04dd9b1680ae 228 #define SDADC_GAIN_32 ((uint32_t)0x00500000) /*!< Gain equal to 32 */
bogdanm 86:04dd9b1680ae 229 #define SDADC_GAIN_1_2 SDADC_CONF0R_GAIN0 /*!< Gain equal to 1/2 */
bogdanm 86:04dd9b1680ae 230 #define IS_SDADC_GAIN(GAIN) (((GAIN) == SDADC_GAIN_1) || \
bogdanm 86:04dd9b1680ae 231 ((GAIN) == SDADC_GAIN_2) || \
bogdanm 86:04dd9b1680ae 232 ((GAIN) == SDADC_GAIN_4) || \
bogdanm 86:04dd9b1680ae 233 ((GAIN) == SDADC_GAIN_8) || \
bogdanm 86:04dd9b1680ae 234 ((GAIN) == SDADC_GAIN_16) || \
bogdanm 86:04dd9b1680ae 235 ((GAIN) == SDADC_GAIN_32) || \
bogdanm 86:04dd9b1680ae 236 ((GAIN) == SDADC_GAIN_1_2))
bogdanm 86:04dd9b1680ae 237 /**
bogdanm 86:04dd9b1680ae 238 * @}
bogdanm 86:04dd9b1680ae 239 */
bogdanm 86:04dd9b1680ae 240
bogdanm 92:4fc01daae5a5 241 /** @defgroup SDADC_CommonMode SDADC Common Mode
bogdanm 86:04dd9b1680ae 242 * @{
bogdanm 86:04dd9b1680ae 243 */
bogdanm 86:04dd9b1680ae 244 #define SDADC_COMMON_MODE_VSSA ((uint32_t)0x00000000) /*!< Select SDADC VSSA as common mode */
bogdanm 86:04dd9b1680ae 245 #define SDADC_COMMON_MODE_VDDA_2 SDADC_CONF0R_COMMON0_0 /*!< Select SDADC VDDA/2 as common mode */
bogdanm 86:04dd9b1680ae 246 #define SDADC_COMMON_MODE_VDDA SDADC_CONF0R_COMMON0_1 /*!< Select SDADC VDDA as common mode */
bogdanm 86:04dd9b1680ae 247 #define IS_SDADC_COMMON_MODE(MODE) (((MODE) == SDADC_COMMON_MODE_VSSA) || \
bogdanm 86:04dd9b1680ae 248 ((MODE) == SDADC_COMMON_MODE_VDDA_2) || \
bogdanm 86:04dd9b1680ae 249 ((MODE) == SDADC_COMMON_MODE_VDDA))
bogdanm 86:04dd9b1680ae 250 /**
bogdanm 86:04dd9b1680ae 251 * @}
bogdanm 86:04dd9b1680ae 252 */
bogdanm 86:04dd9b1680ae 253
bogdanm 92:4fc01daae5a5 254 /** @defgroup SDADC_Offset SDADC Offset
bogdanm 86:04dd9b1680ae 255 * @{
bogdanm 86:04dd9b1680ae 256 */
bogdanm 86:04dd9b1680ae 257 #define IS_SDADC_OFFSET_VALUE(VALUE) ((VALUE) <= 0x00000FFF)
bogdanm 86:04dd9b1680ae 258 /**
bogdanm 86:04dd9b1680ae 259 * @}
bogdanm 86:04dd9b1680ae 260 */
bogdanm 86:04dd9b1680ae 261
bogdanm 92:4fc01daae5a5 262 /** @defgroup SDADC_Channel_Selection SDADC Channel Selection
bogdanm 86:04dd9b1680ae 263 * @{
bogdanm 86:04dd9b1680ae 264 */
bogdanm 86:04dd9b1680ae 265
bogdanm 86:04dd9b1680ae 266 /* SDADC Channels ------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 267 /* The SDADC channels are defined as follows:
bogdanm 86:04dd9b1680ae 268 - in 16-bit LSB the channel mask is set
bogdanm 86:04dd9b1680ae 269 - in 16-bit MSB the channel number is set
bogdanm 86:04dd9b1680ae 270 e.g. for channel 5 definition:
bogdanm 86:04dd9b1680ae 271 - the channel mask is 0x00000020 (bit 5 is set)
bogdanm 86:04dd9b1680ae 272 - the channel number 5 is 0x00050000
bogdanm 86:04dd9b1680ae 273 --> Consequently, channel 5 definition is 0x00000020 | 0x00050000 = 0x00050020 */
bogdanm 86:04dd9b1680ae 274 #define SDADC_CHANNEL_0 ((uint32_t)0x00000001)
bogdanm 86:04dd9b1680ae 275 #define SDADC_CHANNEL_1 ((uint32_t)0x00010002)
bogdanm 86:04dd9b1680ae 276 #define SDADC_CHANNEL_2 ((uint32_t)0x00020004)
bogdanm 86:04dd9b1680ae 277 #define SDADC_CHANNEL_3 ((uint32_t)0x00030008)
bogdanm 86:04dd9b1680ae 278 #define SDADC_CHANNEL_4 ((uint32_t)0x00040010)
bogdanm 86:04dd9b1680ae 279 #define SDADC_CHANNEL_5 ((uint32_t)0x00050020)
bogdanm 86:04dd9b1680ae 280 #define SDADC_CHANNEL_6 ((uint32_t)0x00060040)
bogdanm 86:04dd9b1680ae 281 #define SDADC_CHANNEL_7 ((uint32_t)0x00070080)
bogdanm 86:04dd9b1680ae 282 #define SDADC_CHANNEL_8 ((uint32_t)0x00080100)
bogdanm 86:04dd9b1680ae 283
bogdanm 86:04dd9b1680ae 284 /* Just one channel of the 9 channels can be selected for regular conversion */
bogdanm 86:04dd9b1680ae 285 #define IS_SDADC_REGULAR_CHANNEL(CHANNEL) (((CHANNEL) == SDADC_CHANNEL_0) || \
bogdanm 86:04dd9b1680ae 286 ((CHANNEL) == SDADC_CHANNEL_1) || \
bogdanm 86:04dd9b1680ae 287 ((CHANNEL) == SDADC_CHANNEL_2) || \
bogdanm 86:04dd9b1680ae 288 ((CHANNEL) == SDADC_CHANNEL_3) || \
bogdanm 86:04dd9b1680ae 289 ((CHANNEL) == SDADC_CHANNEL_4) || \
bogdanm 86:04dd9b1680ae 290 ((CHANNEL) == SDADC_CHANNEL_5) || \
bogdanm 86:04dd9b1680ae 291 ((CHANNEL) == SDADC_CHANNEL_6) || \
bogdanm 86:04dd9b1680ae 292 ((CHANNEL) == SDADC_CHANNEL_7) || \
bogdanm 86:04dd9b1680ae 293 ((CHANNEL) == SDADC_CHANNEL_8))
bogdanm 86:04dd9b1680ae 294
bogdanm 86:04dd9b1680ae 295 /* Any or all of the 9 channels can be selected for injected conversion */
bogdanm 86:04dd9b1680ae 296 #define IS_SDADC_INJECTED_CHANNEL(CHANNEL) (((CHANNEL) != 0) && ((CHANNEL) <= 0x000F01FF))
bogdanm 86:04dd9b1680ae 297
bogdanm 86:04dd9b1680ae 298 /**
bogdanm 86:04dd9b1680ae 299 * @}
bogdanm 86:04dd9b1680ae 300 */
bogdanm 86:04dd9b1680ae 301
bogdanm 92:4fc01daae5a5 302 /** @defgroup SDADC_CalibrationSequence SDADC Calibration Sequence
bogdanm 86:04dd9b1680ae 303 * @{
bogdanm 86:04dd9b1680ae 304 */
bogdanm 86:04dd9b1680ae 305 #define SDADC_CALIBRATION_SEQ_1 ((uint32_t)0x00000000) /*!< One calibration sequence to calculate offset of conf0 (OFFSET0[11:0]) */
bogdanm 86:04dd9b1680ae 306 #define SDADC_CALIBRATION_SEQ_2 SDADC_CR2_CALIBCNT_0 /*!< Two calibration sequences to calculate offset of conf0 and conf1 (OFFSET0[11:0] and OFFSET1[11:0]) */
bogdanm 86:04dd9b1680ae 307 #define SDADC_CALIBRATION_SEQ_3 SDADC_CR2_CALIBCNT_1 /*!< Three calibration sequences to calculate offset of conf0, conf1 and conf2 (OFFSET0[11:0], OFFSET1[11:0], and OFFSET2[11:0]) */
bogdanm 86:04dd9b1680ae 308
bogdanm 86:04dd9b1680ae 309 #define IS_SDADC_CALIB_SEQUENCE(SEQUENCE) (((SEQUENCE) == SDADC_CALIBRATION_SEQ_1) || \
bogdanm 86:04dd9b1680ae 310 ((SEQUENCE) == SDADC_CALIBRATION_SEQ_2) || \
bogdanm 86:04dd9b1680ae 311 ((SEQUENCE) == SDADC_CALIBRATION_SEQ_3))
bogdanm 86:04dd9b1680ae 312 /**
bogdanm 86:04dd9b1680ae 313 * @}
bogdanm 86:04dd9b1680ae 314 */
bogdanm 86:04dd9b1680ae 315
bogdanm 92:4fc01daae5a5 316 /** @defgroup SDADC_ContinuousMode SDADC Continuous Mode
bogdanm 86:04dd9b1680ae 317 * @{
bogdanm 86:04dd9b1680ae 318 */
bogdanm 86:04dd9b1680ae 319 #define SDADC_CONTINUOUS_CONV_OFF ((uint32_t)0x00000000) /*!< Conversion are not continuous */
bogdanm 86:04dd9b1680ae 320 #define SDADC_CONTINUOUS_CONV_ON ((uint32_t)0x00000001) /*!< Conversion are continuous */
bogdanm 86:04dd9b1680ae 321
bogdanm 86:04dd9b1680ae 322 #define IS_SDADC_CONTINUOUS_MODE(MODE) (((MODE) == SDADC_CONTINUOUS_CONV_OFF) || \
bogdanm 86:04dd9b1680ae 323 ((MODE) == SDADC_CONTINUOUS_CONV_ON))
bogdanm 86:04dd9b1680ae 324 /**
bogdanm 86:04dd9b1680ae 325 * @}
bogdanm 86:04dd9b1680ae 326 */
bogdanm 86:04dd9b1680ae 327
bogdanm 92:4fc01daae5a5 328 /** @defgroup SDADC_Trigger SDADC Trigger
bogdanm 86:04dd9b1680ae 329 * @{
bogdanm 86:04dd9b1680ae 330 */
bogdanm 86:04dd9b1680ae 331 #define SDADC_SOFTWARE_TRIGGER ((uint32_t)0x00000000) /*!< Software trigger */
bogdanm 86:04dd9b1680ae 332 #define SDADC_SYNCHRONOUS_TRIGGER ((uint32_t)0x00000001) /*!< Synchronous with SDADC1 (only for SDADC2 and SDADC3) */
bogdanm 86:04dd9b1680ae 333 #define SDADC_EXTERNAL_TRIGGER ((uint32_t)0x00000002) /*!< External trigger */
bogdanm 86:04dd9b1680ae 334
bogdanm 86:04dd9b1680ae 335 #define IS_SDADC_REGULAR_TRIGGER(TRIGGER) (((TRIGGER) == SDADC_SOFTWARE_TRIGGER) || \
bogdanm 86:04dd9b1680ae 336 ((TRIGGER) == SDADC_SYNCHRONOUS_TRIGGER))
bogdanm 86:04dd9b1680ae 337
bogdanm 86:04dd9b1680ae 338 #define IS_SDADC_INJECTED_TRIGGER(TRIGGER) (((TRIGGER) == SDADC_SOFTWARE_TRIGGER) || \
bogdanm 86:04dd9b1680ae 339 ((TRIGGER) == SDADC_SYNCHRONOUS_TRIGGER) || \
bogdanm 86:04dd9b1680ae 340 ((TRIGGER) == SDADC_EXTERNAL_TRIGGER))
bogdanm 86:04dd9b1680ae 341 /**
bogdanm 86:04dd9b1680ae 342 * @}
bogdanm 86:04dd9b1680ae 343 */
bogdanm 86:04dd9b1680ae 344
bogdanm 92:4fc01daae5a5 345 /** @defgroup SDADC_InjectedExtTrigger SDADC Injected External Trigger
bogdanm 86:04dd9b1680ae 346 * @{
bogdanm 86:04dd9b1680ae 347 */
bogdanm 86:04dd9b1680ae 348 #define SDADC_EXT_TRIG_TIM13_CC1 ((uint32_t)0x00000000) /*!< Trigger source for SDADC1 */
bogdanm 86:04dd9b1680ae 349 #define SDADC_EXT_TRIG_TIM14_CC1 ((uint32_t)0x00000100) /*!< Trigger source for SDADC1 */
bogdanm 86:04dd9b1680ae 350 #define SDADC_EXT_TRIG_TIM16_CC1 ((uint32_t)0x00000000) /*!< Trigger source for SDADC3 */
bogdanm 86:04dd9b1680ae 351 #define SDADC_EXT_TRIG_TIM17_CC1 ((uint32_t)0x00000000) /*!< Trigger source for SDADC2 */
bogdanm 86:04dd9b1680ae 352 #define SDADC_EXT_TRIG_TIM12_CC1 ((uint32_t)0x00000100) /*!< Trigger source for SDADC2 */
bogdanm 86:04dd9b1680ae 353 #define SDADC_EXT_TRIG_TIM12_CC2 ((uint32_t)0x00000100) /*!< Trigger source for SDADC3 */
bogdanm 86:04dd9b1680ae 354 #define SDADC_EXT_TRIG_TIM15_CC2 ((uint32_t)0x00000200) /*!< Trigger source for SDADC1 */
bogdanm 86:04dd9b1680ae 355 #define SDADC_EXT_TRIG_TIM2_CC3 ((uint32_t)0x00000200) /*!< Trigger source for SDADC2 */
bogdanm 86:04dd9b1680ae 356 #define SDADC_EXT_TRIG_TIM2_CC4 ((uint32_t)0x00000200) /*!< Trigger source for SDADC3 */
bogdanm 86:04dd9b1680ae 357 #define SDADC_EXT_TRIG_TIM3_CC1 ((uint32_t)0x00000300) /*!< Trigger source for SDADC1 */
bogdanm 86:04dd9b1680ae 358 #define SDADC_EXT_TRIG_TIM3_CC2 ((uint32_t)0x00000300) /*!< Trigger source for SDADC2 */
bogdanm 86:04dd9b1680ae 359 #define SDADC_EXT_TRIG_TIM3_CC3 ((uint32_t)0x00000300) /*!< Trigger source for SDADC3 */
bogdanm 86:04dd9b1680ae 360 #define SDADC_EXT_TRIG_TIM4_CC1 ((uint32_t)0x00000400) /*!< Trigger source for SDADC1 */
bogdanm 86:04dd9b1680ae 361 #define SDADC_EXT_TRIG_TIM4_CC2 ((uint32_t)0x00000400) /*!< Trigger source for SDADC2 */
bogdanm 86:04dd9b1680ae 362 #define SDADC_EXT_TRIG_TIM4_CC3 ((uint32_t)0x00000400) /*!< Trigger source for SDADC3 */
bogdanm 86:04dd9b1680ae 363 #define SDADC_EXT_TRIG_TIM19_CC2 ((uint32_t)0x00000500) /*!< Trigger source for SDADC1 */
bogdanm 86:04dd9b1680ae 364 #define SDADC_EXT_TRIG_TIM19_CC3 ((uint32_t)0x00000500) /*!< Trigger source for SDADC2 */
bogdanm 86:04dd9b1680ae 365 #define SDADC_EXT_TRIG_TIM19_CC4 ((uint32_t)0x00000500) /*!< Trigger source for SDADC3 */
bogdanm 86:04dd9b1680ae 366 #define SDADC_EXT_TRIG_EXTI11 ((uint32_t)0x00000700) /*!< Trigger source for SDADC1, SDADC2 and SDADC3 */
bogdanm 86:04dd9b1680ae 367 #define SDADC_EXT_TRIG_EXTI15 ((uint32_t)0x00000600) /*!< Trigger source for SDADC1, SDADC2 and SDADC3 */
bogdanm 86:04dd9b1680ae 368
bogdanm 86:04dd9b1680ae 369 #define IS_SDADC_EXT_INJEC_TRIG(INJTRIG) (((INJTRIG) == SDADC_EXT_TRIG_TIM13_CC1) || \
bogdanm 86:04dd9b1680ae 370 ((INJTRIG) == SDADC_EXT_TRIG_TIM14_CC1) || \
bogdanm 86:04dd9b1680ae 371 ((INJTRIG) == SDADC_EXT_TRIG_TIM16_CC1) || \
bogdanm 86:04dd9b1680ae 372 ((INJTRIG) == SDADC_EXT_TRIG_TIM17_CC1) || \
bogdanm 86:04dd9b1680ae 373 ((INJTRIG) == SDADC_EXT_TRIG_TIM12_CC1) || \
bogdanm 86:04dd9b1680ae 374 ((INJTRIG) == SDADC_EXT_TRIG_TIM12_CC2) || \
bogdanm 86:04dd9b1680ae 375 ((INJTRIG) == SDADC_EXT_TRIG_TIM15_CC2) || \
bogdanm 86:04dd9b1680ae 376 ((INJTRIG) == SDADC_EXT_TRIG_TIM2_CC3) || \
bogdanm 86:04dd9b1680ae 377 ((INJTRIG) == SDADC_EXT_TRIG_TIM2_CC4) || \
bogdanm 86:04dd9b1680ae 378 ((INJTRIG) == SDADC_EXT_TRIG_TIM3_CC1) || \
bogdanm 86:04dd9b1680ae 379 ((INJTRIG) == SDADC_EXT_TRIG_TIM3_CC2) || \
bogdanm 86:04dd9b1680ae 380 ((INJTRIG) == SDADC_EXT_TRIG_TIM3_CC3) || \
bogdanm 86:04dd9b1680ae 381 ((INJTRIG) == SDADC_EXT_TRIG_TIM4_CC1) || \
bogdanm 86:04dd9b1680ae 382 ((INJTRIG) == SDADC_EXT_TRIG_TIM4_CC2) || \
bogdanm 86:04dd9b1680ae 383 ((INJTRIG) == SDADC_EXT_TRIG_TIM4_CC3) || \
bogdanm 86:04dd9b1680ae 384 ((INJTRIG) == SDADC_EXT_TRIG_TIM19_CC2) || \
bogdanm 86:04dd9b1680ae 385 ((INJTRIG) == SDADC_EXT_TRIG_TIM19_CC3) || \
bogdanm 86:04dd9b1680ae 386 ((INJTRIG) == SDADC_EXT_TRIG_TIM19_CC4) || \
bogdanm 86:04dd9b1680ae 387 ((INJTRIG) == SDADC_EXT_TRIG_EXTI11) || \
bogdanm 86:04dd9b1680ae 388 ((INJTRIG) == SDADC_EXT_TRIG_EXTI15))
bogdanm 86:04dd9b1680ae 389 /**
bogdanm 86:04dd9b1680ae 390 * @}
bogdanm 86:04dd9b1680ae 391 */
bogdanm 86:04dd9b1680ae 392
bogdanm 92:4fc01daae5a5 393 /** @defgroup SDADC_ExtTriggerEdge SDADC External Trigger Edge
bogdanm 86:04dd9b1680ae 394 * @{
bogdanm 86:04dd9b1680ae 395 */
bogdanm 86:04dd9b1680ae 396 #define SDADC_EXT_TRIG_RISING_EDGE SDADC_CR2_JEXTEN_0 /*!< External rising edge */
bogdanm 86:04dd9b1680ae 397 #define SDADC_EXT_TRIG_FALLING_EDGE SDADC_CR2_JEXTEN_1 /*!< External falling edge */
bogdanm 86:04dd9b1680ae 398 #define SDADC_EXT_TRIG_BOTH_EDGES SDADC_CR2_JEXTEN /*!< External rising and falling edges */
bogdanm 86:04dd9b1680ae 399
bogdanm 86:04dd9b1680ae 400 #define IS_SDADC_EXT_TRIG_EDGE(TRIGGER) (((TRIGGER) == SDADC_EXT_TRIG_RISING_EDGE) || \
bogdanm 86:04dd9b1680ae 401 ((TRIGGER) == SDADC_EXT_TRIG_FALLING_EDGE) || \
bogdanm 86:04dd9b1680ae 402 ((TRIGGER) == SDADC_EXT_TRIG_BOTH_EDGES))
bogdanm 86:04dd9b1680ae 403 /**
bogdanm 86:04dd9b1680ae 404 * @}
bogdanm 86:04dd9b1680ae 405 */
bogdanm 86:04dd9b1680ae 406
bogdanm 92:4fc01daae5a5 407 /** @defgroup SDADC_InjectedDelay SDADC Injected Conversion Delay
bogdanm 86:04dd9b1680ae 408 * @{
bogdanm 86:04dd9b1680ae 409 */
bogdanm 86:04dd9b1680ae 410 #define SDADC_INJECTED_DELAY_NONE ((uint32_t)0x00000000) /*!< No delay on injected conversion */
bogdanm 86:04dd9b1680ae 411 #define SDADC_INJECTED_DELAY SDADC_CR2_JDS /*!< Delay on injected conversion */
bogdanm 86:04dd9b1680ae 412
bogdanm 86:04dd9b1680ae 413 #define IS_SDADC_INJECTED_DELAY(DELAY) (((DELAY) == SDADC_INJECTED_DELAY_NONE) || \
bogdanm 86:04dd9b1680ae 414 ((DELAY) == SDADC_INJECTED_DELAY))
bogdanm 86:04dd9b1680ae 415 /**
bogdanm 86:04dd9b1680ae 416 * @}
bogdanm 86:04dd9b1680ae 417 */
bogdanm 86:04dd9b1680ae 418
bogdanm 92:4fc01daae5a5 419 /** @defgroup SDADC_MultimodeType SDADC Multimode Type
bogdanm 86:04dd9b1680ae 420 * @{
bogdanm 86:04dd9b1680ae 421 */
bogdanm 86:04dd9b1680ae 422 #define SDADC_MULTIMODE_SDADC1_SDADC2 ((uint32_t)0x00000000) /*!< Get conversion values for SDADC1 and SDADC2 */
bogdanm 86:04dd9b1680ae 423 #define SDADC_MULTIMODE_SDADC1_SDADC3 ((uint32_t)0x00000001) /*!< Get conversion values for SDADC1 and SDADC3 */
bogdanm 86:04dd9b1680ae 424
bogdanm 86:04dd9b1680ae 425 #define IS_SDADC_MULTIMODE_TYPE(TYPE) (((TYPE) == SDADC_MULTIMODE_SDADC1_SDADC2) || \
bogdanm 86:04dd9b1680ae 426 ((TYPE) == SDADC_MULTIMODE_SDADC1_SDADC3))
bogdanm 86:04dd9b1680ae 427 /**
bogdanm 86:04dd9b1680ae 428 * @}
bogdanm 86:04dd9b1680ae 429 */
bogdanm 86:04dd9b1680ae 430
bogdanm 92:4fc01daae5a5 431 /** @defgroup SDADC_ErrorCode SDADC Error Code
bogdanm 86:04dd9b1680ae 432 * @{
bogdanm 86:04dd9b1680ae 433 */
bogdanm 86:04dd9b1680ae 434 #define SDADC_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
bogdanm 86:04dd9b1680ae 435 #define SDADC_ERROR_REGULAR_OVERRUN ((uint32_t)0x00000001) /*!< Overrun occurs during regular conversion */
bogdanm 86:04dd9b1680ae 436 #define SDADC_ERROR_INJECTED_OVERRUN ((uint32_t)0x00000002) /*!< Overrun occurs during injected conversion */
bogdanm 86:04dd9b1680ae 437 #define SDADC_ERROR_DMA ((uint32_t)0x00000003) /*!< DMA error occurs */
bogdanm 86:04dd9b1680ae 438 /**
bogdanm 86:04dd9b1680ae 439 * @}
bogdanm 86:04dd9b1680ae 440 */
bogdanm 86:04dd9b1680ae 441
bogdanm 92:4fc01daae5a5 442 /**
bogdanm 92:4fc01daae5a5 443 * @}
bogdanm 92:4fc01daae5a5 444 */
bogdanm 92:4fc01daae5a5 445
bogdanm 86:04dd9b1680ae 446 /* Exported macros -----------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 447 /** @defgroup SDADC_Exported_Macros SDADC Exported Macros
bogdanm 92:4fc01daae5a5 448 * @{
bogdanm 92:4fc01daae5a5 449 */
bogdanm 86:04dd9b1680ae 450
bogdanm 86:04dd9b1680ae 451 /** @brief Reset SDADC handle state
bogdanm 86:04dd9b1680ae 452 * @param __HANDLE__: SDADC handle.
bogdanm 86:04dd9b1680ae 453 * @retval None
bogdanm 86:04dd9b1680ae 454 */
bogdanm 86:04dd9b1680ae 455 #define __HAL_SDADC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SDADC_STATE_RESET)
bogdanm 86:04dd9b1680ae 456
bogdanm 92:4fc01daae5a5 457 /**
bogdanm 92:4fc01daae5a5 458 * @}
bogdanm 92:4fc01daae5a5 459 */
bogdanm 92:4fc01daae5a5 460
bogdanm 92:4fc01daae5a5 461
bogdanm 86:04dd9b1680ae 462 /* Exported functions --------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 463 /** @addtogroup SDADC_Exported_Functions SDADC Exported Functions
bogdanm 92:4fc01daae5a5 464 * @{
bogdanm 92:4fc01daae5a5 465 */
bogdanm 92:4fc01daae5a5 466
bogdanm 92:4fc01daae5a5 467 /** @addtogroup SDADC_Exported_Functions_Group1 Initialization and de-initialization functions
bogdanm 92:4fc01daae5a5 468 * @{
bogdanm 92:4fc01daae5a5 469 */
bogdanm 86:04dd9b1680ae 470
bogdanm 86:04dd9b1680ae 471 /* Initialization and de-initialization functions *****************************/
bogdanm 86:04dd9b1680ae 472 HAL_StatusTypeDef HAL_SDADC_Init(SDADC_HandleTypeDef *hsdadc);
bogdanm 86:04dd9b1680ae 473 HAL_StatusTypeDef HAL_SDADC_DeInit(SDADC_HandleTypeDef *hsdadc);
bogdanm 86:04dd9b1680ae 474 void HAL_SDADC_MspInit(SDADC_HandleTypeDef* hsdadc);
bogdanm 86:04dd9b1680ae 475 void HAL_SDADC_MspDeInit(SDADC_HandleTypeDef* hsdadc);
bogdanm 86:04dd9b1680ae 476
bogdanm 92:4fc01daae5a5 477 /**
bogdanm 92:4fc01daae5a5 478 * @}
bogdanm 92:4fc01daae5a5 479 */
bogdanm 92:4fc01daae5a5 480
bogdanm 92:4fc01daae5a5 481 /** @addtogroup SDADC_Exported_Functions_Group2 peripheral control functions
bogdanm 92:4fc01daae5a5 482 * @{
bogdanm 92:4fc01daae5a5 483 */
bogdanm 92:4fc01daae5a5 484
bogdanm 86:04dd9b1680ae 485 /* Peripheral Control functions ***********************************************/
bogdanm 86:04dd9b1680ae 486 HAL_StatusTypeDef HAL_SDADC_PrepareChannelConfig(SDADC_HandleTypeDef *hsdadc,
bogdanm 86:04dd9b1680ae 487 uint32_t ConfIndex,
bogdanm 86:04dd9b1680ae 488 SDADC_ConfParamTypeDef* ConfParamStruct);
bogdanm 86:04dd9b1680ae 489 HAL_StatusTypeDef HAL_SDADC_AssociateChannelConfig(SDADC_HandleTypeDef *hsdadc,
bogdanm 86:04dd9b1680ae 490 uint32_t Channel,
bogdanm 86:04dd9b1680ae 491 uint32_t ConfIndex);
bogdanm 86:04dd9b1680ae 492 HAL_StatusTypeDef HAL_SDADC_ConfigChannel(SDADC_HandleTypeDef *hsdadc,
bogdanm 86:04dd9b1680ae 493 uint32_t Channel,
bogdanm 86:04dd9b1680ae 494 uint32_t ContinuousMode);
bogdanm 86:04dd9b1680ae 495 HAL_StatusTypeDef HAL_SDADC_InjectedConfigChannel(SDADC_HandleTypeDef *hsdadc,
bogdanm 86:04dd9b1680ae 496 uint32_t Channel,
bogdanm 86:04dd9b1680ae 497 uint32_t ContinuousMode);
bogdanm 86:04dd9b1680ae 498 HAL_StatusTypeDef HAL_SDADC_SelectInjectedExtTrigger(SDADC_HandleTypeDef *hsdadc,
bogdanm 86:04dd9b1680ae 499 uint32_t InjectedExtTrigger,
bogdanm 86:04dd9b1680ae 500 uint32_t ExtTriggerEdge);
bogdanm 86:04dd9b1680ae 501 HAL_StatusTypeDef HAL_SDADC_SelectInjectedDelay(SDADC_HandleTypeDef *hsdadc,
bogdanm 86:04dd9b1680ae 502 uint32_t InjectedDelay);
bogdanm 86:04dd9b1680ae 503 HAL_StatusTypeDef HAL_SDADC_SelectRegularTrigger(SDADC_HandleTypeDef *hsdadc, uint32_t Trigger);
bogdanm 86:04dd9b1680ae 504 HAL_StatusTypeDef HAL_SDADC_SelectInjectedTrigger(SDADC_HandleTypeDef *hsdadc, uint32_t Trigger);
bogdanm 86:04dd9b1680ae 505 HAL_StatusTypeDef HAL_SDADC_MultiModeConfigChannel(SDADC_HandleTypeDef* hsdadc, uint32_t MultimodeType);
bogdanm 86:04dd9b1680ae 506 HAL_StatusTypeDef HAL_SDADC_InjectedMultiModeConfigChannel(SDADC_HandleTypeDef* hsdadc, uint32_t MultimodeType);
bogdanm 86:04dd9b1680ae 507
bogdanm 92:4fc01daae5a5 508 /**
bogdanm 92:4fc01daae5a5 509 * @}
bogdanm 92:4fc01daae5a5 510 */
bogdanm 92:4fc01daae5a5 511
bogdanm 92:4fc01daae5a5 512 /** @addtogroup SDADC_Exported_Functions_Group3 Input and Output operation functions
bogdanm 92:4fc01daae5a5 513 * @{
bogdanm 92:4fc01daae5a5 514 */
bogdanm 92:4fc01daae5a5 515
bogdanm 86:04dd9b1680ae 516 /* IO operation functions *****************************************************/
bogdanm 86:04dd9b1680ae 517 HAL_StatusTypeDef HAL_SDADC_CalibrationStart(SDADC_HandleTypeDef *hsdadc, uint32_t CalibrationSequence);
bogdanm 86:04dd9b1680ae 518 HAL_StatusTypeDef HAL_SDADC_CalibrationStart_IT(SDADC_HandleTypeDef *hsdadc, uint32_t CalibrationSequence);
bogdanm 86:04dd9b1680ae 519
bogdanm 86:04dd9b1680ae 520 HAL_StatusTypeDef HAL_SDADC_Start(SDADC_HandleTypeDef *hsdadc);
bogdanm 86:04dd9b1680ae 521 HAL_StatusTypeDef HAL_SDADC_Start_IT(SDADC_HandleTypeDef *hsdadc);
bogdanm 86:04dd9b1680ae 522 HAL_StatusTypeDef HAL_SDADC_Start_DMA(SDADC_HandleTypeDef *hsdadc, uint32_t *pData, uint32_t Length);
bogdanm 86:04dd9b1680ae 523 HAL_StatusTypeDef HAL_SDADC_Stop(SDADC_HandleTypeDef *hsdadc);
bogdanm 86:04dd9b1680ae 524 HAL_StatusTypeDef HAL_SDADC_Stop_IT(SDADC_HandleTypeDef *hsdadc);
bogdanm 86:04dd9b1680ae 525 HAL_StatusTypeDef HAL_SDADC_Stop_DMA(SDADC_HandleTypeDef *hsdadc);
bogdanm 86:04dd9b1680ae 526
bogdanm 86:04dd9b1680ae 527 HAL_StatusTypeDef HAL_SDADC_InjectedStart(SDADC_HandleTypeDef *hsdadc);
bogdanm 86:04dd9b1680ae 528 HAL_StatusTypeDef HAL_SDADC_InjectedStart_IT(SDADC_HandleTypeDef *hsdadc);
bogdanm 86:04dd9b1680ae 529 HAL_StatusTypeDef HAL_SDADC_InjectedStart_DMA(SDADC_HandleTypeDef *hsdadc, uint32_t *pData, uint32_t Length);
bogdanm 86:04dd9b1680ae 530 HAL_StatusTypeDef HAL_SDADC_InjectedStop(SDADC_HandleTypeDef *hsdadc);
bogdanm 86:04dd9b1680ae 531 HAL_StatusTypeDef HAL_SDADC_InjectedStop_IT(SDADC_HandleTypeDef *hsdadc);
bogdanm 86:04dd9b1680ae 532 HAL_StatusTypeDef HAL_SDADC_InjectedStop_DMA(SDADC_HandleTypeDef *hsdadc);
bogdanm 86:04dd9b1680ae 533
bogdanm 86:04dd9b1680ae 534 HAL_StatusTypeDef HAL_SDADC_MultiModeStart_DMA(SDADC_HandleTypeDef* hsdadc, uint32_t* pData, uint32_t Length);
bogdanm 86:04dd9b1680ae 535 HAL_StatusTypeDef HAL_SDADC_MultiModeStop_DMA(SDADC_HandleTypeDef* hsdadc);
bogdanm 86:04dd9b1680ae 536 HAL_StatusTypeDef HAL_SDADC_InjectedMultiModeStart_DMA(SDADC_HandleTypeDef* hsdadc, uint32_t* pData, uint32_t Length);
bogdanm 86:04dd9b1680ae 537 HAL_StatusTypeDef HAL_SDADC_InjectedMultiModeStop_DMA(SDADC_HandleTypeDef* hsdadc);
bogdanm 86:04dd9b1680ae 538
bogdanm 86:04dd9b1680ae 539 uint32_t HAL_SDADC_GetValue(SDADC_HandleTypeDef *hsdadc);
bogdanm 86:04dd9b1680ae 540 uint32_t HAL_SDADC_InjectedGetValue(SDADC_HandleTypeDef *hsdadc, uint32_t* Channel);
bogdanm 86:04dd9b1680ae 541 uint32_t HAL_SDADC_MultiModeGetValue(SDADC_HandleTypeDef* hsdadc);
bogdanm 86:04dd9b1680ae 542 uint32_t HAL_SDADC_InjectedMultiModeGetValue(SDADC_HandleTypeDef* hsdadc);
bogdanm 86:04dd9b1680ae 543
bogdanm 86:04dd9b1680ae 544 void HAL_SDADC_IRQHandler(SDADC_HandleTypeDef* hsdadc);
bogdanm 86:04dd9b1680ae 545
bogdanm 86:04dd9b1680ae 546 HAL_StatusTypeDef HAL_SDADC_PollForCalibEvent(SDADC_HandleTypeDef* hsdadc, uint32_t Timeout);
bogdanm 86:04dd9b1680ae 547 HAL_StatusTypeDef HAL_SDADC_PollForConversion(SDADC_HandleTypeDef* hsdadc, uint32_t Timeout);
bogdanm 86:04dd9b1680ae 548 HAL_StatusTypeDef HAL_SDADC_PollForInjectedConversion(SDADC_HandleTypeDef* hsdadc, uint32_t Timeout);
bogdanm 86:04dd9b1680ae 549
bogdanm 86:04dd9b1680ae 550 void HAL_SDADC_CalibrationCpltCallback(SDADC_HandleTypeDef* hsdadc);
bogdanm 86:04dd9b1680ae 551 void HAL_SDADC_ConvHalfCpltCallback(SDADC_HandleTypeDef* hsdadc);
bogdanm 86:04dd9b1680ae 552 void HAL_SDADC_ConvCpltCallback(SDADC_HandleTypeDef* hsdadc);
bogdanm 86:04dd9b1680ae 553 void HAL_SDADC_InjectedConvHalfCpltCallback(SDADC_HandleTypeDef* hsdadc);
bogdanm 86:04dd9b1680ae 554 void HAL_SDADC_InjectedConvCpltCallback(SDADC_HandleTypeDef* hsdadc);
bogdanm 86:04dd9b1680ae 555 void HAL_SDADC_ErrorCallback(SDADC_HandleTypeDef* hsdadc);
bogdanm 86:04dd9b1680ae 556
bogdanm 92:4fc01daae5a5 557 /**
bogdanm 92:4fc01daae5a5 558 * @}
bogdanm 92:4fc01daae5a5 559 */
bogdanm 92:4fc01daae5a5 560
bogdanm 92:4fc01daae5a5 561 /** @defgroup SDADC_Exported_Functions_Group4 Peripheral State functions
bogdanm 92:4fc01daae5a5 562 * @{
bogdanm 92:4fc01daae5a5 563 */
bogdanm 92:4fc01daae5a5 564
bogdanm 86:04dd9b1680ae 565 /* Peripheral State and Error functions ***************************************/
bogdanm 86:04dd9b1680ae 566 HAL_SDADC_StateTypeDef HAL_SDADC_GetState(SDADC_HandleTypeDef* hsdadc);
bogdanm 86:04dd9b1680ae 567 uint32_t HAL_SDADC_GetError(SDADC_HandleTypeDef* hsdadc);
bogdanm 86:04dd9b1680ae 568
bogdanm 86:04dd9b1680ae 569 /* Private functions ---------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 570
bogdanm 86:04dd9b1680ae 571 /**
bogdanm 86:04dd9b1680ae 572 * @}
bogdanm 92:4fc01daae5a5 573 */
bogdanm 92:4fc01daae5a5 574
bogdanm 92:4fc01daae5a5 575 /**
bogdanm 92:4fc01daae5a5 576 * @}
bogdanm 92:4fc01daae5a5 577 */
bogdanm 92:4fc01daae5a5 578
bogdanm 92:4fc01daae5a5 579 /**
bogdanm 92:4fc01daae5a5 580 * @}
bogdanm 86:04dd9b1680ae 581 */
bogdanm 86:04dd9b1680ae 582
bogdanm 86:04dd9b1680ae 583 /**
bogdanm 86:04dd9b1680ae 584 * @}
bogdanm 86:04dd9b1680ae 585 */
bogdanm 86:04dd9b1680ae 586
bogdanm 86:04dd9b1680ae 587 #endif /* defined(STM32F373xC) || defined(STM32F378xx) */
bogdanm 86:04dd9b1680ae 588
bogdanm 86:04dd9b1680ae 589 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 590 }
bogdanm 86:04dd9b1680ae 591 #endif
bogdanm 86:04dd9b1680ae 592
bogdanm 86:04dd9b1680ae 593 #endif /*__STM32F3xx_SDADC_H */
bogdanm 86:04dd9b1680ae 594
bogdanm 86:04dd9b1680ae 595
bogdanm 86:04dd9b1680ae 596 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/