mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Fri Aug 12 13:04:35 2016 +0200
Revision:
123:b0220dba8be7
Parent:
122:f9eeca106725
Release 123 of the mbed library

Changes:
- new targets: nucleo_f207zg, beetle, nrf51_dk, hexiwear,
nuvoton nuc472, vk rz a1h
- ST - fix timer interrupt handler, sleep api fix
- NXP - lpc15xx us ticker fix
- Nordic - analogin fixes, LF clock init addition, enable i2c async

Who changed what in which revision?

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