Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed Jan 13 09:48:29 2016 +0000
Revision:
112:6f327212ef96
Release 112 of the mbed library

Changes:
- new platforms - STM32 B96B F446, MOTE_L152RC
- nrf51 - fix serial init bug (character sent)
- stm all devices - fix RTC clocking in the init
- stm f0 - SystemInit clock fix, for SetVector()
- RawSerial - fix for microlib (vsnprintf with size 0)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 112:6f327212ef96 1 /**
Kojto 112:6f327212ef96 2 ******************************************************************************
Kojto 112:6f327212ef96 3 * @file stm32l1xx_hal_adc.h
Kojto 112:6f327212ef96 4 * @author MCD Application Team
Kojto 112:6f327212ef96 5 * @version V1.0.0
Kojto 112:6f327212ef96 6 * @date 5-September-2014
Kojto 112:6f327212ef96 7 * @brief Header file containing functions prototypes of ADC HAL library.
Kojto 112:6f327212ef96 8 ******************************************************************************
Kojto 112:6f327212ef96 9 * @attention
Kojto 112:6f327212ef96 10 *
Kojto 112:6f327212ef96 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Kojto 112:6f327212ef96 12 *
Kojto 112:6f327212ef96 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 112:6f327212ef96 14 * are permitted provided that the following conditions are met:
Kojto 112:6f327212ef96 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 112:6f327212ef96 16 * this list of conditions and the following disclaimer.
Kojto 112:6f327212ef96 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 112:6f327212ef96 18 * this list of conditions and the following disclaimer in the documentation
Kojto 112:6f327212ef96 19 * and/or other materials provided with the distribution.
Kojto 112:6f327212ef96 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 112:6f327212ef96 21 * may be used to endorse or promote products derived from this software
Kojto 112:6f327212ef96 22 * without specific prior written permission.
Kojto 112:6f327212ef96 23 *
Kojto 112:6f327212ef96 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 112:6f327212ef96 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 112:6f327212ef96 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 112:6f327212ef96 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 112:6f327212ef96 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 112:6f327212ef96 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 112:6f327212ef96 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 112:6f327212ef96 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 112:6f327212ef96 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 112:6f327212ef96 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 112:6f327212ef96 34 *
Kojto 112:6f327212ef96 35 ******************************************************************************
Kojto 112:6f327212ef96 36 */
Kojto 112:6f327212ef96 37
Kojto 112:6f327212ef96 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 112:6f327212ef96 39 #ifndef __STM32L1xx_HAL_ADC_H
Kojto 112:6f327212ef96 40 #define __STM32L1xx_HAL_ADC_H
Kojto 112:6f327212ef96 41
Kojto 112:6f327212ef96 42 #ifdef __cplusplus
Kojto 112:6f327212ef96 43 extern "C" {
Kojto 112:6f327212ef96 44 #endif
Kojto 112:6f327212ef96 45
Kojto 112:6f327212ef96 46 /* Includes ------------------------------------------------------------------*/
Kojto 112:6f327212ef96 47 #include "stm32l1xx_hal_def.h"
Kojto 112:6f327212ef96 48 /** @addtogroup STM32L1xx_HAL_Driver
Kojto 112:6f327212ef96 49 * @{
Kojto 112:6f327212ef96 50 */
Kojto 112:6f327212ef96 51
Kojto 112:6f327212ef96 52 /** @addtogroup ADC
Kojto 112:6f327212ef96 53 * @{
Kojto 112:6f327212ef96 54 */
Kojto 112:6f327212ef96 55
Kojto 112:6f327212ef96 56 /* Exported types ------------------------------------------------------------*/
Kojto 112:6f327212ef96 57 /** @defgroup ADC_Exported_Types ADC Exported Types
Kojto 112:6f327212ef96 58 * @{
Kojto 112:6f327212ef96 59 */
Kojto 112:6f327212ef96 60
Kojto 112:6f327212ef96 61 /**
Kojto 112:6f327212ef96 62 * @brief Structure definition of ADC and regular group initialization
Kojto 112:6f327212ef96 63 * @note Parameters of this structure are shared within 2 scopes:
Kojto 112:6f327212ef96 64 * - Scope entire ADC (affects regular and injected groups): ClockPrescaler, Resolution, ScanConvMode, DataAlign, ScanConvMode, EOCSelection, LowPowerAutoWait, LowPowerAutoPowerOff, ChannelsBank.
Kojto 112:6f327212ef96 65 * - Scope regular group: ContinuousConvMode, NbrOfConversion, DiscontinuousConvMode, NbrOfDiscConversion, ExternalTrigConvEdge, ExternalTrigConv.
Kojto 112:6f327212ef96 66 * @note The setting of these parameters with function HAL_ADC_Init() is conditioned to ADC state.
Kojto 112:6f327212ef96 67 * ADC state can be either:
Kojto 112:6f327212ef96 68 * - For all parameters: ADC disabled
Kojto 112:6f327212ef96 69 * - For all parameters except 'Resolution', 'ScanConvMode', 'LowPowerAutoWait', 'LowPowerAutoPowerOff', 'DiscontinuousConvMode', 'NbrOfDiscConversion' : ADC enabled without conversion on going on regular group.
Kojto 112:6f327212ef96 70 * - For parameters 'ExternalTrigConv' and 'ExternalTrigConvEdge': ADC enabled, even with conversion on going.
Kojto 112:6f327212ef96 71 * If ADC is not in the appropriate state to modify some parameters, these parameters setting is bypassed
Kojto 112:6f327212ef96 72 * without error reporting without error reporting (as it can be the expected behaviour in case of intended action to update another parameter (which fullfills the ADC state condition) on the fly).
Kojto 112:6f327212ef96 73 */
Kojto 112:6f327212ef96 74 typedef struct
Kojto 112:6f327212ef96 75 {
Kojto 112:6f327212ef96 76 uint32_t ClockPrescaler; /*!< Select ADC clock source (asynchronous clock derived from HSI RC oscillator) and clock prescaler.
Kojto 112:6f327212ef96 77 This parameter can be a value of @ref ADC_ClockPrescaler
Kojto 112:6f327212ef96 78 Note: In case of usage of channels on injected group, ADC frequency should be low than AHB clock frequency /4 for resolution 12 or 10 bits,
Kojto 112:6f327212ef96 79 AHB clock frequency /3 for resolution 8 bits, AHB clock frequency /2 for resolution 6 bits.
Kojto 112:6f327212ef96 80 Note: HSI RC oscillator must be preliminarily enabled at RCC top level. */
Kojto 112:6f327212ef96 81 uint32_t Resolution; /*!< Configures the ADC resolution.
Kojto 112:6f327212ef96 82 This parameter can be a value of @ref ADC_Resolution */
Kojto 112:6f327212ef96 83 uint32_t DataAlign; /*!< Specifies ADC data alignment to right (MSB on register bit 11 and LSB on register bit 0) (default setting)
Kojto 112:6f327212ef96 84 or to left (if regular group: MSB on register bit 15 and LSB on register bit 4, if injected group (MSB kept as signed value due to potential negative value after offset application): MSB on register bit 14 and LSB on register bit 3).
Kojto 112:6f327212ef96 85 This parameter can be a value of @ref ADC_Data_align */
Kojto 112:6f327212ef96 86 uint32_t ScanConvMode; /*!< Configures the sequencer of regular and injected groups.
Kojto 112:6f327212ef96 87 This parameter can be associated to parameter 'DiscontinuousConvMode' to have main sequence subdivided in successive parts.
Kojto 112:6f327212ef96 88 If disabled: Conversion is performed in single mode (one channel converted, the one defined in rank 1).
Kojto 112:6f327212ef96 89 Parameters 'NbrOfConversion' and 'InjectedNbrOfConversion' are discarded (equivalent to set to 1).
Kojto 112:6f327212ef96 90 If enabled: Conversions are performed in sequence mode (multiple ranks defined by 'NbrOfConversion'/'InjectedNbrOfConversion' and each channel rank).
Kojto 112:6f327212ef96 91 Scan direction is upward: from rank1 to rank 'n'.
Kojto 112:6f327212ef96 92 This parameter can be a value of @ref ADC_Scan_mode */
Kojto 112:6f327212ef96 93 uint32_t EOCSelection; /*!< Specifies what EOC (End Of Conversion) flag is used for conversion by polling and interruption: end of conversion of each rank or complete sequence.
Kojto 112:6f327212ef96 94 This parameter can be a value of @ref ADC_EOCSelection.
Kojto 112:6f327212ef96 95 Note: For injected group, end of conversion (flag&IT) is raised only at the end of the sequence.
Kojto 112:6f327212ef96 96 Therefore, if end of conversion is set to end of each conversion, injected group should not be used with interruption (HAL_ADCEx_InjectedStart_IT)
Kojto 112:6f327212ef96 97 or polling (HAL_ADCEx_InjectedStart and HAL_ADCEx_InjectedPollForConversion). By the way, polling is still possible since driver will use an estimated timing for end of injected conversion.
Kojto 112:6f327212ef96 98 Note: If overrun feature is intending to be used in ADC mode 'interruption' (function HAL_ADC_Start_IT() ), parameter EOCSelection must be set to each conversion (this is not needed for ADC mode 'transfer by DMA', with function HAL_ADC_Start_DMA()) */
Kojto 112:6f327212ef96 99 uint32_t LowPowerAutoWait; /*!< Selects the dynamic low power Auto Delay: new conversion start only when the previous
Kojto 112:6f327212ef96 100 conversion (for regular group) or previous sequence (for injected group) has been treated by user software.
Kojto 112:6f327212ef96 101 This feature automatically adapts the speed of ADC to the speed of the system that reads the data. Moreover, this avoids risk of overrun for low frequency applications.
Kojto 112:6f327212ef96 102 This parameter can be a value of @ref ADC_LowPowerAutoWait.
Kojto 112:6f327212ef96 103 Note: Do not use with interruption or DMA (HAL_ADC_Start_IT(), HAL_ADC_Start_DMA()) since they have to clear immediately the EOC flag to free the IRQ vector sequencer.
Kojto 112:6f327212ef96 104 Do use with polling: 1. Start conversion with HAL_ADC_Start(), 2. Later on, when conversion data is needed: use HAL_ADC_PollForConversion() to ensure that conversion is completed
Kojto 112:6f327212ef96 105 and use HAL_ADC_GetValue() to retrieve conversion result and trig another conversion.
Kojto 112:6f327212ef96 106 Note: ADC clock latency and some timing constraints depending on clock prescaler have to be taken into account: refer to reference manual (register ADC_CR2 bit DELS description). */
Kojto 112:6f327212ef96 107 uint32_t LowPowerAutoPowerOff; /*!< Selects the auto-off mode: the ADC automatically powers-off after a conversion and automatically wakes-up when a new conversion is triggered (with startup time between trigger and start of sampling).
Kojto 112:6f327212ef96 108 This feature can be combined with automatic wait mode (parameter 'LowPowerAutoWait').
Kojto 112:6f327212ef96 109 This parameter can be a value of @ref ADC_LowPowerAutoPowerOff. */
Kojto 112:6f327212ef96 110 uint32_t ChannelsBank; /*!< Selects the ADC channels bank.
Kojto 112:6f327212ef96 111 This parameter can be a value of @ref ADC_ChannelsBank.
Kojto 112:6f327212ef96 112 Note: Banks availability depends on devices categories.
Kojto 112:6f327212ef96 113 Note: To change bank selection on the fly, without going through execution of 'HAL_ADC_Init()', macro '__HAL_ADC_CHANNELS_BANK()' can be used directly. */
Kojto 112:6f327212ef96 114 uint32_t ContinuousConvMode; /*!< Specifies whether the conversion is performed in single mode (one conversion) or continuous mode for regular group,
Kojto 112:6f327212ef96 115 after the selected trigger occurred (software start or external trigger).
Kojto 112:6f327212ef96 116 This parameter can be set to ENABLE or DISABLE. */
Kojto 112:6f327212ef96 117 #if defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
Kojto 112:6f327212ef96 118 uint32_t NbrOfConversion; /*!< Specifies the number of ranks that will be converted within the regular group sequencer.
Kojto 112:6f327212ef96 119 To use regular group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled.
Kojto 112:6f327212ef96 120 This parameter must be a number between Min_Data = 1 and Max_Data = 28. */
Kojto 112:6f327212ef96 121 #else
Kojto 112:6f327212ef96 122 uint32_t NbrOfConversion; /*!< Specifies the number of ranks that will be converted within the regular group sequencer.
Kojto 112:6f327212ef96 123 To use regular group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled.
Kojto 112:6f327212ef96 124 This parameter must be a number between Min_Data = 1 and Max_Data = 27. */
Kojto 112:6f327212ef96 125 #endif /* STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
Kojto 112:6f327212ef96 126 uint32_t DiscontinuousConvMode; /*!< Specifies whether the conversions sequence of regular group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts).
Kojto 112:6f327212ef96 127 Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded.
Kojto 112:6f327212ef96 128 Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded.
Kojto 112:6f327212ef96 129 This parameter can be set to ENABLE or DISABLE. */
Kojto 112:6f327212ef96 130 uint32_t NbrOfDiscConversion; /*!< Specifies the number of discontinuous conversions in which the main sequence of regular group (parameter NbrOfConversion) will be subdivided.
Kojto 112:6f327212ef96 131 If parameter 'DiscontinuousConvMode' is disabled, this parameter is discarded.
Kojto 112:6f327212ef96 132 This parameter must be a number between Min_Data = 1 and Max_Data = 8. */
Kojto 112:6f327212ef96 133 uint32_t ExternalTrigConv; /*!< Selects the external event used to trigger the conversion start of regular group.
Kojto 112:6f327212ef96 134 If set to ADC_SOFTWARE_START, external triggers are disabled.
Kojto 112:6f327212ef96 135 If set to external trigger source, triggering is on event rising edge.
Kojto 112:6f327212ef96 136 This parameter can be a value of @ref ADC_External_trigger_source_Regular */
Kojto 112:6f327212ef96 137 uint32_t ExternalTrigConvEdge; /*!< Selects the external trigger edge of regular group.
Kojto 112:6f327212ef96 138 If trigger is set to ADC_SOFTWARE_START, this parameter is discarded.
Kojto 112:6f327212ef96 139 This parameter can be a value of @ref ADC_External_trigger_edge_Regular */
Kojto 112:6f327212ef96 140 uint32_t DMAContinuousRequests; /*!< Specifies whether the DMA requests are performed in one shot mode (DMA transfer stop when number of conversions is reached)
Kojto 112:6f327212ef96 141 or in Continuous mode (DMA transfer unlimited, whatever number of conversions).
Kojto 112:6f327212ef96 142 Note: In continuous mode, DMA must be configured in circular mode. Otherwise an overrun will be triggered when DMA buffer maximum pointer is reached.
Kojto 112:6f327212ef96 143 This parameter can be set to ENABLE or DISABLE.
Kojto 112:6f327212ef96 144 Note: This parameter must be modified when no conversion is on going on both regular and injected groups (ADC disabled, or ADC enabled without continuous mode or external trigger that could lauch a conversion). */
Kojto 112:6f327212ef96 145 }ADC_InitTypeDef;
Kojto 112:6f327212ef96 146
Kojto 112:6f327212ef96 147 /**
Kojto 112:6f327212ef96 148 * @brief Structure definition of ADC channel for regular group
Kojto 112:6f327212ef96 149 * @note The setting of these parameters with function HAL_ADC_ConfigChannel() is conditioned to ADC state.
Kojto 112:6f327212ef96 150 * ADC can be either disabled or enabled without conversion on going on regular group.
Kojto 112:6f327212ef96 151 */
Kojto 112:6f327212ef96 152 typedef struct
Kojto 112:6f327212ef96 153 {
Kojto 112:6f327212ef96 154 uint32_t Channel; /*!< Specifies the channel to configure into ADC regular group.
Kojto 112:6f327212ef96 155 This parameter can be a value of @ref ADC_channels
Kojto 112:6f327212ef96 156 Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability.
Kojto 112:6f327212ef96 157 Maximum number of channels by device category (without taking in account each device package constraints):
Kojto 112:6f327212ef96 158 STM32L1 category 1, 2: 24 channels on external pins + 3 channels on internal measurement paths (VrefInt, Temp sensor, Vcomp): Channel 0 to channel 26.
Kojto 112:6f327212ef96 159 STM32L1 category 3: 25 channels on external pins + 3 channels on internal measurement paths (VrefInt, Temp sensor, Vcomp): Channel 0 to channel 26, 1 additional channel in bank B. Note: OPAMP1 and OPAMP2 are connected internally but not increasing internal channels number: they are sharing ADC input with external channels ADC_IN3 and ADC_IN8.
Kojto 112:6f327212ef96 160 STM32L1 category 4, 5: 40 channels on external pins + 3 channels on internal measurement paths (VrefInt, Temp sensor, Vcomp): Channel 0 to channel 31, 11 additional channels in bank B. Note: OPAMP1 and OPAMP2 are connected internally but not increasing internal channels number: they are sharing ADC input with external channels ADC_IN3 and ADC_IN8.
Kojto 112:6f327212ef96 161 Note: In case of peripherals OPAMPx not used: 3 channels (3, 8, 13) can be configured as direct channels (fast channels). Refer to macro ' __HAL_ADC_CHANNEL_SPEED_FAST() '.
Kojto 112:6f327212ef96 162 Note: In case of peripheral OPAMP3 and ADC channel OPAMP3 used (OPAMP3 available on STM32L1 devices Cat.4 only): the analog switch COMP1_SW1 must be closed. Refer to macro: ' __HAL_OPAMP_OPAMP3OUT_CONNECT_ADC_COMP1() '. */
Kojto 112:6f327212ef96 163 uint32_t Rank; /*!< Specifies the rank in the regular group sequencer
Kojto 112:6f327212ef96 164 This parameter can be a value of @ref ADC_regular_rank
Kojto 112:6f327212ef96 165 Note: In case of need to disable a channel or change order of conversion sequencer, rank containing a previous channel setting can be overwritten by the new channel setting (or parameter number of conversions can be adjusted) */
Kojto 112:6f327212ef96 166 uint32_t SamplingTime; /*!< Sampling time value to be set for the selected channel.
Kojto 112:6f327212ef96 167 Unit: ADC clock cycles
Kojto 112:6f327212ef96 168 Conversion time is the addition of sampling time and processing time (12 ADC clock cycles at ADC resolution 12 bits, 11 cycles at 10 bits, 9 cycles at 8 bits, 7 cycles at 6 bits).
Kojto 112:6f327212ef96 169 This parameter can be a value of @ref ADC_sampling_times
Kojto 112:6f327212ef96 170 Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups.
Kojto 112:6f327212ef96 171 If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting.
Kojto 112:6f327212ef96 172 Note: In case of usage of internal measurement channels (VrefInt/Vbat/TempSensor),
Kojto 112:6f327212ef96 173 sampling time constraints must be respected (sampling time can be adjusted in function of ADC clock frequency and sampling time setting)
Kojto 112:6f327212ef96 174 Refer to device datasheet for timings values, parameters TS_vrefint, TS_temp (values rough order: 4us min). */
Kojto 112:6f327212ef96 175 }ADC_ChannelConfTypeDef;
Kojto 112:6f327212ef96 176
Kojto 112:6f327212ef96 177 /**
Kojto 112:6f327212ef96 178 * @brief ADC Configuration analog watchdog definition
Kojto 112:6f327212ef96 179 * @note The setting of these parameters with function is conditioned to ADC state.
Kojto 112:6f327212ef96 180 * ADC state can be either disabled or enabled without conversion on going on regular and injected groups.
Kojto 112:6f327212ef96 181 */
Kojto 112:6f327212ef96 182 typedef struct
Kojto 112:6f327212ef96 183 {
Kojto 112:6f327212ef96 184 uint32_t WatchdogMode; /*!< Configures the ADC analog watchdog mode: single/all channels, regular/injected group.
Kojto 112:6f327212ef96 185 This parameter can be a value of @ref ADC_analog_watchdog_mode. */
Kojto 112:6f327212ef96 186 uint32_t Channel; /*!< Selects which ADC channel to monitor by analog watchdog.
Kojto 112:6f327212ef96 187 This parameter has an effect only if watchdog mode is configured on single channel (parameter WatchdogMode)
Kojto 112:6f327212ef96 188 This parameter can be a value of @ref ADC_channels. */
Kojto 112:6f327212ef96 189 uint32_t ITMode; /*!< Specifies whether the analog watchdog is configured in interrupt or polling mode.
Kojto 112:6f327212ef96 190 This parameter can be set to ENABLE or DISABLE */
Kojto 112:6f327212ef96 191 uint32_t HighThreshold; /*!< Configures the ADC analog watchdog High threshold value.
Kojto 112:6f327212ef96 192 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */
Kojto 112:6f327212ef96 193 uint32_t LowThreshold; /*!< Configures the ADC analog watchdog High threshold value.
Kojto 112:6f327212ef96 194 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */
Kojto 112:6f327212ef96 195 uint32_t WatchdogNumber; /*!< Reserved for future use, can be set to 0 */
Kojto 112:6f327212ef96 196 }ADC_AnalogWDGConfTypeDef;
Kojto 112:6f327212ef96 197
Kojto 112:6f327212ef96 198 /**
Kojto 112:6f327212ef96 199 * @brief HAL ADC state machine: ADC States structure definition
Kojto 112:6f327212ef96 200 */
Kojto 112:6f327212ef96 201 typedef enum
Kojto 112:6f327212ef96 202 {
Kojto 112:6f327212ef96 203 HAL_ADC_STATE_RESET = 0x00, /*!< ADC not yet initialized or disabled */
Kojto 112:6f327212ef96 204 HAL_ADC_STATE_READY = 0x01, /*!< ADC peripheral ready for use */
Kojto 112:6f327212ef96 205 HAL_ADC_STATE_BUSY = 0x02, /*!< An internal process is ongoing */
Kojto 112:6f327212ef96 206 HAL_ADC_STATE_BUSY_REG = 0x12, /*!< Regular conversion is ongoing */
Kojto 112:6f327212ef96 207 HAL_ADC_STATE_BUSY_INJ = 0x22, /*!< Injected conversion is ongoing */
Kojto 112:6f327212ef96 208 HAL_ADC_STATE_BUSY_INJ_REG = 0x32, /*!< Injected and regular conversion are ongoing */
Kojto 112:6f327212ef96 209 HAL_ADC_STATE_TIMEOUT = 0x03, /*!< Timeout state */
Kojto 112:6f327212ef96 210 HAL_ADC_STATE_ERROR = 0x04, /*!< ADC state error */
Kojto 112:6f327212ef96 211 HAL_ADC_STATE_EOC = 0x05, /*!< Conversion is completed */
Kojto 112:6f327212ef96 212 HAL_ADC_STATE_EOC_REG = 0x15, /*!< Regular conversion is completed */
Kojto 112:6f327212ef96 213 HAL_ADC_STATE_EOC_INJ = 0x25, /*!< Injected conversion is completed */
Kojto 112:6f327212ef96 214 HAL_ADC_STATE_EOC_INJ_REG = 0x35, /*!< Injected and regular conversion are completed */
Kojto 112:6f327212ef96 215 HAL_ADC_STATE_AWD = 0x06, /*!< ADC state analog watchdog */
Kojto 112:6f327212ef96 216 HAL_ADC_STATE_AWD2 = 0x07, /*!< Not used on STM32L1xx devices (kept for compatibility with other devices featuring several AWD) */
Kojto 112:6f327212ef96 217 HAL_ADC_STATE_AWD3 = 0x08, /*!< Not used on STM32l1xx devices (kept for compatibility with other devices featuring several AWD) */
Kojto 112:6f327212ef96 218 }HAL_ADC_StateTypeDef;
Kojto 112:6f327212ef96 219
Kojto 112:6f327212ef96 220 /**
Kojto 112:6f327212ef96 221 * @brief ADC handle Structure definition
Kojto 112:6f327212ef96 222 */
Kojto 112:6f327212ef96 223 typedef struct
Kojto 112:6f327212ef96 224 {
Kojto 112:6f327212ef96 225 ADC_TypeDef *Instance; /*!< Register base address */
Kojto 112:6f327212ef96 226
Kojto 112:6f327212ef96 227 ADC_InitTypeDef Init; /*!< ADC required parameters */
Kojto 112:6f327212ef96 228
Kojto 112:6f327212ef96 229 __IO uint32_t NbrOfConversionRank ; /*!< ADC conversion rank counter */
Kojto 112:6f327212ef96 230
Kojto 112:6f327212ef96 231 DMA_HandleTypeDef *DMA_Handle; /*!< Pointer DMA Handler */
Kojto 112:6f327212ef96 232
Kojto 112:6f327212ef96 233 HAL_LockTypeDef Lock; /*!< ADC locking object */
Kojto 112:6f327212ef96 234
Kojto 112:6f327212ef96 235 __IO HAL_ADC_StateTypeDef State; /*!< ADC communication state */
Kojto 112:6f327212ef96 236
Kojto 112:6f327212ef96 237 __IO uint32_t ErrorCode; /*!< ADC Error code */
Kojto 112:6f327212ef96 238 }ADC_HandleTypeDef;
Kojto 112:6f327212ef96 239 /**
Kojto 112:6f327212ef96 240 * @}
Kojto 112:6f327212ef96 241 */
Kojto 112:6f327212ef96 242
Kojto 112:6f327212ef96 243
Kojto 112:6f327212ef96 244
Kojto 112:6f327212ef96 245 /* Exported constants --------------------------------------------------------*/
Kojto 112:6f327212ef96 246
Kojto 112:6f327212ef96 247 /** @defgroup ADC_Exported_Constants ADC Exported Constants
Kojto 112:6f327212ef96 248 * @{
Kojto 112:6f327212ef96 249 */
Kojto 112:6f327212ef96 250
Kojto 112:6f327212ef96 251 /** @defgroup ADC_Error_Code ADC Error Code
Kojto 112:6f327212ef96 252 * @{
Kojto 112:6f327212ef96 253 */
Kojto 112:6f327212ef96 254 #define HAL_ADC_ERROR_NONE ((uint32_t)0x00) /*!< No error */
Kojto 112:6f327212ef96 255 #define HAL_ADC_ERROR_INTERNAL ((uint32_t)0x01) /*!< ADC IP internal error: if problem of clocking,
Kojto 112:6f327212ef96 256 enable/disable, erroneous state */
Kojto 112:6f327212ef96 257 #define HAL_ADC_ERROR_OVR ((uint32_t)0x02) /*!< Overrun error */
Kojto 112:6f327212ef96 258 #define HAL_ADC_ERROR_DMA ((uint32_t)0x04) /*!< DMA transfer error */
Kojto 112:6f327212ef96 259
Kojto 112:6f327212ef96 260 /**
Kojto 112:6f327212ef96 261 * @}
Kojto 112:6f327212ef96 262 */
Kojto 112:6f327212ef96 263
Kojto 112:6f327212ef96 264 /** @defgroup ADC_ClockPrescaler ADC ClockPrescaler
Kojto 112:6f327212ef96 265 * @{
Kojto 112:6f327212ef96 266 */
Kojto 112:6f327212ef96 267 #define ADC_CLOCK_ASYNC_DIV1 ((uint32_t)0x00000000) /*!< ADC asynchronous clock derived from ADC dedicated HSI without prescaler */
Kojto 112:6f327212ef96 268 #define ADC_CLOCK_ASYNC_DIV2 ((uint32_t)ADC_CCR_ADCPRE_0) /*!< ADC asynchronous clock derived from ADC dedicated HSI divided by a prescaler of 2 */
Kojto 112:6f327212ef96 269 #define ADC_CLOCK_ASYNC_DIV4 ((uint32_t)ADC_CCR_ADCPRE_1) /*!< ADC asynchronous clock derived from ADC dedicated HSI divided by a prescaler of 4 */
Kojto 112:6f327212ef96 270
Kojto 112:6f327212ef96 271 #define IS_ADC_CLOCKPRESCALER(ADC_CLOCK) (((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV1) || \
Kojto 112:6f327212ef96 272 ((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV2) || \
Kojto 112:6f327212ef96 273 ((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV4) )
Kojto 112:6f327212ef96 274 /**
Kojto 112:6f327212ef96 275 * @}
Kojto 112:6f327212ef96 276 */
Kojto 112:6f327212ef96 277
Kojto 112:6f327212ef96 278 /** @defgroup ADC_Resolution ADC Resolution
Kojto 112:6f327212ef96 279 * @{
Kojto 112:6f327212ef96 280 */
Kojto 112:6f327212ef96 281 #define ADC_RESOLUTION12b ((uint32_t)0x00000000) /*!< ADC 12-bit resolution */
Kojto 112:6f327212ef96 282 #define ADC_RESOLUTION10b ((uint32_t)ADC_CR1_RES_0) /*!< ADC 10-bit resolution */
Kojto 112:6f327212ef96 283 #define ADC_RESOLUTION8b ((uint32_t)ADC_CR1_RES_1) /*!< ADC 8-bit resolution */
Kojto 112:6f327212ef96 284 #define ADC_RESOLUTION6b ((uint32_t)ADC_CR1_RES) /*!< ADC 6-bit resolution */
Kojto 112:6f327212ef96 285
Kojto 112:6f327212ef96 286 #define IS_ADC_RESOLUTION(RESOLUTION) (((RESOLUTION) == ADC_RESOLUTION12b) || \
Kojto 112:6f327212ef96 287 ((RESOLUTION) == ADC_RESOLUTION10b) || \
Kojto 112:6f327212ef96 288 ((RESOLUTION) == ADC_RESOLUTION8b) || \
Kojto 112:6f327212ef96 289 ((RESOLUTION) == ADC_RESOLUTION6b) )
Kojto 112:6f327212ef96 290
Kojto 112:6f327212ef96 291 #define IS_ADC_RESOLUTION_8_6_BITS(RESOLUTION) (((RESOLUTION) == ADC_RESOLUTION8b) || \
Kojto 112:6f327212ef96 292 ((RESOLUTION) == ADC_RESOLUTION6b) )
Kojto 112:6f327212ef96 293 /**
Kojto 112:6f327212ef96 294 * @}
Kojto 112:6f327212ef96 295 */
Kojto 112:6f327212ef96 296
Kojto 112:6f327212ef96 297 /** @defgroup ADC_Data_align ADC Data_align
Kojto 112:6f327212ef96 298 * @{
Kojto 112:6f327212ef96 299 */
Kojto 112:6f327212ef96 300 #define ADC_DATAALIGN_RIGHT ((uint32_t)0x00000000)
Kojto 112:6f327212ef96 301 #define ADC_DATAALIGN_LEFT ((uint32_t)ADC_CR2_ALIGN)
Kojto 112:6f327212ef96 302
Kojto 112:6f327212ef96 303 #define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DATAALIGN_RIGHT) || \
Kojto 112:6f327212ef96 304 ((ALIGN) == ADC_DATAALIGN_LEFT) )
Kojto 112:6f327212ef96 305 /**
Kojto 112:6f327212ef96 306 * @}
Kojto 112:6f327212ef96 307 */
Kojto 112:6f327212ef96 308
Kojto 112:6f327212ef96 309 /** @defgroup ADC_Scan_mode ADC Scan mode
Kojto 112:6f327212ef96 310 * @{
Kojto 112:6f327212ef96 311 */
Kojto 112:6f327212ef96 312 #define ADC_SCAN_DISABLE ((uint32_t)0x00000000)
Kojto 112:6f327212ef96 313 #define ADC_SCAN_ENABLE ((uint32_t)0x00000001)
Kojto 112:6f327212ef96 314
Kojto 112:6f327212ef96 315 #define IS_ADC_SCAN_MODE(SCAN_MODE) (((SCAN_MODE) == ADC_SCAN_DISABLE) || \
Kojto 112:6f327212ef96 316 ((SCAN_MODE) == ADC_SCAN_ENABLE) )
Kojto 112:6f327212ef96 317 /**
Kojto 112:6f327212ef96 318 * @}
Kojto 112:6f327212ef96 319 */
Kojto 112:6f327212ef96 320
Kojto 112:6f327212ef96 321 /** @defgroup ADC_External_trigger_edge_Regular ADC External trigger edge Regular
Kojto 112:6f327212ef96 322 * @{
Kojto 112:6f327212ef96 323 */
Kojto 112:6f327212ef96 324 #define ADC_EXTERNALTRIGCONVEDGE_NONE ((uint32_t)0x00000000)
Kojto 112:6f327212ef96 325 #define ADC_EXTERNALTRIGCONVEDGE_RISING ((uint32_t)ADC_CR2_EXTEN_0)
Kojto 112:6f327212ef96 326 #define ADC_EXTERNALTRIGCONVEDGE_FALLING ((uint32_t)ADC_CR2_EXTEN_1)
Kojto 112:6f327212ef96 327 #define ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING ((uint32_t)ADC_CR2_EXTEN)
Kojto 112:6f327212ef96 328
Kojto 112:6f327212ef96 329 #define IS_ADC_EXTTRIG_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGCONVEDGE_NONE) || \
Kojto 112:6f327212ef96 330 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISING) || \
Kojto 112:6f327212ef96 331 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_FALLING) || \
Kojto 112:6f327212ef96 332 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING) )
Kojto 112:6f327212ef96 333 /**
Kojto 112:6f327212ef96 334 * @}
Kojto 112:6f327212ef96 335 */
Kojto 112:6f327212ef96 336
Kojto 112:6f327212ef96 337 /** @defgroup ADC_External_trigger_source_Regular ADC External trigger source Regular
Kojto 112:6f327212ef96 338 * @{
Kojto 112:6f327212ef96 339 */
Kojto 112:6f327212ef96 340 /* List of external triggers with generic trigger name, sorted by trigger */
Kojto 112:6f327212ef96 341 /* name: */
Kojto 112:6f327212ef96 342
Kojto 112:6f327212ef96 343 /* External triggers of regular group for ADC1 */
Kojto 112:6f327212ef96 344 #define ADC_EXTERNALTRIGCONV_T2_CC3 ADC_EXTERNALTRIG_T2_CC3
Kojto 112:6f327212ef96 345 #define ADC_EXTERNALTRIGCONV_T2_CC2 ADC_EXTERNALTRIG_T2_CC2
Kojto 112:6f327212ef96 346 #define ADC_EXTERNALTRIGCONV_T2_TRGO ADC_EXTERNALTRIG_T2_TRGO
Kojto 112:6f327212ef96 347 #define ADC_EXTERNALTRIGCONV_T3_CC1 ADC_EXTERNALTRIG_T3_CC1
Kojto 112:6f327212ef96 348 #define ADC_EXTERNALTRIGCONV_T3_CC3 ADC_EXTERNALTRIG_T3_CC3
Kojto 112:6f327212ef96 349 #define ADC_EXTERNALTRIGCONV_T3_TRGO ADC_EXTERNALTRIG_T3_TRGO
Kojto 112:6f327212ef96 350 #define ADC_EXTERNALTRIGCONV_T4_CC4 ADC_EXTERNALTRIG_T4_CC4
Kojto 112:6f327212ef96 351 #define ADC_EXTERNALTRIGCONV_T4_TRGO ADC_EXTERNALTRIG_T4_TRGO
Kojto 112:6f327212ef96 352 #define ADC_EXTERNALTRIGCONV_T6_TRGO ADC_EXTERNALTRIG_T6_TRGO
Kojto 112:6f327212ef96 353 #define ADC_EXTERNALTRIGCONV_T9_CC2 ADC_EXTERNALTRIG_T9_CC2
Kojto 112:6f327212ef96 354 #define ADC_EXTERNALTRIGCONV_T9_TRGO ADC_EXTERNALTRIG_T9_TRGO
Kojto 112:6f327212ef96 355 #define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC_EXTERNALTRIG_EXT_IT11
Kojto 112:6f327212ef96 356
Kojto 112:6f327212ef96 357 #define ADC_SOFTWARE_START ((uint32_t)0x00000010)
Kojto 112:6f327212ef96 358
Kojto 112:6f327212ef96 359 #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC3) || \
Kojto 112:6f327212ef96 360 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
Kojto 112:6f327212ef96 361 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \
Kojto 112:6f327212ef96 362 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC1) || \
Kojto 112:6f327212ef96 363 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC3) || \
Kojto 112:6f327212ef96 364 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
Kojto 112:6f327212ef96 365 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
Kojto 112:6f327212ef96 366 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_TRGO) || \
Kojto 112:6f327212ef96 367 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T6_TRGO) || \
Kojto 112:6f327212ef96 368 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T9_CC2) || \
Kojto 112:6f327212ef96 369 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T9_TRGO) || \
Kojto 112:6f327212ef96 370 ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
Kojto 112:6f327212ef96 371 ((REGTRIG) == ADC_SOFTWARE_START) )
Kojto 112:6f327212ef96 372 /**
Kojto 112:6f327212ef96 373 * @}
Kojto 112:6f327212ef96 374 */
Kojto 112:6f327212ef96 375
Kojto 112:6f327212ef96 376 /** @defgroup ADC_Internal_HAL_driver_Ext_trig_src_Regular ADC Internal HAL driver Ext trig src Regular
Kojto 112:6f327212ef96 377 * @{
Kojto 112:6f327212ef96 378 */
Kojto 112:6f327212ef96 379
Kojto 112:6f327212ef96 380 /* List of external triggers of regular group for ADC1: */
Kojto 112:6f327212ef96 381 /* (used internally by HAL driver. To not use into HAL structure parameters) */
Kojto 112:6f327212ef96 382
Kojto 112:6f327212ef96 383 /* External triggers of regular group for ADC1 */
Kojto 112:6f327212ef96 384 #define ADC_EXTERNALTRIG_T9_CC2 ((uint32_t) 0x00000000)
Kojto 112:6f327212ef96 385 #define ADC_EXTERNALTRIG_T9_TRGO ((uint32_t)( ADC_CR2_EXTSEL_0))
Kojto 112:6f327212ef96 386 #define ADC_EXTERNALTRIG_T2_CC3 ((uint32_t)( ADC_CR2_EXTSEL_1 ))
Kojto 112:6f327212ef96 387 #define ADC_EXTERNALTRIG_T2_CC2 ((uint32_t)( ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
Kojto 112:6f327212ef96 388 #define ADC_EXTERNALTRIG_T3_TRGO ((uint32_t)( ADC_CR2_EXTSEL_2 ))
Kojto 112:6f327212ef96 389 #define ADC_EXTERNALTRIG_T4_CC4 ((uint32_t)( ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0))
Kojto 112:6f327212ef96 390 #define ADC_EXTERNALTRIG_T2_TRGO ((uint32_t)( ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 ))
Kojto 112:6f327212ef96 391 #define ADC_EXTERNALTRIG_T3_CC1 ((uint32_t)( ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
Kojto 112:6f327212ef96 392 #define ADC_EXTERNALTRIG_T3_CC3 ((uint32_t)(ADC_CR2_EXTSEL_3 ))
Kojto 112:6f327212ef96 393 #define ADC_EXTERNALTRIG_T4_TRGO ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_0))
Kojto 112:6f327212ef96 394 #define ADC_EXTERNALTRIG_T6_TRGO ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_1 ))
Kojto 112:6f327212ef96 395 #define ADC_EXTERNALTRIG_EXT_IT11 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
Kojto 112:6f327212ef96 396
Kojto 112:6f327212ef96 397 /**
Kojto 112:6f327212ef96 398 * @}
Kojto 112:6f327212ef96 399 */
Kojto 112:6f327212ef96 400
Kojto 112:6f327212ef96 401 /** @defgroup ADC_EOCSelection ADC EOCSelection
Kojto 112:6f327212ef96 402 * @{
Kojto 112:6f327212ef96 403 */
Kojto 112:6f327212ef96 404 #define EOC_SEQ_CONV ((uint32_t)0x00000000)
Kojto 112:6f327212ef96 405 #define EOC_SINGLE_CONV ((uint32_t)ADC_CR2_EOCS)
Kojto 112:6f327212ef96 406
Kojto 112:6f327212ef96 407 #define IS_ADC_EOC_SELECTION(EOC_SELECTION) (((EOC_SELECTION) == EOC_SINGLE_CONV) || \
Kojto 112:6f327212ef96 408 ((EOC_SELECTION) == EOC_SEQ_CONV) )
Kojto 112:6f327212ef96 409 /**
Kojto 112:6f327212ef96 410 * @}
Kojto 112:6f327212ef96 411 */
Kojto 112:6f327212ef96 412
Kojto 112:6f327212ef96 413 /** @defgroup ADC_LowPowerAutoWait ADC LowPowerAutoWait
Kojto 112:6f327212ef96 414 * @{
Kojto 112:6f327212ef96 415 */
Kojto 112:6f327212ef96 416 /*!< Note : For compatibility with other STM32 devices with ADC autowait */
Kojto 112:6f327212ef96 417 /* feature limited to enable or disable settings: */
Kojto 112:6f327212ef96 418 /* Setting "ADC_AUTOWAIT_UNTIL_DATA_READ" is equivalent to "ENABLE". */
Kojto 112:6f327212ef96 419
Kojto 112:6f327212ef96 420 #define ADC_AUTOWAIT_DISABLE ((uint32_t)0x00000000)
Kojto 112:6f327212ef96 421 #define ADC_AUTOWAIT_UNTIL_DATA_READ ((uint32_t)( ADC_CR2_DELS_0)) /*!< Insert a delay between ADC conversions: infinite delay, until the result of previous conversion is read */
Kojto 112:6f327212ef96 422 #define ADC_AUTOWAIT_7_APBCLOCKCYCLES ((uint32_t)( ADC_CR2_DELS_1 )) /*!< Insert a delay between ADC conversions: 7 APB clock cycles */
Kojto 112:6f327212ef96 423 #define ADC_AUTOWAIT_15_APBCLOCKCYCLES ((uint32_t)( ADC_CR2_DELS_1 | ADC_CR2_DELS_0)) /*!< Insert a delay between ADC conversions: 15 APB clock cycles */
Kojto 112:6f327212ef96 424 #define ADC_AUTOWAIT_31_APBCLOCKCYCLES ((uint32_t)(ADC_CR2_DELS_2 )) /*!< Insert a delay between ADC conversions: 31 APB clock cycles */
Kojto 112:6f327212ef96 425 #define ADC_AUTOWAIT_63_APBCLOCKCYCLES ((uint32_t)(ADC_CR2_DELS_2 | ADC_CR2_DELS_0)) /*!< Insert a delay between ADC conversions: 63 APB clock cycles */
Kojto 112:6f327212ef96 426 #define ADC_AUTOWAIT_127_APBCLOCKCYCLES ((uint32_t)(ADC_CR2_DELS_2 | ADC_CR2_DELS_1 )) /*!< Insert a delay between ADC conversions: 127 APB clock cycles */
Kojto 112:6f327212ef96 427 #define ADC_AUTOWAIT_255_APBCLOCKCYCLES ((uint32_t)(ADC_CR2_DELS_2 | ADC_CR2_DELS_1 | ADC_CR2_DELS_0)) /*!< Insert a delay between ADC conversions: 255 APB clock cycles */
Kojto 112:6f327212ef96 428
Kojto 112:6f327212ef96 429 #define IS_ADC_AUTOWAIT(AUTOWAIT) (((AUTOWAIT) == ADC_AUTOWAIT_DISABLE) || \
Kojto 112:6f327212ef96 430 ((AUTOWAIT) == ADC_AUTOWAIT_UNTIL_DATA_READ) || \
Kojto 112:6f327212ef96 431 ((AUTOWAIT) == ADC_AUTOWAIT_7_APBCLOCKCYCLES) || \
Kojto 112:6f327212ef96 432 ((AUTOWAIT) == ADC_AUTOWAIT_15_APBCLOCKCYCLES) || \
Kojto 112:6f327212ef96 433 ((AUTOWAIT) == ADC_AUTOWAIT_31_APBCLOCKCYCLES) || \
Kojto 112:6f327212ef96 434 ((AUTOWAIT) == ADC_AUTOWAIT_63_APBCLOCKCYCLES) || \
Kojto 112:6f327212ef96 435 ((AUTOWAIT) == ADC_AUTOWAIT_127_APBCLOCKCYCLES) || \
Kojto 112:6f327212ef96 436 ((AUTOWAIT) == ADC_AUTOWAIT_255_APBCLOCKCYCLES) )
Kojto 112:6f327212ef96 437 /**
Kojto 112:6f327212ef96 438 * @}
Kojto 112:6f327212ef96 439 */
Kojto 112:6f327212ef96 440
Kojto 112:6f327212ef96 441 /** @defgroup ADC_LowPowerAutoPowerOff ADC LowPowerAutoPowerOff
Kojto 112:6f327212ef96 442 * @{
Kojto 112:6f327212ef96 443 */
Kojto 112:6f327212ef96 444 #define ADC_AUTOPOWEROFF_DISABLE ((uint32_t)0x00000000)
Kojto 112:6f327212ef96 445 #define ADC_AUTOPOWEROFF_IDLE_PHASE ((uint32_t)ADC_CR1_PDI) /*!< ADC power off when ADC is not converting (idle phase) */
Kojto 112:6f327212ef96 446 #define ADC_AUTOPOWEROFF_DELAY_PHASE ((uint32_t)ADC_CR1_PDD) /*!< ADC power off when a delay is inserted between conversions (see parameter ADC_LowPowerAutoWait) */
Kojto 112:6f327212ef96 447 #define ADC_AUTOPOWEROFF_IDLE_DELAY_PHASES ((uint32_t)(ADC_CR1_PDI | ADC_CR1_PDD)) /*!< ADC power off when ADC is not converting (idle phase) and when a delay is inserted between conversions */
Kojto 112:6f327212ef96 448
Kojto 112:6f327212ef96 449 #define IS_ADC_AUTOPOWEROFF(AUTOPOWEROFF) (((AUTOPOWEROFF) == ADC_AUTOPOWEROFF_DISABLE) || \
Kojto 112:6f327212ef96 450 ((AUTOPOWEROFF) == ADC_AUTOPOWEROFF_IDLE_PHASE) || \
Kojto 112:6f327212ef96 451 ((AUTOPOWEROFF) == ADC_AUTOPOWEROFF_DELAY_PHASE) || \
Kojto 112:6f327212ef96 452 ((AUTOPOWEROFF) == ADC_AUTOPOWEROFF_IDLE_DELAY_PHASES) )
Kojto 112:6f327212ef96 453 /**
Kojto 112:6f327212ef96 454 * @}
Kojto 112:6f327212ef96 455 */
Kojto 112:6f327212ef96 456
Kojto 112:6f327212ef96 457
Kojto 112:6f327212ef96 458 /** @defgroup ADC_ChannelsBank ADC ChannelsBank
Kojto 112:6f327212ef96 459 * @{
Kojto 112:6f327212ef96 460 */
Kojto 112:6f327212ef96 461 #if defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
Kojto 112:6f327212ef96 462 #define ADC_CHANNELS_BANK_A ((uint32_t)0x00000000)
Kojto 112:6f327212ef96 463 #define ADC_CHANNELS_BANK_B ((uint32_t)ADC_CR2_CFG)
Kojto 112:6f327212ef96 464
Kojto 112:6f327212ef96 465 #define IS_ADC_CHANNELSBANK(BANK) (((BANK) == ADC_CHANNELS_BANK_A) || \
Kojto 112:6f327212ef96 466 ((BANK) == ADC_CHANNELS_BANK_B) )
Kojto 112:6f327212ef96 467 #else
Kojto 112:6f327212ef96 468 #define ADC_CHANNELS_BANK_A ((uint32_t)0x00000000)
Kojto 112:6f327212ef96 469
Kojto 112:6f327212ef96 470 #define IS_ADC_CHANNELSBANK(BANK) (((BANK) == ADC_CHANNELS_BANK_A))
Kojto 112:6f327212ef96 471 #endif /* STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
Kojto 112:6f327212ef96 472 /**
Kojto 112:6f327212ef96 473 * @}
Kojto 112:6f327212ef96 474 */
Kojto 112:6f327212ef96 475
Kojto 112:6f327212ef96 476 /** @defgroup ADC_channels ADC channels
Kojto 112:6f327212ef96 477 * @{
Kojto 112:6f327212ef96 478 */
Kojto 112:6f327212ef96 479 /* Note: Depending on devices, some channels may not be available on package */
Kojto 112:6f327212ef96 480 /* pins. Refer to device datasheet for channels availability. */
Kojto 112:6f327212ef96 481 #define ADC_CHANNEL_0 ((uint32_t)0x00000000) /* Channel different in bank A and bank B */
Kojto 112:6f327212ef96 482 #define ADC_CHANNEL_1 ((uint32_t)( ADC_SQR5_SQ1_0)) /* Channel different in bank A and bank B */
Kojto 112:6f327212ef96 483 #define ADC_CHANNEL_2 ((uint32_t)( ADC_SQR5_SQ1_1 )) /* Channel different in bank A and bank B */
Kojto 112:6f327212ef96 484 #define ADC_CHANNEL_3 ((uint32_t)( ADC_SQR5_SQ1_1 | ADC_SQR5_SQ1_0)) /* Channel different in bank A and bank B */
Kojto 112:6f327212ef96 485 #define ADC_CHANNEL_4 ((uint32_t)( ADC_SQR5_SQ1_2 )) /* Direct (fast) channel */
Kojto 112:6f327212ef96 486 #define ADC_CHANNEL_5 ((uint32_t)( ADC_SQR5_SQ1_2 | ADC_SQR5_SQ1_0)) /* Direct (fast) channel */
Kojto 112:6f327212ef96 487 #define ADC_CHANNEL_6 ((uint32_t)( ADC_SQR5_SQ1_2 | ADC_SQR5_SQ1_1 )) /* Channel different in bank A and bank B */
Kojto 112:6f327212ef96 488 #define ADC_CHANNEL_7 ((uint32_t)( ADC_SQR5_SQ1_2 | ADC_SQR5_SQ1_1 | ADC_SQR5_SQ1_0)) /* Channel different in bank A and bank B */
Kojto 112:6f327212ef96 489 #define ADC_CHANNEL_8 ((uint32_t)( ADC_SQR5_SQ1_3 )) /* Channel different in bank A and bank B */
Kojto 112:6f327212ef96 490 #define ADC_CHANNEL_9 ((uint32_t)( ADC_SQR5_SQ1_3 | ADC_SQR5_SQ1_0)) /* Channel different in bank A and bank B */
Kojto 112:6f327212ef96 491 #define ADC_CHANNEL_10 ((uint32_t)( ADC_SQR5_SQ1_3 | ADC_SQR5_SQ1_1 )) /* Channel different in bank A and bank B */
Kojto 112:6f327212ef96 492 #define ADC_CHANNEL_11 ((uint32_t)( ADC_SQR5_SQ1_3 | ADC_SQR5_SQ1_1 | ADC_SQR5_SQ1_0)) /* Channel different in bank A and bank B */
Kojto 112:6f327212ef96 493 #define ADC_CHANNEL_12 ((uint32_t)( ADC_SQR5_SQ1_3 | ADC_SQR5_SQ1_2 )) /* Channel different in bank A and bank B */
Kojto 112:6f327212ef96 494 #define ADC_CHANNEL_13 ((uint32_t)( ADC_SQR5_SQ1_3 | ADC_SQR5_SQ1_2 | ADC_SQR5_SQ1_0)) /* Channel common to both bank A and bank B */
Kojto 112:6f327212ef96 495 #define ADC_CHANNEL_14 ((uint32_t)( ADC_SQR5_SQ1_3 | ADC_SQR5_SQ1_2 | ADC_SQR5_SQ1_1 )) /* Channel common to both bank A and bank B */
Kojto 112:6f327212ef96 496 #define ADC_CHANNEL_15 ((uint32_t)( ADC_SQR5_SQ1_3 | ADC_SQR5_SQ1_2 | ADC_SQR5_SQ1_1 | ADC_SQR5_SQ1_0)) /* Channel common to both bank A and bank B */
Kojto 112:6f327212ef96 497 #define ADC_CHANNEL_16 ((uint32_t)(ADC_SQR5_SQ1_4 )) /* Channel common to both bank A and bank B */
Kojto 112:6f327212ef96 498 #define ADC_CHANNEL_17 ((uint32_t)(ADC_SQR5_SQ1_4 | ADC_SQR5_SQ1_0)) /* Channel common to both bank A and bank B */
Kojto 112:6f327212ef96 499 #define ADC_CHANNEL_18 ((uint32_t)(ADC_SQR5_SQ1_4 | ADC_SQR5_SQ1_1 )) /* Channel common to both bank A and bank B */
Kojto 112:6f327212ef96 500 #define ADC_CHANNEL_19 ((uint32_t)(ADC_SQR5_SQ1_4 | ADC_SQR5_SQ1_1 | ADC_SQR5_SQ1_0)) /* Channel common to both bank A and bank B */
Kojto 112:6f327212ef96 501 #define ADC_CHANNEL_20 ((uint32_t)(ADC_SQR5_SQ1_4 | ADC_SQR5_SQ1_2 )) /* Channel common to both bank A and bank B */
Kojto 112:6f327212ef96 502 #define ADC_CHANNEL_21 ((uint32_t)(ADC_SQR5_SQ1_4 | ADC_SQR5_SQ1_2 | ADC_SQR5_SQ1_0)) /* Channel common to both bank A and bank B */
Kojto 112:6f327212ef96 503 #define ADC_CHANNEL_22 ((uint32_t)(ADC_SQR5_SQ1_4 | ADC_SQR5_SQ1_2 | ADC_SQR5_SQ1_1 )) /* Direct (fast) channel */
Kojto 112:6f327212ef96 504 #define ADC_CHANNEL_23 ((uint32_t)(ADC_SQR5_SQ1_4 | ADC_SQR5_SQ1_2 | ADC_SQR5_SQ1_1 | ADC_SQR5_SQ1_0)) /* Direct (fast) channel */
Kojto 112:6f327212ef96 505 #define ADC_CHANNEL_24 ((uint32_t)(ADC_SQR5_SQ1_4 | ADC_SQR5_SQ1_3 )) /* Direct (fast) channel */
Kojto 112:6f327212ef96 506 #define ADC_CHANNEL_25 ((uint32_t)(ADC_SQR5_SQ1_4 | ADC_SQR5_SQ1_3 | ADC_SQR5_SQ1_0)) /* Direct (fast) channel */
Kojto 112:6f327212ef96 507 #define ADC_CHANNEL_26 ((uint32_t)(ADC_SQR5_SQ1_4 | ADC_SQR5_SQ1_3 | ADC_SQR5_SQ1_1 )) /* Channel common to both bank A and bank B */
Kojto 112:6f327212ef96 508 #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
Kojto 112:6f327212ef96 509 #define ADC_CHANNEL_27 ((uint32_t)(ADC_SQR5_SQ1_4 | ADC_SQR5_SQ1_3 | ADC_SQR5_SQ1_1 | ADC_SQR5_SQ1_0)) /* Channel common to both bank A and bank B */
Kojto 112:6f327212ef96 510 #define ADC_CHANNEL_28 ((uint32_t)(ADC_SQR5_SQ1_4 | ADC_SQR5_SQ1_3 | ADC_SQR5_SQ1_2 )) /* Channel common to both bank A and bank B */
Kojto 112:6f327212ef96 511 #define ADC_CHANNEL_29 ((uint32_t)(ADC_SQR5_SQ1_4 | ADC_SQR5_SQ1_3 | ADC_SQR5_SQ1_2 | ADC_SQR5_SQ1_0)) /* Channel common to both bank A and bank B */
Kojto 112:6f327212ef96 512 #define ADC_CHANNEL_30 ((uint32_t)(ADC_SQR5_SQ1_4 | ADC_SQR5_SQ1_3 | ADC_SQR5_SQ1_2 | ADC_SQR5_SQ1_1 )) /* Channel common to both bank A and bank B */
Kojto 112:6f327212ef96 513 #define ADC_CHANNEL_31 ((uint32_t)(ADC_SQR5_SQ1_4 | ADC_SQR5_SQ1_3 | ADC_SQR5_SQ1_2 | ADC_SQR5_SQ1_1 | ADC_SQR5_SQ1_0)) /* Channel common to both bank A and bank B */
Kojto 112:6f327212ef96 514 #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
Kojto 112:6f327212ef96 515
Kojto 112:6f327212ef96 516 #define ADC_CHANNEL_TEMPSENSOR ADC_CHANNEL_16 /* ADC internal channel (no connection on device pin). Channel common to both bank A and bank B. */
Kojto 112:6f327212ef96 517 #define ADC_CHANNEL_VREFINT ADC_CHANNEL_17 /* ADC internal channel (no connection on device pin). Channel common to both bank A and bank B. */
Kojto 112:6f327212ef96 518 #define ADC_CHANNEL_VCOMP ADC_CHANNEL_26 /* ADC internal channel (no connection on device pin). Channel common to both bank A and bank B. */
Kojto 112:6f327212ef96 519
Kojto 112:6f327212ef96 520 #if defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
Kojto 112:6f327212ef96 521 #define ADC_CHANNEL_VOPAMP1 ADC_CHANNEL_3 /* Internal connection from OPAMP1 output to ADC switch matrix */
Kojto 112:6f327212ef96 522 #define ADC_CHANNEL_VOPAMP2 ADC_CHANNEL_8 /* Internal connection from OPAMP2 output to ADC switch matrix */
Kojto 112:6f327212ef96 523 #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD)
Kojto 112:6f327212ef96 524 #define ADC_CHANNEL_VOPAMP3 ADC_CHANNEL_13 /* Internal connection from OPAMP3 output to ADC switch matrix */
Kojto 112:6f327212ef96 525 #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD */
Kojto 112:6f327212ef96 526 #endif /* STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
Kojto 112:6f327212ef96 527
Kojto 112:6f327212ef96 528 #if defined(STM32L100xB) || defined (STM32L151xB) || defined (STM32L152xB) || defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC)
Kojto 112:6f327212ef96 529 #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) == ADC_CHANNEL_0) || \
Kojto 112:6f327212ef96 530 ((CHANNEL) == ADC_CHANNEL_1) || \
Kojto 112:6f327212ef96 531 ((CHANNEL) == ADC_CHANNEL_2) || \
Kojto 112:6f327212ef96 532 ((CHANNEL) == ADC_CHANNEL_3) || \
Kojto 112:6f327212ef96 533 ((CHANNEL) == ADC_CHANNEL_4) || \
Kojto 112:6f327212ef96 534 ((CHANNEL) == ADC_CHANNEL_5) || \
Kojto 112:6f327212ef96 535 ((CHANNEL) == ADC_CHANNEL_6) || \
Kojto 112:6f327212ef96 536 ((CHANNEL) == ADC_CHANNEL_7) || \
Kojto 112:6f327212ef96 537 ((CHANNEL) == ADC_CHANNEL_8) || \
Kojto 112:6f327212ef96 538 ((CHANNEL) == ADC_CHANNEL_9) || \
Kojto 112:6f327212ef96 539 ((CHANNEL) == ADC_CHANNEL_10) || \
Kojto 112:6f327212ef96 540 ((CHANNEL) == ADC_CHANNEL_11) || \
Kojto 112:6f327212ef96 541 ((CHANNEL) == ADC_CHANNEL_12) || \
Kojto 112:6f327212ef96 542 ((CHANNEL) == ADC_CHANNEL_13) || \
Kojto 112:6f327212ef96 543 ((CHANNEL) == ADC_CHANNEL_14) || \
Kojto 112:6f327212ef96 544 ((CHANNEL) == ADC_CHANNEL_15) || \
Kojto 112:6f327212ef96 545 ((CHANNEL) == ADC_CHANNEL_16) || \
Kojto 112:6f327212ef96 546 ((CHANNEL) == ADC_CHANNEL_17) || \
Kojto 112:6f327212ef96 547 ((CHANNEL) == ADC_CHANNEL_18) || \
Kojto 112:6f327212ef96 548 ((CHANNEL) == ADC_CHANNEL_19) || \
Kojto 112:6f327212ef96 549 ((CHANNEL) == ADC_CHANNEL_20) || \
Kojto 112:6f327212ef96 550 ((CHANNEL) == ADC_CHANNEL_21) || \
Kojto 112:6f327212ef96 551 ((CHANNEL) == ADC_CHANNEL_22) || \
Kojto 112:6f327212ef96 552 ((CHANNEL) == ADC_CHANNEL_23) || \
Kojto 112:6f327212ef96 553 ((CHANNEL) == ADC_CHANNEL_24) || \
Kojto 112:6f327212ef96 554 ((CHANNEL) == ADC_CHANNEL_25) || \
Kojto 112:6f327212ef96 555 ((CHANNEL) == ADC_CHANNEL_26) )
Kojto 112:6f327212ef96 556 #endif /* STM32L100xB || STM32L151xB || STM32L152xB || STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC */
Kojto 112:6f327212ef96 557 #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
Kojto 112:6f327212ef96 558 #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) == ADC_CHANNEL_0) || \
Kojto 112:6f327212ef96 559 ((CHANNEL) == ADC_CHANNEL_1) || \
Kojto 112:6f327212ef96 560 ((CHANNEL) == ADC_CHANNEL_2) || \
Kojto 112:6f327212ef96 561 ((CHANNEL) == ADC_CHANNEL_3) || \
Kojto 112:6f327212ef96 562 ((CHANNEL) == ADC_CHANNEL_4) || \
Kojto 112:6f327212ef96 563 ((CHANNEL) == ADC_CHANNEL_5) || \
Kojto 112:6f327212ef96 564 ((CHANNEL) == ADC_CHANNEL_6) || \
Kojto 112:6f327212ef96 565 ((CHANNEL) == ADC_CHANNEL_7) || \
Kojto 112:6f327212ef96 566 ((CHANNEL) == ADC_CHANNEL_8) || \
Kojto 112:6f327212ef96 567 ((CHANNEL) == ADC_CHANNEL_9) || \
Kojto 112:6f327212ef96 568 ((CHANNEL) == ADC_CHANNEL_10) || \
Kojto 112:6f327212ef96 569 ((CHANNEL) == ADC_CHANNEL_11) || \
Kojto 112:6f327212ef96 570 ((CHANNEL) == ADC_CHANNEL_12) || \
Kojto 112:6f327212ef96 571 ((CHANNEL) == ADC_CHANNEL_13) || \
Kojto 112:6f327212ef96 572 ((CHANNEL) == ADC_CHANNEL_14) || \
Kojto 112:6f327212ef96 573 ((CHANNEL) == ADC_CHANNEL_15) || \
Kojto 112:6f327212ef96 574 ((CHANNEL) == ADC_CHANNEL_16) || \
Kojto 112:6f327212ef96 575 ((CHANNEL) == ADC_CHANNEL_17) || \
Kojto 112:6f327212ef96 576 ((CHANNEL) == ADC_CHANNEL_18) || \
Kojto 112:6f327212ef96 577 ((CHANNEL) == ADC_CHANNEL_19) || \
Kojto 112:6f327212ef96 578 ((CHANNEL) == ADC_CHANNEL_20) || \
Kojto 112:6f327212ef96 579 ((CHANNEL) == ADC_CHANNEL_21) || \
Kojto 112:6f327212ef96 580 ((CHANNEL) == ADC_CHANNEL_22) || \
Kojto 112:6f327212ef96 581 ((CHANNEL) == ADC_CHANNEL_23) || \
Kojto 112:6f327212ef96 582 ((CHANNEL) == ADC_CHANNEL_24) || \
Kojto 112:6f327212ef96 583 ((CHANNEL) == ADC_CHANNEL_25) || \
Kojto 112:6f327212ef96 584 ((CHANNEL) == ADC_CHANNEL_26) || \
Kojto 112:6f327212ef96 585 ((CHANNEL) == ADC_CHANNEL_27) || \
Kojto 112:6f327212ef96 586 ((CHANNEL) == ADC_CHANNEL_28) || \
Kojto 112:6f327212ef96 587 ((CHANNEL) == ADC_CHANNEL_29) || \
Kojto 112:6f327212ef96 588 ((CHANNEL) == ADC_CHANNEL_30) || \
Kojto 112:6f327212ef96 589 ((CHANNEL) == ADC_CHANNEL_31) )
Kojto 112:6f327212ef96 590 #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
Kojto 112:6f327212ef96 591 /**
Kojto 112:6f327212ef96 592 * @}
Kojto 112:6f327212ef96 593 */
Kojto 112:6f327212ef96 594
Kojto 112:6f327212ef96 595 /** @defgroup ADC_sampling_times ADC sampling times
Kojto 112:6f327212ef96 596 * @{
Kojto 112:6f327212ef96 597 */
Kojto 112:6f327212ef96 598 #define ADC_SAMPLETIME_4CYCLES ((uint32_t)0x00000000) /*!< Sampling time 4 ADC clock cycles */
Kojto 112:6f327212ef96 599 #define ADC_SAMPLETIME_9CYCLES ((uint32_t) ADC_SMPR3_SMP0_0) /*!< Sampling time 9 ADC clock cycles */
Kojto 112:6f327212ef96 600 #define ADC_SAMPLETIME_16CYCLES ((uint32_t) ADC_SMPR3_SMP0_1) /*!< Sampling time 16 ADC clock cycles */
Kojto 112:6f327212ef96 601 #define ADC_SAMPLETIME_24CYCLES ((uint32_t)(ADC_SMPR3_SMP0_1 | ADC_SMPR3_SMP0_0)) /*!< Sampling time 24 ADC clock cycles */
Kojto 112:6f327212ef96 602 #define ADC_SAMPLETIME_48CYCLES ((uint32_t) ADC_SMPR3_SMP0_2) /*!< Sampling time 48 ADC clock cycles */
Kojto 112:6f327212ef96 603 #define ADC_SAMPLETIME_96CYCLES ((uint32_t)(ADC_SMPR3_SMP0_2 | ADC_SMPR3_SMP0_0)) /*!< Sampling time 96 ADC clock cycles */
Kojto 112:6f327212ef96 604 #define ADC_SAMPLETIME_192CYCLES ((uint32_t)(ADC_SMPR3_SMP0_2 | ADC_SMPR3_SMP0_1)) /*!< Sampling time 192 ADC clock cycles */
Kojto 112:6f327212ef96 605 #define ADC_SAMPLETIME_384CYCLES ((uint32_t) ADC_SMPR3_SMP0) /*!< Sampling time 384 ADC clock cycles */
Kojto 112:6f327212ef96 606
Kojto 112:6f327212ef96 607 #define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SAMPLETIME_4CYCLES) || \
Kojto 112:6f327212ef96 608 ((TIME) == ADC_SAMPLETIME_9CYCLES) || \
Kojto 112:6f327212ef96 609 ((TIME) == ADC_SAMPLETIME_16CYCLES) || \
Kojto 112:6f327212ef96 610 ((TIME) == ADC_SAMPLETIME_24CYCLES) || \
Kojto 112:6f327212ef96 611 ((TIME) == ADC_SAMPLETIME_48CYCLES) || \
Kojto 112:6f327212ef96 612 ((TIME) == ADC_SAMPLETIME_96CYCLES) || \
Kojto 112:6f327212ef96 613 ((TIME) == ADC_SAMPLETIME_192CYCLES) || \
Kojto 112:6f327212ef96 614 ((TIME) == ADC_SAMPLETIME_384CYCLES) )
Kojto 112:6f327212ef96 615 /**
Kojto 112:6f327212ef96 616 * @}
Kojto 112:6f327212ef96 617 */
Kojto 112:6f327212ef96 618
Kojto 112:6f327212ef96 619 /** @defgroup ADC_sampling_times_all_channels ADC sampling times all channels
Kojto 112:6f327212ef96 620 * @{
Kojto 112:6f327212ef96 621 */
Kojto 112:6f327212ef96 622 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR3BIT2 \
Kojto 112:6f327212ef96 623 (ADC_SMPR3_SMP9_2 | ADC_SMPR3_SMP8_2 | ADC_SMPR3_SMP7_2 | ADC_SMPR3_SMP6_2 | \
Kojto 112:6f327212ef96 624 ADC_SMPR3_SMP5_2 | ADC_SMPR3_SMP4_2 | ADC_SMPR3_SMP3_2 | ADC_SMPR3_SMP2_2 | \
Kojto 112:6f327212ef96 625 ADC_SMPR3_SMP1_2 | ADC_SMPR3_SMP0_2)
Kojto 112:6f327212ef96 626 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2 \
Kojto 112:6f327212ef96 627 (ADC_SMPR2_SMP19_2 | ADC_SMPR2_SMP18_2 | ADC_SMPR2_SMP17_2 | ADC_SMPR2_SMP16_2 | \
Kojto 112:6f327212ef96 628 ADC_SMPR2_SMP15_2 | ADC_SMPR2_SMP14_2 | ADC_SMPR2_SMP13_2 | ADC_SMPR2_SMP12_2 | \
Kojto 112:6f327212ef96 629 ADC_SMPR2_SMP11_2 | ADC_SMPR2_SMP10_2)
Kojto 112:6f327212ef96 630 #if defined(STM32L100xB) || defined (STM32L151xB) || defined (STM32L152xB) || defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC)
Kojto 112:6f327212ef96 631 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2 \
Kojto 112:6f327212ef96 632 (ADC_SMPR1_SMP26_2 | ADC_SMPR1_SMP25_2 | ADC_SMPR1_SMP24_2 | ADC_SMPR1_SMP23_2 | \
Kojto 112:6f327212ef96 633 ADC_SMPR1_SMP22_2 | ADC_SMPR1_SMP21_2 | ADC_SMPR1_SMP20_2)
Kojto 112:6f327212ef96 634 #endif /* STM32L100xB || STM32L151xB || STM32L152xB || STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC */
Kojto 112:6f327212ef96 635 #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
Kojto 112:6f327212ef96 636 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2 \
Kojto 112:6f327212ef96 637 (ADC_SMPR1_SMP29_2 | ADC_SMPR1_SMP28_2 | ADC_SMPR1_SMP27_2 | ADC_SMPR1_SMP26_2 | \
Kojto 112:6f327212ef96 638 ADC_SMPR1_SMP25_2 | ADC_SMPR1_SMP24_2 | ADC_SMPR1_SMP23_2 | ADC_SMPR1_SMP22_2 | \
Kojto 112:6f327212ef96 639 ADC_SMPR1_SMP21_2 | ADC_SMPR1_SMP20_2)
Kojto 112:6f327212ef96 640 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR0BIT2 \
Kojto 112:6f327212ef96 641 (ADC_SMPR0_SMP31_2 | ADC_SMPR0_SMP30_2 )
Kojto 112:6f327212ef96 642 #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
Kojto 112:6f327212ef96 643
Kojto 112:6f327212ef96 644 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR3BIT1 \
Kojto 112:6f327212ef96 645 (ADC_SMPR3_SMP9_1 | ADC_SMPR3_SMP8_1 | ADC_SMPR3_SMP7_1 | ADC_SMPR3_SMP6_1 | \
Kojto 112:6f327212ef96 646 ADC_SMPR3_SMP5_1 | ADC_SMPR3_SMP4_1 | ADC_SMPR3_SMP3_1 | ADC_SMPR3_SMP2_1 | \
Kojto 112:6f327212ef96 647 ADC_SMPR3_SMP1_1 | ADC_SMPR3_SMP0_1)
Kojto 112:6f327212ef96 648 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1 \
Kojto 112:6f327212ef96 649 (ADC_SMPR2_SMP19_1 | ADC_SMPR2_SMP18_1 | ADC_SMPR2_SMP17_1 | ADC_SMPR2_SMP16_1 | \
Kojto 112:6f327212ef96 650 ADC_SMPR2_SMP15_1 | ADC_SMPR2_SMP14_1 | ADC_SMPR2_SMP13_1 | ADC_SMPR2_SMP12_1 | \
Kojto 112:6f327212ef96 651 ADC_SMPR2_SMP11_1 | ADC_SMPR2_SMP10_1)
Kojto 112:6f327212ef96 652 #if defined(STM32L100xB) || defined (STM32L151xB) || defined (STM32L152xB) || defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC)
Kojto 112:6f327212ef96 653 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1 \
Kojto 112:6f327212ef96 654 (ADC_SMPR1_SMP26_1 | ADC_SMPR1_SMP25_1 | ADC_SMPR1_SMP24_1 | ADC_SMPR1_SMP23_1 | \
Kojto 112:6f327212ef96 655 ADC_SMPR1_SMP22_1 | ADC_SMPR1_SMP21_1 | ADC_SMPR1_SMP20_1)
Kojto 112:6f327212ef96 656 #endif /* STM32L100xB || STM32L151xB || STM32L152xB || STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC */
Kojto 112:6f327212ef96 657 #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
Kojto 112:6f327212ef96 658 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1 \
Kojto 112:6f327212ef96 659 (ADC_SMPR1_SMP29_1 | ADC_SMPR1_SMP28_1 | ADC_SMPR1_SMP27_1 | ADC_SMPR1_SMP26_1 | \
Kojto 112:6f327212ef96 660 ADC_SMPR1_SMP25_1 | ADC_SMPR1_SMP24_1 | ADC_SMPR1_SMP23_1 | ADC_SMPR1_SMP22_1 | \
Kojto 112:6f327212ef96 661 ADC_SMPR1_SMP21_1 | ADC_SMPR1_SMP20_1)
Kojto 112:6f327212ef96 662 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR0BIT1 \
Kojto 112:6f327212ef96 663 (ADC_SMPR0_SMP31_1 | ADC_SMPR0_SMP30_1 )
Kojto 112:6f327212ef96 664 #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
Kojto 112:6f327212ef96 665
Kojto 112:6f327212ef96 666 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR3BIT0 \
Kojto 112:6f327212ef96 667 (ADC_SMPR3_SMP9_0 | ADC_SMPR3_SMP8_0 | ADC_SMPR3_SMP7_0 | ADC_SMPR3_SMP6_0 | \
Kojto 112:6f327212ef96 668 ADC_SMPR3_SMP5_0 | ADC_SMPR3_SMP4_0 | ADC_SMPR3_SMP3_0 | ADC_SMPR3_SMP2_0 | \
Kojto 112:6f327212ef96 669 ADC_SMPR3_SMP1_0 | ADC_SMPR3_SMP0_0)
Kojto 112:6f327212ef96 670 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0 \
Kojto 112:6f327212ef96 671 (ADC_SMPR2_SMP19_0 | ADC_SMPR2_SMP18_0 | ADC_SMPR2_SMP17_0 | ADC_SMPR2_SMP16_0 | \
Kojto 112:6f327212ef96 672 ADC_SMPR2_SMP15_0 | ADC_SMPR2_SMP14_0 | ADC_SMPR2_SMP13_0 | ADC_SMPR2_SMP12_0 | \
Kojto 112:6f327212ef96 673 ADC_SMPR2_SMP11_0 | ADC_SMPR2_SMP10_0)
Kojto 112:6f327212ef96 674 #if defined(STM32L100xB) || defined (STM32L151xB) || defined (STM32L152xB) || defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC)
Kojto 112:6f327212ef96 675 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0 \
Kojto 112:6f327212ef96 676 (ADC_SMPR1_SMP26_0 | ADC_SMPR1_SMP25_0 | ADC_SMPR1_SMP24_0 | ADC_SMPR1_SMP23_0 | \
Kojto 112:6f327212ef96 677 ADC_SMPR1_SMP22_0 | ADC_SMPR1_SMP21_0 | ADC_SMPR1_SMP20_0)
Kojto 112:6f327212ef96 678 #endif /* STM32L100xB || STM32L151xB || STM32L152xB || STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC */
Kojto 112:6f327212ef96 679 #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
Kojto 112:6f327212ef96 680 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0 \
Kojto 112:6f327212ef96 681 (ADC_SMPR1_SMP29_0 | ADC_SMPR1_SMP28_0 | ADC_SMPR1_SMP27_0 | ADC_SMPR1_SMP26_0 | \
Kojto 112:6f327212ef96 682 ADC_SMPR1_SMP25_0 | ADC_SMPR1_SMP24_0 | ADC_SMPR1_SMP23_0 | ADC_SMPR1_SMP22_0 | \
Kojto 112:6f327212ef96 683 ADC_SMPR1_SMP21_0 | ADC_SMPR1_SMP20_0)
Kojto 112:6f327212ef96 684 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR0BIT0 \
Kojto 112:6f327212ef96 685 (ADC_SMPR0_SMP31_0 | ADC_SMPR0_SMP30_0 )
Kojto 112:6f327212ef96 686 #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
Kojto 112:6f327212ef96 687 /**
Kojto 112:6f327212ef96 688 * @}
Kojto 112:6f327212ef96 689 */
Kojto 112:6f327212ef96 690
Kojto 112:6f327212ef96 691 /** @defgroup ADC_regular_rank ADC regular rank
Kojto 112:6f327212ef96 692 * @{
Kojto 112:6f327212ef96 693 */
Kojto 112:6f327212ef96 694 #define ADC_REGULAR_RANK_1 ((uint32_t)0x00000001)
Kojto 112:6f327212ef96 695 #define ADC_REGULAR_RANK_2 ((uint32_t)0x00000002)
Kojto 112:6f327212ef96 696 #define ADC_REGULAR_RANK_3 ((uint32_t)0x00000003)
Kojto 112:6f327212ef96 697 #define ADC_REGULAR_RANK_4 ((uint32_t)0x00000004)
Kojto 112:6f327212ef96 698 #define ADC_REGULAR_RANK_5 ((uint32_t)0x00000005)
Kojto 112:6f327212ef96 699 #define ADC_REGULAR_RANK_6 ((uint32_t)0x00000006)
Kojto 112:6f327212ef96 700 #define ADC_REGULAR_RANK_7 ((uint32_t)0x00000007)
Kojto 112:6f327212ef96 701 #define ADC_REGULAR_RANK_8 ((uint32_t)0x00000008)
Kojto 112:6f327212ef96 702 #define ADC_REGULAR_RANK_9 ((uint32_t)0x00000009)
Kojto 112:6f327212ef96 703 #define ADC_REGULAR_RANK_10 ((uint32_t)0x0000000A)
Kojto 112:6f327212ef96 704 #define ADC_REGULAR_RANK_11 ((uint32_t)0x0000000B)
Kojto 112:6f327212ef96 705 #define ADC_REGULAR_RANK_12 ((uint32_t)0x0000000C)
Kojto 112:6f327212ef96 706 #define ADC_REGULAR_RANK_13 ((uint32_t)0x0000000D)
Kojto 112:6f327212ef96 707 #define ADC_REGULAR_RANK_14 ((uint32_t)0x0000000E)
Kojto 112:6f327212ef96 708 #define ADC_REGULAR_RANK_15 ((uint32_t)0x0000000F)
Kojto 112:6f327212ef96 709 #define ADC_REGULAR_RANK_16 ((uint32_t)0x00000010)
Kojto 112:6f327212ef96 710 #define ADC_REGULAR_RANK_17 ((uint32_t)0x00000011)
Kojto 112:6f327212ef96 711 #define ADC_REGULAR_RANK_18 ((uint32_t)0x00000012)
Kojto 112:6f327212ef96 712 #define ADC_REGULAR_RANK_19 ((uint32_t)0x00000013)
Kojto 112:6f327212ef96 713 #define ADC_REGULAR_RANK_20 ((uint32_t)0x00000014)
Kojto 112:6f327212ef96 714 #define ADC_REGULAR_RANK_21 ((uint32_t)0x00000015)
Kojto 112:6f327212ef96 715 #define ADC_REGULAR_RANK_22 ((uint32_t)0x00000016)
Kojto 112:6f327212ef96 716 #define ADC_REGULAR_RANK_23 ((uint32_t)0x00000017)
Kojto 112:6f327212ef96 717 #define ADC_REGULAR_RANK_24 ((uint32_t)0x00000018)
Kojto 112:6f327212ef96 718 #define ADC_REGULAR_RANK_25 ((uint32_t)0x00000019)
Kojto 112:6f327212ef96 719 #define ADC_REGULAR_RANK_26 ((uint32_t)0x0000001A)
Kojto 112:6f327212ef96 720 #define ADC_REGULAR_RANK_27 ((uint32_t)0x0000001B)
Kojto 112:6f327212ef96 721 #if defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
Kojto 112:6f327212ef96 722 #define ADC_REGULAR_RANK_28 ((uint32_t)0x0000001C)
Kojto 112:6f327212ef96 723
Kojto 112:6f327212ef96 724 #define IS_ADC_REGULAR_RANK(CHANNEL) (((CHANNEL) == ADC_REGULAR_RANK_1 ) || \
Kojto 112:6f327212ef96 725 ((CHANNEL) == ADC_REGULAR_RANK_2 ) || \
Kojto 112:6f327212ef96 726 ((CHANNEL) == ADC_REGULAR_RANK_3 ) || \
Kojto 112:6f327212ef96 727 ((CHANNEL) == ADC_REGULAR_RANK_4 ) || \
Kojto 112:6f327212ef96 728 ((CHANNEL) == ADC_REGULAR_RANK_5 ) || \
Kojto 112:6f327212ef96 729 ((CHANNEL) == ADC_REGULAR_RANK_6 ) || \
Kojto 112:6f327212ef96 730 ((CHANNEL) == ADC_REGULAR_RANK_7 ) || \
Kojto 112:6f327212ef96 731 ((CHANNEL) == ADC_REGULAR_RANK_8 ) || \
Kojto 112:6f327212ef96 732 ((CHANNEL) == ADC_REGULAR_RANK_9 ) || \
Kojto 112:6f327212ef96 733 ((CHANNEL) == ADC_REGULAR_RANK_10) || \
Kojto 112:6f327212ef96 734 ((CHANNEL) == ADC_REGULAR_RANK_11) || \
Kojto 112:6f327212ef96 735 ((CHANNEL) == ADC_REGULAR_RANK_12) || \
Kojto 112:6f327212ef96 736 ((CHANNEL) == ADC_REGULAR_RANK_13) || \
Kojto 112:6f327212ef96 737 ((CHANNEL) == ADC_REGULAR_RANK_14) || \
Kojto 112:6f327212ef96 738 ((CHANNEL) == ADC_REGULAR_RANK_15) || \
Kojto 112:6f327212ef96 739 ((CHANNEL) == ADC_REGULAR_RANK_16) || \
Kojto 112:6f327212ef96 740 ((CHANNEL) == ADC_REGULAR_RANK_17) || \
Kojto 112:6f327212ef96 741 ((CHANNEL) == ADC_REGULAR_RANK_18) || \
Kojto 112:6f327212ef96 742 ((CHANNEL) == ADC_REGULAR_RANK_19) || \
Kojto 112:6f327212ef96 743 ((CHANNEL) == ADC_REGULAR_RANK_20) || \
Kojto 112:6f327212ef96 744 ((CHANNEL) == ADC_REGULAR_RANK_21) || \
Kojto 112:6f327212ef96 745 ((CHANNEL) == ADC_REGULAR_RANK_22) || \
Kojto 112:6f327212ef96 746 ((CHANNEL) == ADC_REGULAR_RANK_23) || \
Kojto 112:6f327212ef96 747 ((CHANNEL) == ADC_REGULAR_RANK_24) || \
Kojto 112:6f327212ef96 748 ((CHANNEL) == ADC_REGULAR_RANK_25) || \
Kojto 112:6f327212ef96 749 ((CHANNEL) == ADC_REGULAR_RANK_26) || \
Kojto 112:6f327212ef96 750 ((CHANNEL) == ADC_REGULAR_RANK_27) || \
Kojto 112:6f327212ef96 751 ((CHANNEL) == ADC_REGULAR_RANK_28) )
Kojto 112:6f327212ef96 752 #else
Kojto 112:6f327212ef96 753
Kojto 112:6f327212ef96 754 #define IS_ADC_REGULAR_RANK(CHANNEL) (((CHANNEL) == ADC_REGULAR_RANK_1 ) || \
Kojto 112:6f327212ef96 755 ((CHANNEL) == ADC_REGULAR_RANK_2 ) || \
Kojto 112:6f327212ef96 756 ((CHANNEL) == ADC_REGULAR_RANK_3 ) || \
Kojto 112:6f327212ef96 757 ((CHANNEL) == ADC_REGULAR_RANK_4 ) || \
Kojto 112:6f327212ef96 758 ((CHANNEL) == ADC_REGULAR_RANK_5 ) || \
Kojto 112:6f327212ef96 759 ((CHANNEL) == ADC_REGULAR_RANK_6 ) || \
Kojto 112:6f327212ef96 760 ((CHANNEL) == ADC_REGULAR_RANK_7 ) || \
Kojto 112:6f327212ef96 761 ((CHANNEL) == ADC_REGULAR_RANK_8 ) || \
Kojto 112:6f327212ef96 762 ((CHANNEL) == ADC_REGULAR_RANK_9 ) || \
Kojto 112:6f327212ef96 763 ((CHANNEL) == ADC_REGULAR_RANK_10) || \
Kojto 112:6f327212ef96 764 ((CHANNEL) == ADC_REGULAR_RANK_11) || \
Kojto 112:6f327212ef96 765 ((CHANNEL) == ADC_REGULAR_RANK_12) || \
Kojto 112:6f327212ef96 766 ((CHANNEL) == ADC_REGULAR_RANK_13) || \
Kojto 112:6f327212ef96 767 ((CHANNEL) == ADC_REGULAR_RANK_14) || \
Kojto 112:6f327212ef96 768 ((CHANNEL) == ADC_REGULAR_RANK_15) || \
Kojto 112:6f327212ef96 769 ((CHANNEL) == ADC_REGULAR_RANK_16) || \
Kojto 112:6f327212ef96 770 ((CHANNEL) == ADC_REGULAR_RANK_17) || \
Kojto 112:6f327212ef96 771 ((CHANNEL) == ADC_REGULAR_RANK_18) || \
Kojto 112:6f327212ef96 772 ((CHANNEL) == ADC_REGULAR_RANK_19) || \
Kojto 112:6f327212ef96 773 ((CHANNEL) == ADC_REGULAR_RANK_20) || \
Kojto 112:6f327212ef96 774 ((CHANNEL) == ADC_REGULAR_RANK_21) || \
Kojto 112:6f327212ef96 775 ((CHANNEL) == ADC_REGULAR_RANK_22) || \
Kojto 112:6f327212ef96 776 ((CHANNEL) == ADC_REGULAR_RANK_23) || \
Kojto 112:6f327212ef96 777 ((CHANNEL) == ADC_REGULAR_RANK_24) || \
Kojto 112:6f327212ef96 778 ((CHANNEL) == ADC_REGULAR_RANK_25) || \
Kojto 112:6f327212ef96 779 ((CHANNEL) == ADC_REGULAR_RANK_26) || \
Kojto 112:6f327212ef96 780 ((CHANNEL) == ADC_REGULAR_RANK_27) )
Kojto 112:6f327212ef96 781 #endif /* STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
Kojto 112:6f327212ef96 782 /**
Kojto 112:6f327212ef96 783 * @}
Kojto 112:6f327212ef96 784 */
Kojto 112:6f327212ef96 785
Kojto 112:6f327212ef96 786 /** @defgroup ADC_analog_watchdog_mode ADC analog watchdog mode
Kojto 112:6f327212ef96 787 * @{
Kojto 112:6f327212ef96 788 */
Kojto 112:6f327212ef96 789 #define ADC_ANALOGWATCHDOG_NONE ((uint32_t)0x00000000)
Kojto 112:6f327212ef96 790 #define ADC_ANALOGWATCHDOG_SINGLE_REG ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN))
Kojto 112:6f327212ef96 791 #define ADC_ANALOGWATCHDOG_SINGLE_INJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_JAWDEN))
Kojto 112:6f327212ef96 792 #define ADC_ANALOGWATCHDOG_SINGLE_REGINJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN | ADC_CR1_JAWDEN))
Kojto 112:6f327212ef96 793 #define ADC_ANALOGWATCHDOG_ALL_REG ((uint32_t) ADC_CR1_AWDEN)
Kojto 112:6f327212ef96 794 #define ADC_ANALOGWATCHDOG_ALL_INJEC ((uint32_t) ADC_CR1_JAWDEN)
Kojto 112:6f327212ef96 795 #define ADC_ANALOGWATCHDOG_ALL_REGINJEC ((uint32_t)(ADC_CR1_AWDEN | ADC_CR1_JAWDEN))
Kojto 112:6f327212ef96 796
Kojto 112:6f327212ef96 797 #define IS_ADC_ANALOG_WATCHDOG_MODE(WATCHDOG) (((WATCHDOG) == ADC_ANALOGWATCHDOG_NONE) || \
Kojto 112:6f327212ef96 798 ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REG) || \
Kojto 112:6f327212ef96 799 ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_INJEC) || \
Kojto 112:6f327212ef96 800 ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REGINJEC) || \
Kojto 112:6f327212ef96 801 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REG) || \
Kojto 112:6f327212ef96 802 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_INJEC) || \
Kojto 112:6f327212ef96 803 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REGINJEC) )
Kojto 112:6f327212ef96 804 /**
Kojto 112:6f327212ef96 805 * @}
Kojto 112:6f327212ef96 806 */
Kojto 112:6f327212ef96 807
Kojto 112:6f327212ef96 808 /** @defgroup ADC_conversion_group ADC conversion group
Kojto 112:6f327212ef96 809 * @{
Kojto 112:6f327212ef96 810 */
Kojto 112:6f327212ef96 811 #define REGULAR_GROUP ((uint32_t)(ADC_FLAG_EOC))
Kojto 112:6f327212ef96 812 #define INJECTED_GROUP ((uint32_t)(ADC_FLAG_JEOC))
Kojto 112:6f327212ef96 813 #define REGULAR_INJECTED_GROUP ((uint32_t)(ADC_FLAG_EOC | ADC_FLAG_JEOC))
Kojto 112:6f327212ef96 814
Kojto 112:6f327212ef96 815 #define IS_ADC_CONVERSION_GROUP(CONVERSION) (((CONVERSION) == REGULAR_GROUP) || \
Kojto 112:6f327212ef96 816 ((CONVERSION) == INJECTED_GROUP) || \
Kojto 112:6f327212ef96 817 ((CONVERSION) == REGULAR_INJECTED_GROUP) )
Kojto 112:6f327212ef96 818 /**
Kojto 112:6f327212ef96 819 * @}
Kojto 112:6f327212ef96 820 */
Kojto 112:6f327212ef96 821
Kojto 112:6f327212ef96 822 /** @defgroup ADC_Event_type ADC Event type
Kojto 112:6f327212ef96 823 * @{
Kojto 112:6f327212ef96 824 */
Kojto 112:6f327212ef96 825 #define AWD_EVENT ((uint32_t)ADC_FLAG_AWD) /*!< ADC Analog watchdog event */
Kojto 112:6f327212ef96 826 #define OVR_EVENT ((uint32_t)ADC_FLAG_OVR) /*!< ADC overrun event */
Kojto 112:6f327212ef96 827
Kojto 112:6f327212ef96 828 #define IS_ADC_EVENT_TYPE(EVENT) (((EVENT) == AWD_EVENT) || \
Kojto 112:6f327212ef96 829 ((EVENT) == ADC_FLAG_OVR) )
Kojto 112:6f327212ef96 830 /**
Kojto 112:6f327212ef96 831 * @}
Kojto 112:6f327212ef96 832 */
Kojto 112:6f327212ef96 833
Kojto 112:6f327212ef96 834 /** @defgroup ADC_interrupts_definition ADC interrupts definition
Kojto 112:6f327212ef96 835 * @{
Kojto 112:6f327212ef96 836 */
Kojto 112:6f327212ef96 837 #define ADC_IT_EOC ADC_CR1_EOCIE /*!< ADC End of Regular Conversion interrupt source */
Kojto 112:6f327212ef96 838 #define ADC_IT_JEOC ADC_CR1_JEOCIE /*!< ADC End of Injected Conversion interrupt source */
Kojto 112:6f327212ef96 839 #define ADC_IT_AWD ADC_CR1_AWDIE /*!< ADC Analog watchdog interrupt source */
Kojto 112:6f327212ef96 840 #define ADC_IT_OVR ADC_CR1_OVRIE /*!< ADC overrun interrupt source */
Kojto 112:6f327212ef96 841 /**
Kojto 112:6f327212ef96 842 * @}
Kojto 112:6f327212ef96 843 */
Kojto 112:6f327212ef96 844
Kojto 112:6f327212ef96 845 /** @defgroup ADC_flags_definition ADC flags definition
Kojto 112:6f327212ef96 846 * @{
Kojto 112:6f327212ef96 847 */
Kojto 112:6f327212ef96 848 #define ADC_FLAG_AWD ADC_SR_AWD /*!< ADC Analog watchdog flag */
Kojto 112:6f327212ef96 849 #define ADC_FLAG_EOC ADC_SR_EOC /*!< ADC End of Regular conversion flag */
Kojto 112:6f327212ef96 850 #define ADC_FLAG_JEOC ADC_SR_JEOC /*!< ADC End of Injected conversion flag */
Kojto 112:6f327212ef96 851 #define ADC_FLAG_JSTRT ADC_SR_JSTRT /*!< ADC Injected group start flag */
Kojto 112:6f327212ef96 852 #define ADC_FLAG_STRT ADC_SR_STRT /*!< ADC Regular group start flag */
Kojto 112:6f327212ef96 853 #define ADC_FLAG_OVR ADC_SR_OVR /*!< ADC overrun flag */
Kojto 112:6f327212ef96 854 #define ADC_FLAG_ADONS ADC_SR_ADONS /*!< ADC ready status flag */
Kojto 112:6f327212ef96 855 #define ADC_FLAG_RCNR ADC_SR_RCNR /*!< ADC Regular group ready status flag */
Kojto 112:6f327212ef96 856 #define ADC_FLAG_JCNR ADC_SR_JCNR /*!< ADC Regular group ready status flag */
Kojto 112:6f327212ef96 857
Kojto 112:6f327212ef96 858 /* Combination of all post-conversion flags bits: EOC/EOS, JEOC/JEOS, OVR, AWDx */
Kojto 112:6f327212ef96 859 #define ADC_FLAG_POSTCONV_ALL (ADC_FLAG_EOC | ADC_FLAG_JEOC | ADC_FLAG_AWD | \
Kojto 112:6f327212ef96 860 ADC_FLAG_OVR)
Kojto 112:6f327212ef96 861 /**
Kojto 112:6f327212ef96 862 * @}
Kojto 112:6f327212ef96 863 */
Kojto 112:6f327212ef96 864
Kojto 112:6f327212ef96 865 /** @defgroup ADC_range_verification ADC range verification
Kojto 112:6f327212ef96 866 * For a unique ADC resolution: 12 bits
Kojto 112:6f327212ef96 867 * @{
Kojto 112:6f327212ef96 868 */
Kojto 112:6f327212ef96 869 #define IS_ADC_RANGE(ADC_VALUE) ((ADC_VALUE) <= ((uint32_t)0x0FFF))
Kojto 112:6f327212ef96 870 /**
Kojto 112:6f327212ef96 871 * @}
Kojto 112:6f327212ef96 872 */
Kojto 112:6f327212ef96 873
Kojto 112:6f327212ef96 874 /** @defgroup ADC_regular_nb_conv_verification ADC regular nb conv verification
Kojto 112:6f327212ef96 875 * @{
Kojto 112:6f327212ef96 876 */
Kojto 112:6f327212ef96 877 #if defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
Kojto 112:6f327212ef96 878 #define IS_ADC_REGULAR_NB_CONV(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)28)))
Kojto 112:6f327212ef96 879 #else
Kojto 112:6f327212ef96 880 #define IS_ADC_REGULAR_NB_CONV(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)27)))
Kojto 112:6f327212ef96 881 #endif
Kojto 112:6f327212ef96 882 /**
Kojto 112:6f327212ef96 883 * @}
Kojto 112:6f327212ef96 884 */
Kojto 112:6f327212ef96 885
Kojto 112:6f327212ef96 886 /** @defgroup ADC_regular_discontinuous_mode_number_verification ADC regular discontinuous mode number verification
Kojto 112:6f327212ef96 887 * @{
Kojto 112:6f327212ef96 888 */
Kojto 112:6f327212ef96 889 #define IS_ADC_REGULAR_DISCONT_NUMBER(NUMBER) (((NUMBER) >= ((uint32_t)1)) && ((NUMBER) <= ((uint32_t)8)))
Kojto 112:6f327212ef96 890 /**
Kojto 112:6f327212ef96 891 * @}
Kojto 112:6f327212ef96 892 */
Kojto 112:6f327212ef96 893
Kojto 112:6f327212ef96 894 /**
Kojto 112:6f327212ef96 895 * @}
Kojto 112:6f327212ef96 896 */
Kojto 112:6f327212ef96 897
Kojto 112:6f327212ef96 898 /* Exported macro ------------------------------------------------------------*/
Kojto 112:6f327212ef96 899
Kojto 112:6f327212ef96 900 /** @defgroup ADC_Exported_Macros ADC Exported Macros
Kojto 112:6f327212ef96 901 * @{
Kojto 112:6f327212ef96 902 */
Kojto 112:6f327212ef96 903 /* Macro for internal HAL driver usage, and possibly can be used into code of */
Kojto 112:6f327212ef96 904 /* final user. */
Kojto 112:6f327212ef96 905
Kojto 112:6f327212ef96 906 /**
Kojto 112:6f327212ef96 907 * @brief Verification of ADC state: enabled or disabled
Kojto 112:6f327212ef96 908 * @param __HANDLE__: ADC handle
Kojto 112:6f327212ef96 909 * @retval SET (ADC enabled) or RESET (ADC disabled)
Kojto 112:6f327212ef96 910 */
Kojto 112:6f327212ef96 911 #define __HAL_ADC_IS_ENABLED(__HANDLE__) \
Kojto 112:6f327212ef96 912 ((( ((__HANDLE__)->Instance->SR & ADC_SR_ADONS) == ADC_SR_ADONS ) \
Kojto 112:6f327212ef96 913 ) ? SET : RESET)
Kojto 112:6f327212ef96 914
Kojto 112:6f327212ef96 915 /**
Kojto 112:6f327212ef96 916 * @brief Test if conversion trigger of regular group is software start
Kojto 112:6f327212ef96 917 * or external trigger.
Kojto 112:6f327212ef96 918 * @param __HANDLE__: ADC handle
Kojto 112:6f327212ef96 919 * @retval SET (software start) or RESET (external trigger)
Kojto 112:6f327212ef96 920 */
Kojto 112:6f327212ef96 921 #define __HAL_ADC_IS_SOFTWARE_START_REGULAR(__HANDLE__) \
Kojto 112:6f327212ef96 922 (((__HANDLE__)->Instance->CR2 & ADC_CR2_EXTEN) == RESET)
Kojto 112:6f327212ef96 923
Kojto 112:6f327212ef96 924 /**
Kojto 112:6f327212ef96 925 * @brief Test if conversion trigger of injected group is software start
Kojto 112:6f327212ef96 926 * or external trigger.
Kojto 112:6f327212ef96 927 * @param __HANDLE__: ADC handle
Kojto 112:6f327212ef96 928 * @retval SET (software start) or RESET (external trigger)
Kojto 112:6f327212ef96 929 */
Kojto 112:6f327212ef96 930 #define __HAL_ADC_IS_SOFTWARE_START_INJECTED(__HANDLE__) \
Kojto 112:6f327212ef96 931 (((__HANDLE__)->Instance->CR2 & ADC_CR2_JEXTEN) == RESET)
Kojto 112:6f327212ef96 932
Kojto 112:6f327212ef96 933 /** @brief Checks if the specified ADC interrupt source is enabled or disabled.
Kojto 112:6f327212ef96 934 * @param __HANDLE__: ADC handle
Kojto 112:6f327212ef96 935 * @param __INTERRUPT__: ADC interrupt source to check
Kojto 112:6f327212ef96 936 * @retval State of interruption (SET or RESET)
Kojto 112:6f327212ef96 937 */
Kojto 112:6f327212ef96 938 #define __HAL_ADC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) \
Kojto 112:6f327212ef96 939 (( ((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__) \
Kojto 112:6f327212ef96 940 )? SET : RESET \
Kojto 112:6f327212ef96 941 )
Kojto 112:6f327212ef96 942
Kojto 112:6f327212ef96 943 /**
Kojto 112:6f327212ef96 944 * @brief Enable the ADC end of conversion interrupt.
Kojto 112:6f327212ef96 945 * @param __HANDLE__: ADC handle
Kojto 112:6f327212ef96 946 * @param __INTERRUPT__: ADC Interrupt
Kojto 112:6f327212ef96 947 * @retval None
Kojto 112:6f327212ef96 948 */
Kojto 112:6f327212ef96 949 #define __HAL_ADC_ENABLE_IT(__HANDLE__, __INTERRUPT__) \
Kojto 112:6f327212ef96 950 (SET_BIT((__HANDLE__)->Instance->CR1, (__INTERRUPT__)))
Kojto 112:6f327212ef96 951
Kojto 112:6f327212ef96 952 /**
Kojto 112:6f327212ef96 953 * @brief Disable the ADC end of conversion interrupt.
Kojto 112:6f327212ef96 954 * @param __HANDLE__: ADC handle
Kojto 112:6f327212ef96 955 * @param __INTERRUPT__: ADC Interrupt
Kojto 112:6f327212ef96 956 * @retval None
Kojto 112:6f327212ef96 957 */
Kojto 112:6f327212ef96 958 #define __HAL_ADC_DISABLE_IT(__HANDLE__, __INTERRUPT__) \
Kojto 112:6f327212ef96 959 (CLEAR_BIT((__HANDLE__)->Instance->CR1, (__INTERRUPT__)))
Kojto 112:6f327212ef96 960
Kojto 112:6f327212ef96 961 /**
Kojto 112:6f327212ef96 962 * @brief Get the selected ADC's flag status.
Kojto 112:6f327212ef96 963 * @param __HANDLE__: ADC handle
Kojto 112:6f327212ef96 964 * @param __FLAG__: ADC flag
Kojto 112:6f327212ef96 965 * @retval None
Kojto 112:6f327212ef96 966 */
Kojto 112:6f327212ef96 967 #define __HAL_ADC_GET_FLAG(__HANDLE__, __FLAG__) \
Kojto 112:6f327212ef96 968 ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
Kojto 112:6f327212ef96 969
Kojto 112:6f327212ef96 970 /**
Kojto 112:6f327212ef96 971 * @brief Clear the ADC's pending flags
Kojto 112:6f327212ef96 972 * @param __HANDLE__: ADC handle
Kojto 112:6f327212ef96 973 * @param __FLAG__: ADC flag
Kojto 112:6f327212ef96 974 * @retval None
Kojto 112:6f327212ef96 975 */
Kojto 112:6f327212ef96 976 #define __HAL_ADC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__))
Kojto 112:6f327212ef96 977
Kojto 112:6f327212ef96 978 /**
Kojto 112:6f327212ef96 979 * @brief Clear ADC error code (set it to error code: "no error")
Kojto 112:6f327212ef96 980 * @param __HANDLE__: ADC handle
Kojto 112:6f327212ef96 981 * @retval None
Kojto 112:6f327212ef96 982 */
Kojto 112:6f327212ef96 983 #define __HAL_ADC_CLEAR_ERRORCODE(__HANDLE__) \
Kojto 112:6f327212ef96 984 ((__HANDLE__)->ErrorCode = HAL_ADC_ERROR_NONE)
Kojto 112:6f327212ef96 985
Kojto 112:6f327212ef96 986 /** @brief Reset ADC handle state
Kojto 112:6f327212ef96 987 * @param __HANDLE__: ADC handle
Kojto 112:6f327212ef96 988 * @retval None
Kojto 112:6f327212ef96 989 */
Kojto 112:6f327212ef96 990 #define __HAL_ADC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_ADC_STATE_RESET)
Kojto 112:6f327212ef96 991
Kojto 112:6f327212ef96 992 /**
Kojto 112:6f327212ef96 993 * @}
Kojto 112:6f327212ef96 994 */
Kojto 112:6f327212ef96 995
Kojto 112:6f327212ef96 996 /* Include ADC HAL Extension module */
Kojto 112:6f327212ef96 997 #include "stm32l1xx_hal_adc_ex.h"
Kojto 112:6f327212ef96 998
Kojto 112:6f327212ef96 999 /* Exported functions --------------------------------------------------------*/
Kojto 112:6f327212ef96 1000 /** @addtogroup ADC_Exported_Functions
Kojto 112:6f327212ef96 1001 * @{
Kojto 112:6f327212ef96 1002 */
Kojto 112:6f327212ef96 1003
Kojto 112:6f327212ef96 1004 /** @addtogroup ADC_Exported_Functions_Group1
Kojto 112:6f327212ef96 1005 * @{
Kojto 112:6f327212ef96 1006 */
Kojto 112:6f327212ef96 1007
Kojto 112:6f327212ef96 1008
Kojto 112:6f327212ef96 1009 /* Initialization and de-initialization functions **********************************/
Kojto 112:6f327212ef96 1010 HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1011 HAL_StatusTypeDef HAL_ADC_DeInit(ADC_HandleTypeDef *hadc);
Kojto 112:6f327212ef96 1012 void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1013 void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1014 /**
Kojto 112:6f327212ef96 1015 * @}
Kojto 112:6f327212ef96 1016 */
Kojto 112:6f327212ef96 1017
Kojto 112:6f327212ef96 1018 /* IO operation functions *****************************************************/
Kojto 112:6f327212ef96 1019
Kojto 112:6f327212ef96 1020 /** @addtogroup ADC_Exported_Functions_Group2
Kojto 112:6f327212ef96 1021 * @{
Kojto 112:6f327212ef96 1022 */
Kojto 112:6f327212ef96 1023
Kojto 112:6f327212ef96 1024
Kojto 112:6f327212ef96 1025 /* Blocking mode: Polling */
Kojto 112:6f327212ef96 1026 HAL_StatusTypeDef HAL_ADC_Start(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1027 HAL_StatusTypeDef HAL_ADC_Stop(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1028 HAL_StatusTypeDef HAL_ADC_PollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout);
Kojto 112:6f327212ef96 1029 HAL_StatusTypeDef HAL_ADC_PollForEvent(ADC_HandleTypeDef* hadc, uint32_t EventType, uint32_t Timeout);
Kojto 112:6f327212ef96 1030
Kojto 112:6f327212ef96 1031 /* Non-blocking mode: Interruption */
Kojto 112:6f327212ef96 1032 HAL_StatusTypeDef HAL_ADC_Start_IT(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1033 HAL_StatusTypeDef HAL_ADC_Stop_IT(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1034
Kojto 112:6f327212ef96 1035 /* Non-blocking mode: DMA */
Kojto 112:6f327212ef96 1036 HAL_StatusTypeDef HAL_ADC_Start_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, uint32_t Length);
Kojto 112:6f327212ef96 1037 HAL_StatusTypeDef HAL_ADC_Stop_DMA(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1038
Kojto 112:6f327212ef96 1039 /* ADC retrieve conversion value intended to be used with polling or interruption */
Kojto 112:6f327212ef96 1040 uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1041
Kojto 112:6f327212ef96 1042 /* ADC IRQHandler and Callbacks used in non-blocking modes (Interruption and DMA) */
Kojto 112:6f327212ef96 1043 void HAL_ADC_IRQHandler(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1044 void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1045 void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1046 void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1047 void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc);
Kojto 112:6f327212ef96 1048 /**
Kojto 112:6f327212ef96 1049 * @}
Kojto 112:6f327212ef96 1050 */
Kojto 112:6f327212ef96 1051
Kojto 112:6f327212ef96 1052
Kojto 112:6f327212ef96 1053 /* Peripheral Control functions ***********************************************/
Kojto 112:6f327212ef96 1054 /** @addtogroup ADC_Exported_Functions_Group3
Kojto 112:6f327212ef96 1055 * @{
Kojto 112:6f327212ef96 1056 */
Kojto 112:6f327212ef96 1057 HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef* hadc, ADC_ChannelConfTypeDef* sConfig);
Kojto 112:6f327212ef96 1058 HAL_StatusTypeDef HAL_ADC_AnalogWDGConfig(ADC_HandleTypeDef* hadc, ADC_AnalogWDGConfTypeDef* AnalogWDGConfig);
Kojto 112:6f327212ef96 1059 /**
Kojto 112:6f327212ef96 1060 * @}
Kojto 112:6f327212ef96 1061 */
Kojto 112:6f327212ef96 1062
Kojto 112:6f327212ef96 1063
Kojto 112:6f327212ef96 1064 /* Peripheral State functions *************************************************/
Kojto 112:6f327212ef96 1065 /** @addtogroup ADC_Exported_Functions_Group4
Kojto 112:6f327212ef96 1066 * @{
Kojto 112:6f327212ef96 1067 */
Kojto 112:6f327212ef96 1068 HAL_ADC_StateTypeDef HAL_ADC_GetState(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1069 uint32_t HAL_ADC_GetError(ADC_HandleTypeDef *hadc);
Kojto 112:6f327212ef96 1070 /**
Kojto 112:6f327212ef96 1071 * @}
Kojto 112:6f327212ef96 1072 */
Kojto 112:6f327212ef96 1073
Kojto 112:6f327212ef96 1074
Kojto 112:6f327212ef96 1075 /**
Kojto 112:6f327212ef96 1076 * @}
Kojto 112:6f327212ef96 1077 */
Kojto 112:6f327212ef96 1078
Kojto 112:6f327212ef96 1079
Kojto 112:6f327212ef96 1080 /* Internal HAL driver functions **********************************************/
Kojto 112:6f327212ef96 1081 /** @addtogroup ADC_Private_Functions
Kojto 112:6f327212ef96 1082 * @{
Kojto 112:6f327212ef96 1083 */
Kojto 112:6f327212ef96 1084
Kojto 112:6f327212ef96 1085 HAL_StatusTypeDef ADC_Enable(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1086 HAL_StatusTypeDef ADC_ConversionStop_Disable(ADC_HandleTypeDef* hadc);
Kojto 112:6f327212ef96 1087 /**
Kojto 112:6f327212ef96 1088 * @}
Kojto 112:6f327212ef96 1089 */
Kojto 112:6f327212ef96 1090
Kojto 112:6f327212ef96 1091
Kojto 112:6f327212ef96 1092 /**
Kojto 112:6f327212ef96 1093 * @}
Kojto 112:6f327212ef96 1094 */
Kojto 112:6f327212ef96 1095
Kojto 112:6f327212ef96 1096 /**
Kojto 112:6f327212ef96 1097 * @}
Kojto 112:6f327212ef96 1098 */
Kojto 112:6f327212ef96 1099
Kojto 112:6f327212ef96 1100 #ifdef __cplusplus
Kojto 112:6f327212ef96 1101 }
Kojto 112:6f327212ef96 1102 #endif
Kojto 112:6f327212ef96 1103
Kojto 112:6f327212ef96 1104
Kojto 112:6f327212ef96 1105 #endif /* __STM32L1xx_HAL_ADC_H */
Kojto 112:6f327212ef96 1106
Kojto 112:6f327212ef96 1107 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/