mbed library sources modified for open wear
Dependents: openwear-lifelogger-example
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F334R8/stm32f3xx_hal_adc_ex.h@237:f3da66175598, 2014-06-24 (annotated)
- Committer:
- mbed_official
- Date:
- Tue Jun 24 14:45:08 2014 +0100
- Revision:
- 237:f3da66175598
Synchronized with git revision 8ef659bca81f12dfc896b5a7af7c2abbd1a1b8b7
Full URL: https://github.com/mbedmicro/mbed/commit/8ef659bca81f12dfc896b5a7af7c2abbd1a1b8b7/
[NUCLEO_F334R8] Add platform files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 237:f3da66175598 | 1 | /** |
mbed_official | 237:f3da66175598 | 2 | ****************************************************************************** |
mbed_official | 237:f3da66175598 | 3 | * @file stm32f3xx_hal_adc_ex.h |
mbed_official | 237:f3da66175598 | 4 | * @author MCD Application Team |
mbed_official | 237:f3da66175598 | 5 | * @version V1.0.1 |
mbed_official | 237:f3da66175598 | 6 | * @date 18-June-2014 |
mbed_official | 237:f3da66175598 | 7 | * @brief Header file containing functions prototypes of ADC HAL library. |
mbed_official | 237:f3da66175598 | 8 | ****************************************************************************** |
mbed_official | 237:f3da66175598 | 9 | * @attention |
mbed_official | 237:f3da66175598 | 10 | * |
mbed_official | 237:f3da66175598 | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 237:f3da66175598 | 12 | * |
mbed_official | 237:f3da66175598 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 237:f3da66175598 | 14 | * are permitted provided that the following conditions are met: |
mbed_official | 237:f3da66175598 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 237:f3da66175598 | 16 | * this list of conditions and the following disclaimer. |
mbed_official | 237:f3da66175598 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 237:f3da66175598 | 18 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 237:f3da66175598 | 19 | * and/or other materials provided with the distribution. |
mbed_official | 237:f3da66175598 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 237:f3da66175598 | 21 | * may be used to endorse or promote products derived from this software |
mbed_official | 237:f3da66175598 | 22 | * without specific prior written permission. |
mbed_official | 237:f3da66175598 | 23 | * |
mbed_official | 237:f3da66175598 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 237:f3da66175598 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 237:f3da66175598 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 237:f3da66175598 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 237:f3da66175598 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 237:f3da66175598 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 237:f3da66175598 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 237:f3da66175598 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 237:f3da66175598 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 237:f3da66175598 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 237:f3da66175598 | 34 | * |
mbed_official | 237:f3da66175598 | 35 | ****************************************************************************** |
mbed_official | 237:f3da66175598 | 36 | */ |
mbed_official | 237:f3da66175598 | 37 | |
mbed_official | 237:f3da66175598 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 237:f3da66175598 | 39 | #ifndef __STM32F3xx_ADC_EX_H |
mbed_official | 237:f3da66175598 | 40 | #define __STM32F3xx_ADC_EX_H |
mbed_official | 237:f3da66175598 | 41 | |
mbed_official | 237:f3da66175598 | 42 | #ifdef __cplusplus |
mbed_official | 237:f3da66175598 | 43 | extern "C" { |
mbed_official | 237:f3da66175598 | 44 | #endif |
mbed_official | 237:f3da66175598 | 45 | |
mbed_official | 237:f3da66175598 | 46 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 47 | #include "stm32f3xx_hal_def.h" |
mbed_official | 237:f3da66175598 | 48 | |
mbed_official | 237:f3da66175598 | 49 | /** @addtogroup STM32F3xx_HAL_Driver |
mbed_official | 237:f3da66175598 | 50 | * @{ |
mbed_official | 237:f3da66175598 | 51 | */ |
mbed_official | 237:f3da66175598 | 52 | |
mbed_official | 237:f3da66175598 | 53 | /** @addtogroup ADC |
mbed_official | 237:f3da66175598 | 54 | * @{ |
mbed_official | 237:f3da66175598 | 55 | */ |
mbed_official | 237:f3da66175598 | 56 | |
mbed_official | 237:f3da66175598 | 57 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 58 | struct __ADC_HandleTypeDef; |
mbed_official | 237:f3da66175598 | 59 | |
mbed_official | 237:f3da66175598 | 60 | #if defined(STM32F303xC) || defined(STM32F358xx) || defined(STM32F302xC) || defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8) || defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 61 | /** |
mbed_official | 237:f3da66175598 | 62 | * @brief Structure definition of ADC initialization and regular group |
mbed_official | 237:f3da66175598 | 63 | * @note Parameters of this structure are shared within 2 scopes: |
mbed_official | 237:f3da66175598 | 64 | * - Scope entire ADC (affects regular and injected groups): ClockPrescaler, Resolution, DataAlign, |
mbed_official | 237:f3da66175598 | 65 | * ScanConvMode, EOCSelection, LowPowerAutoWait. |
mbed_official | 237:f3da66175598 | 66 | * - Scope regular group: ContinuousConvMode, NbrOfConversion, DiscontinuousConvMode, NbrOfDiscConversion, ExternalTrigConvEdge, ExternalTrigConv, DMAContinuousRequests, Overrun. |
mbed_official | 237:f3da66175598 | 67 | * @note The setting of these parameters with function HAL_ADC_Init() is conditioned to ADC state. |
mbed_official | 237:f3da66175598 | 68 | * ADC state can be either: |
mbed_official | 237:f3da66175598 | 69 | * - For all parameters: ADC disabled |
mbed_official | 237:f3da66175598 | 70 | * - For all parameters except 'LowPowerAutoWait' and 'DMAContinuousRequests': ADC enabled without conversion on going on regular group. |
mbed_official | 237:f3da66175598 | 71 | * - For parameters 'LowPowerAutoWait' and 'DMAContinuousRequests': ADC enabled without conversion on going on regular and injected groups. |
mbed_official | 237:f3da66175598 | 72 | * If ADC is not in the appropriate state to modify some parameters, these parameters setting is bypassed |
mbed_official | 237:f3da66175598 | 73 | * 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). |
mbed_official | 237:f3da66175598 | 74 | */ |
mbed_official | 237:f3da66175598 | 75 | typedef struct |
mbed_official | 237:f3da66175598 | 76 | { |
mbed_official | 237:f3da66175598 | 77 | uint32_t ClockPrescaler; /*!< Select ADC clock source (synchronous clock derived from AHB clock or asynchronous clock derived from ADC dedicated PLL 72MHz) and clock prescaler. |
mbed_official | 237:f3da66175598 | 78 | The clock is common for all the ADCs. |
mbed_official | 237:f3da66175598 | 79 | This parameter can be a value of @ref ADCEx_ClockPrescaler |
mbed_official | 237:f3da66175598 | 80 | 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, |
mbed_official | 237:f3da66175598 | 81 | AHB clock frequency /3 for resolution 8 bits, AHB clock frequency /2 for resolution 6 bits. |
mbed_official | 237:f3da66175598 | 82 | Note: In case of usage of the ADC dedicated PLL clock, this clock must be preliminarily enabled and prescaler set at RCC top level. |
mbed_official | 237:f3da66175598 | 83 | Note: This parameter can be modified only if all ADCs of the common ADC group are disabled (for products with several ADCs) */ |
mbed_official | 237:f3da66175598 | 84 | uint32_t Resolution; /*!< Configures the ADC resolution. |
mbed_official | 237:f3da66175598 | 85 | This parameter can be a value of @ref ADCEx_Resolution */ |
mbed_official | 237:f3da66175598 | 86 | uint32_t DataAlign; /*!< Specifies ADC data alignment to right (for resolution 12 bits: MSB on register bit 11 and LSB on register bit 0) (default setting) |
mbed_official | 237:f3da66175598 | 87 | or to left (for resolution 12 bits, if offset disabled: MSB on register bit 15 and LSB on register bit 4, if offset enabled: MSB on register bit 14 and LSB on register bit 3). |
mbed_official | 237:f3da66175598 | 88 | See reference manual for alignments with other resolutions. |
mbed_official | 237:f3da66175598 | 89 | This parameter can be a value of @ref ADCEx_Data_align */ |
mbed_official | 237:f3da66175598 | 90 | uint32_t ScanConvMode; /*!< Configures the sequencer of regular and injected groups. |
mbed_official | 237:f3da66175598 | 91 | This parameter can be associated to parameter 'DiscontinuousConvMode' to have main sequence subdivided in successive parts. |
mbed_official | 237:f3da66175598 | 92 | If disabled: Conversion is performed in single mode (one channel converted, the one defined in rank 1). |
mbed_official | 237:f3da66175598 | 93 | Parameters 'NbrOfConversion' and 'InjectedNbrOfConversion' are discarded (equivalent to set to 1). |
mbed_official | 237:f3da66175598 | 94 | If enabled: Conversions are performed in sequence mode (multiple ranks defined by 'NbrOfConversion'/'InjectedNbrOfConversion' and each channel rank). |
mbed_official | 237:f3da66175598 | 95 | Scan direction is upward: from rank1 to rank 'n'. |
mbed_official | 237:f3da66175598 | 96 | This parameter can be a value of @ref ADCEx_Scan_mode */ |
mbed_official | 237:f3da66175598 | 97 | 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. |
mbed_official | 237:f3da66175598 | 98 | This parameter can be a value of @ref ADCEx_EOCSelection. */ |
mbed_official | 237:f3da66175598 | 99 | uint32_t LowPowerAutoWait; /*!< Selects the dynamic low power Auto Delay: new conversion start only when the previous |
mbed_official | 237:f3da66175598 | 100 | conversion (for regular group) or previous sequence (for injected group) has been treated by user software. |
mbed_official | 237:f3da66175598 | 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. |
mbed_official | 237:f3da66175598 | 102 | This parameter can be set to ENABLE or DISABLE. |
mbed_official | 237:f3da66175598 | 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. |
mbed_official | 237:f3da66175598 | 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 |
mbed_official | 237:f3da66175598 | 105 | and use HAL_ADC_GetValue() to retrieve conversion result and trig another conversion. */ |
mbed_official | 237:f3da66175598 | 106 | uint32_t ContinuousConvMode; /*!< Specifies whether the conversion is performed in single mode (one conversion) or continuous mode for regular group, |
mbed_official | 237:f3da66175598 | 107 | after the selected trigger occurred (software start or external trigger). |
mbed_official | 237:f3da66175598 | 108 | This parameter can be set to ENABLE or DISABLE. */ |
mbed_official | 237:f3da66175598 | 109 | uint32_t NbrOfConversion; /*!< Specifies the number of ranks that will be converted within the regular group sequencer. |
mbed_official | 237:f3da66175598 | 110 | To use the regular group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled. |
mbed_official | 237:f3da66175598 | 111 | This parameter must be a number between Min_Data = 1 and Max_Data = 16. |
mbed_official | 237:f3da66175598 | 112 | Note: This parameter must be modified when no conversion is on going on regular group (ADC disabled, or ADC enabled without continuous mode or external trigger that could lauch a conversion). */ |
mbed_official | 237:f3da66175598 | 113 | uint32_t DiscontinuousConvMode; /*!< Specifies whether the conversions sequence of regular group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts). |
mbed_official | 237:f3da66175598 | 114 | Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded. |
mbed_official | 237:f3da66175598 | 115 | Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded. |
mbed_official | 237:f3da66175598 | 116 | This parameter can be set to ENABLE or DISABLE. */ |
mbed_official | 237:f3da66175598 | 117 | uint32_t NbrOfDiscConversion; /*!< Specifies the number of discontinuous conversions in which the main sequence of regular group (parameter NbrOfConversion) will be subdivided. |
mbed_official | 237:f3da66175598 | 118 | If parameter 'DiscontinuousConvMode' is disabled, this parameter is discarded. |
mbed_official | 237:f3da66175598 | 119 | This parameter must be a number between Min_Data = 1 and Max_Data = 8. */ |
mbed_official | 237:f3da66175598 | 120 | uint32_t ExternalTrigConv; /*!< Selects the external event used to trigger the conversion start of regular group. |
mbed_official | 237:f3da66175598 | 121 | If set to ADC_SOFTWARE_START, external triggers are disabled. |
mbed_official | 237:f3da66175598 | 122 | This parameter can be a value of @ref ADCEx_External_trigger_source_Regular |
mbed_official | 237:f3da66175598 | 123 | Caution: For devices with several ADCs, external trigger source is common to ADC common group (for example: ADC1&ADC2, ADC3&ADC4, if available) */ |
mbed_official | 237:f3da66175598 | 124 | uint32_t ExternalTrigConvEdge; /*!< Selects the external trigger edge of regular group. |
mbed_official | 237:f3da66175598 | 125 | If trigger is set to ADC_SOFTWARE_START, this parameter is discarded. |
mbed_official | 237:f3da66175598 | 126 | This parameter can be a value of @ref ADCEx_External_trigger_edge_Regular */ |
mbed_official | 237:f3da66175598 | 127 | uint32_t DMAContinuousRequests; /*!< Specifies whether the DMA requests are performed in one shot mode (DMA transfer stop when number of conversions is reached) |
mbed_official | 237:f3da66175598 | 128 | or in Continuous mode (DMA transfer unlimited, whatever number of conversions). |
mbed_official | 237:f3da66175598 | 129 | Note: In continuous mode, DMA must be configured in circular mode. Otherwise an overrun will be triggered when DMA buffer maximum pointer is reached. |
mbed_official | 237:f3da66175598 | 130 | This parameter can be set to ENABLE or DISABLE. |
mbed_official | 237:f3da66175598 | 131 | 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). */ |
mbed_official | 237:f3da66175598 | 132 | uint32_t Overrun; /*!< Select the behaviour in case of overrun: data overwritten (default) or preserved. |
mbed_official | 237:f3da66175598 | 133 | This parameter is for regular group only. |
mbed_official | 237:f3da66175598 | 134 | This parameter can be a value of @ref ADCEx_Overrun |
mbed_official | 237:f3da66175598 | 135 | Note: Case of overrun set to data preserved and usage with end on conversion interruption (HAL_Start_IT()): ADC IRQ handler has to clear end of conversion flags, this induces the release of the preserved data. If needed, this data can be saved into function HAL_ADC_ConvCpltCallback() (called before end of conversion flags clear). |
mbed_official | 237:f3da66175598 | 136 | Note: Error reporting in function of conversion mode: |
mbed_official | 237:f3da66175598 | 137 | - Usage with ADC conversion by polling for event or interruption: Error is reported only if overrun is set to data preserved. If overrun is set to data overwritten, user can willingly not read the conversion data each time, this is not considered as an erroneous case. |
mbed_official | 237:f3da66175598 | 138 | - Usage with ADC conversion by DMA: Error is reported whatever overrun setting (DMA is expected to process all data from data register, any data missed would be abnormal). */ |
mbed_official | 237:f3da66175598 | 139 | }ADC_InitTypeDef; |
mbed_official | 237:f3da66175598 | 140 | |
mbed_official | 237:f3da66175598 | 141 | /** |
mbed_official | 237:f3da66175598 | 142 | * @brief Structure definition of ADC channel for regular group |
mbed_official | 237:f3da66175598 | 143 | * @note The setting of these parameters with function HAL_ADC_ConfigChannel() is conditioned to ADC state. |
mbed_official | 237:f3da66175598 | 144 | * ADC state can be either: |
mbed_official | 237:f3da66175598 | 145 | * - For all parameters: ADC disabled (this is the only possible ADC state to modify parameter 'SingleDiff') |
mbed_official | 237:f3da66175598 | 146 | * - For all except parameters 'SamplingTime', 'Offset', 'OffsetNumber': ADC enabled without conversion on going on regular group. |
mbed_official | 237:f3da66175598 | 147 | * - For parameters 'SamplingTime', 'Offset', 'OffsetNumber': ADC enabled without conversion on going on regular and injected groups. |
mbed_official | 237:f3da66175598 | 148 | * If ADC is not in the appropriate state to modify some parameters, these parameters setting is bypassed |
mbed_official | 237:f3da66175598 | 149 | * without error reporting (as it can be the expected behaviour in case of intended action to update another parameter (which fulfills the ADC state condition) on the fly). |
mbed_official | 237:f3da66175598 | 150 | */ |
mbed_official | 237:f3da66175598 | 151 | typedef struct |
mbed_official | 237:f3da66175598 | 152 | { |
mbed_official | 237:f3da66175598 | 153 | uint32_t Channel; /*!< Specifies the channel to configure into ADC regular group. |
mbed_official | 237:f3da66175598 | 154 | This parameter can be a value of @ref ADCEx_channels |
mbed_official | 237:f3da66175598 | 155 | Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability. */ |
mbed_official | 237:f3da66175598 | 156 | uint32_t Rank; /*!< Specifies the rank in the regular group sequencer. |
mbed_official | 237:f3da66175598 | 157 | This parameter can be a value of @ref ADCEx_regular_rank |
mbed_official | 237:f3da66175598 | 158 | 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) */ |
mbed_official | 237:f3da66175598 | 159 | uint32_t SamplingTime; /*!< Specifies the sampling time to be set for the selected channel. |
mbed_official | 237:f3da66175598 | 160 | Unit: ADC clock cycles |
mbed_official | 237:f3da66175598 | 161 | Conversion time is addition of sampling time and processing time (12.5 ADC clock cycles at ADC resolution 12 bits, 10.5 cycles at 10 bits, 8.5 cycles at 8 bits, 6.5 cycles at 6 bits). |
mbed_official | 237:f3da66175598 | 162 | This parameter can be a value of @ref ADCEx_sampling_times |
mbed_official | 237:f3da66175598 | 163 | Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups. |
mbed_official | 237:f3da66175598 | 164 | If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting. |
mbed_official | 237:f3da66175598 | 165 | Note: In case of usage of internal measurement channels (Vbat/VrefInt/TempSensor), |
mbed_official | 237:f3da66175598 | 166 | the recommended sampling time is at least 2.2us (sampling time setting to be chosen in function of ADC clock frequency) */ |
mbed_official | 237:f3da66175598 | 167 | uint32_t SingleDiff; /*!< Selection of single-ended or differential input. |
mbed_official | 237:f3da66175598 | 168 | In differential mode: Differential measurement is between the selected channel 'i' (positive input) and channel 'i+1' (negative input). |
mbed_official | 237:f3da66175598 | 169 | Only channel 'i' has to be configured, channel 'i+1' is configured automatically. |
mbed_official | 237:f3da66175598 | 170 | This parameter must be a value of @ref ADCEx_SingleDifferential |
mbed_official | 237:f3da66175598 | 171 | Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups. |
mbed_official | 237:f3da66175598 | 172 | If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting. |
mbed_official | 237:f3da66175598 | 173 | Note: Channels 1 to 14 are available in differential mode. Channels 15, 16, 17, 18 can be used only in single-ended mode. |
mbed_official | 237:f3da66175598 | 174 | Note: When configuring a channel 'i' in differential mode, the channel 'i+1' is not usable separately. |
mbed_official | 237:f3da66175598 | 175 | Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion). |
mbed_official | 237:f3da66175598 | 176 | If ADC is enabled, this parameter setting is bypassed without error reporting (as it can be the expected behaviour in case of another parameter update on the fly) */ |
mbed_official | 237:f3da66175598 | 177 | uint32_t OffsetNumber; /*!< Selects the offset number |
mbed_official | 237:f3da66175598 | 178 | This parameter can be a value of @ref ADCEx_OffsetNumber |
mbed_official | 237:f3da66175598 | 179 | Caution: Only one channel is allowed per channel. If another channel was on this offset number, the offset will be changed to the new channel */ |
mbed_official | 237:f3da66175598 | 180 | uint32_t Offset; /*!< Defines the offset to be subtracted from the raw converted data when convert channels. |
mbed_official | 237:f3da66175598 | 181 | Offset value must be a positive number. |
mbed_official | 237:f3da66175598 | 182 | Depending of ADC resolution selected (12, 10, 8 or 6 bits), this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF, 0x3FF, 0xFF or 0x3F respectively. |
mbed_official | 237:f3da66175598 | 183 | 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). */ |
mbed_official | 237:f3da66175598 | 184 | }ADC_ChannelConfTypeDef; |
mbed_official | 237:f3da66175598 | 185 | |
mbed_official | 237:f3da66175598 | 186 | /** |
mbed_official | 237:f3da66175598 | 187 | * @brief Structure definition of ADC injected group and ADC channel for injected group |
mbed_official | 237:f3da66175598 | 188 | * @note Parameters of this structure are shared within 2 scopes: |
mbed_official | 237:f3da66175598 | 189 | * - Scope channel: InjectedChannel, InjectedRank, InjectedSamplingTime , InjectedSingleDiff, InjectedOffsetNumber, InjectedOffset |
mbed_official | 237:f3da66175598 | 190 | * - Scope injected group (affects all channels of injected group): InjectedNbrOfConversion, InjectedDiscontinuousConvMode, |
mbed_official | 237:f3da66175598 | 191 | * AutoInjectedConv, QueueInjectedContext, ExternalTrigInjecConvEdge, ExternalTrigInjecConv. |
mbed_official | 237:f3da66175598 | 192 | * @note The setting of these parameters with function HAL_ADCEx_InjectedConfigChannel() is conditioned to ADC state. |
mbed_official | 237:f3da66175598 | 193 | * ADC state can be either: |
mbed_official | 237:f3da66175598 | 194 | * - For all parameters: ADC disabled (this is the only possible ADC state to modify parameter 'InjectedSingleDiff') |
mbed_official | 237:f3da66175598 | 195 | * - For parameters 'InjectedDiscontinuousConvMode', 'QueueInjectedContext': ADC enabled without conversion on going on injected group. |
mbed_official | 237:f3da66175598 | 196 | * - For parameters 'InjectedSamplingTime', 'InjectedOffset', 'InjectedOffsetNumber', 'AutoInjectedConv': ADC enabled without conversion on going on regular and injected groups. |
mbed_official | 237:f3da66175598 | 197 | * - For parameters 'InjectedChannel', 'InjectedRank', 'InjectedNbrOfConversion', 'ExternalTrigInjecConv', 'ExternalTrigInjecConvEdge': ADC enabled and while conversion on going on regular and injected groups. |
mbed_official | 237:f3da66175598 | 198 | * If ADC is not in the appropriate state to modify some parameters, these parameters setting is bypassed |
mbed_official | 237:f3da66175598 | 199 | * without error reporting without error reporting (as it can be the expected behaviour in case of intended action to update another parameter (which fulfills the ADC state condition) on the fly). |
mbed_official | 237:f3da66175598 | 200 | */ |
mbed_official | 237:f3da66175598 | 201 | typedef struct |
mbed_official | 237:f3da66175598 | 202 | { |
mbed_official | 237:f3da66175598 | 203 | uint32_t InjectedChannel; /*!< Configure the ADC injected channel |
mbed_official | 237:f3da66175598 | 204 | This parameter can be a value of @ref ADCEx_channels |
mbed_official | 237:f3da66175598 | 205 | Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability. */ |
mbed_official | 237:f3da66175598 | 206 | uint32_t InjectedRank; /*!< The rank in the regular group sequencer |
mbed_official | 237:f3da66175598 | 207 | This parameter must be a value of @ref ADCEx_injected_rank |
mbed_official | 237:f3da66175598 | 208 | 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) */ |
mbed_official | 237:f3da66175598 | 209 | uint32_t InjectedSamplingTime; /*!< The sample time value to be set for the selected channel. |
mbed_official | 237:f3da66175598 | 210 | Unit: ADC clock cycles |
mbed_official | 237:f3da66175598 | 211 | Conversion time is addition of sampling time and processing time (12.5 ADC clock cycles at ADC resolution 12 bits, 10.5 cycles at 10 bits, 8.5 cycles at 8 bits, 6.5 cycles at 6 bits). |
mbed_official | 237:f3da66175598 | 212 | This parameter can be a value of @ref ADCEx_sampling_times |
mbed_official | 237:f3da66175598 | 213 | Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups. |
mbed_official | 237:f3da66175598 | 214 | If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting. |
mbed_official | 237:f3da66175598 | 215 | Note: In case of usage of internal measurement channels (Vbat/VrefInt/TempSensor), |
mbed_official | 237:f3da66175598 | 216 | the recommended sampling time is at least 2.2us (sampling time setting to be chosen in function of ADC clock frequency) */ |
mbed_official | 237:f3da66175598 | 217 | uint32_t InjectedSingleDiff; /*!< Selection of single-ended or differential input. |
mbed_official | 237:f3da66175598 | 218 | In differential mode: Differential measurement is between the selected channel 'i' (positive input) and channel 'i+1' (negative input). |
mbed_official | 237:f3da66175598 | 219 | Only channel 'i' has to be configured, channel 'i+1' is configured automatically. |
mbed_official | 237:f3da66175598 | 220 | This parameter must be a value of @ref ADCEx_SingleDifferential |
mbed_official | 237:f3da66175598 | 221 | Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups. |
mbed_official | 237:f3da66175598 | 222 | If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting. |
mbed_official | 237:f3da66175598 | 223 | Note: Channels 1 to 14 are available in differential mode. Channels 15, 16, 17, 18 can be used only in single-ended mode. |
mbed_official | 237:f3da66175598 | 224 | Note: When configuring a channel 'i' in differential mode, the channel 'i-1' is not usable separately. |
mbed_official | 237:f3da66175598 | 225 | Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion). |
mbed_official | 237:f3da66175598 | 226 | If ADC is enabled, this parameter setting is bypassed without error reporting (as it can be the expected behaviour in case of another parameter update on the fly) */ |
mbed_official | 237:f3da66175598 | 227 | uint32_t InjectedOffsetNumber; /*!< Selects the offset number |
mbed_official | 237:f3da66175598 | 228 | This parameter can be a value of @ref ADCEx_OffsetNumber |
mbed_official | 237:f3da66175598 | 229 | Caution: Only one channel is allowed per offset number. If another channel was on this offset number, the offset will be changed to the new channel. */ |
mbed_official | 237:f3da66175598 | 230 | uint32_t InjectedOffset; /*!< Defines the offset to be subtracted from the raw converted data. |
mbed_official | 237:f3da66175598 | 231 | Offset value must be a positive number. |
mbed_official | 237:f3da66175598 | 232 | Depending of ADC resolution selected (12, 10, 8 or 6 bits), |
mbed_official | 237:f3da66175598 | 233 | this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF, 0x3FF, 0xFF or 0x3F respectively. */ |
mbed_official | 237:f3da66175598 | 234 | uint32_t InjectedNbrOfConversion; /*!< Specifies the number of ranks that will be converted within the injected group sequencer. |
mbed_official | 237:f3da66175598 | 235 | To use the injected group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled. |
mbed_official | 237:f3da66175598 | 236 | This parameter must be a number between Min_Data = 1 and Max_Data = 4. |
mbed_official | 237:f3da66175598 | 237 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
mbed_official | 237:f3da66175598 | 238 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
mbed_official | 237:f3da66175598 | 239 | uint32_t InjectedDiscontinuousConvMode; /*!< Specifies whether the conversions sequence of injected group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts). |
mbed_official | 237:f3da66175598 | 240 | Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded. |
mbed_official | 237:f3da66175598 | 241 | Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded. |
mbed_official | 237:f3da66175598 | 242 | This parameter can be set to ENABLE or DISABLE. |
mbed_official | 237:f3da66175598 | 243 | Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion). |
mbed_official | 237:f3da66175598 | 244 | Note: For injected group, number of discontinuous ranks increment is fixed to one-by-one. |
mbed_official | 237:f3da66175598 | 245 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
mbed_official | 237:f3da66175598 | 246 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
mbed_official | 237:f3da66175598 | 247 | uint32_t AutoInjectedConv; /*!< Enables or disables the selected ADC automatic injected group conversion after regular one |
mbed_official | 237:f3da66175598 | 248 | This parameter can be set to ENABLE or DISABLE. |
mbed_official | 237:f3da66175598 | 249 | Note: To use Automatic injected conversion, discontinuous mode must be disabled ('DiscontinuousConvMode' and 'InjectedDiscontinuousConvMode' set to DISABLE) |
mbed_official | 237:f3da66175598 | 250 | Note: To use Automatic injected conversion, injected group external triggers must be disabled ('ExternalTrigInjecConv' set to ADC_SOFTWARE_START) |
mbed_official | 237:f3da66175598 | 251 | Note: In case of DMA used with regular group: if DMA configured in normal mode (single shot) JAUTO will be stopped upon DMA transfer complete. |
mbed_official | 237:f3da66175598 | 252 | To maintain JAUTO always enabled, DMA must be configured in circular mode. |
mbed_official | 237:f3da66175598 | 253 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
mbed_official | 237:f3da66175598 | 254 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
mbed_official | 237:f3da66175598 | 255 | uint32_t QueueInjectedContext; /*!< Specifies whether the context queue feature is enabled. |
mbed_official | 237:f3da66175598 | 256 | This parameter can be set to ENABLE or DISABLE. |
mbed_official | 237:f3da66175598 | 257 | If context queue is enabled, injected sequencer&channels configurations are queued on up to 2 contexts. If a |
mbed_official | 237:f3da66175598 | 258 | new injected context is set when queue is full, error is triggered by interruption and through function 'HAL_ADCEx_InjectedQueueOverflowCallback'. |
mbed_official | 237:f3da66175598 | 259 | Caution: This feature request that the sequence is fully configured before injected conversion start. |
mbed_official | 237:f3da66175598 | 260 | Therefore, configure channels with HAL_ADCEx_InjectedConfigChannel() as many times as value of 'InjectedNbrOfConversion' parameter. |
mbed_official | 237:f3da66175598 | 261 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
mbed_official | 237:f3da66175598 | 262 | configure a channel on injected group can impact the configuration of other channels previously set. |
mbed_official | 237:f3da66175598 | 263 | Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion). */ |
mbed_official | 237:f3da66175598 | 264 | uint32_t ExternalTrigInjecConv; /*!< Selects the external event used to trigger the conversion start of injected group. |
mbed_official | 237:f3da66175598 | 265 | If set to ADC_INJECTED_SOFTWARE_START, external triggers are disabled. |
mbed_official | 237:f3da66175598 | 266 | This parameter can be a value of @ref ADCEx_External_trigger_source_Injected |
mbed_official | 237:f3da66175598 | 267 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
mbed_official | 237:f3da66175598 | 268 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
mbed_official | 237:f3da66175598 | 269 | uint32_t ExternalTrigInjecConvEdge; /*!< Selects the external trigger edge of injected group. |
mbed_official | 237:f3da66175598 | 270 | This parameter can be a value of @ref ADCEx_External_trigger_edge_Injected. |
mbed_official | 237:f3da66175598 | 271 | If trigger is set to ADC_INJECTED_SOFTWARE_START, this parameter is discarded. |
mbed_official | 237:f3da66175598 | 272 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
mbed_official | 237:f3da66175598 | 273 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
mbed_official | 237:f3da66175598 | 274 | }ADC_InjectionConfTypeDef; |
mbed_official | 237:f3da66175598 | 275 | |
mbed_official | 237:f3da66175598 | 276 | /** |
mbed_official | 237:f3da66175598 | 277 | * @brief Structure definition of ADC analog watchdog |
mbed_official | 237:f3da66175598 | 278 | * @note The setting of these parameters with function HAL_ADC_AnalogWDGConfig() is conditioned to ADC state. |
mbed_official | 237:f3da66175598 | 279 | * ADC state can be either: ADC disabled or ADC enabled without conversion on going on regular and injected groups. |
mbed_official | 237:f3da66175598 | 280 | */ |
mbed_official | 237:f3da66175598 | 281 | typedef struct |
mbed_official | 237:f3da66175598 | 282 | { |
mbed_official | 237:f3da66175598 | 283 | uint32_t WatchdogNumber; /*!< Selects which ADC analog watchdog to apply to the selected channel. |
mbed_official | 237:f3da66175598 | 284 | For Analog Watchdog 1: Only 1 channel can be monitored (or overall group of channels by setting parameter 'WatchdogMode') |
mbed_official | 237:f3da66175598 | 285 | For Analog Watchdog 2 and 3: Several channels can be monitored (by successive calls of 'HAL_ADC_AnalogWDGConfig()' for each channel) |
mbed_official | 237:f3da66175598 | 286 | This parameter can be a value of @ref ADCEx_analog_watchdog_number. */ |
mbed_official | 237:f3da66175598 | 287 | uint32_t WatchdogMode; /*!< For Analog Watchdog 1: Configures the ADC analog watchdog mode: single channel/overall group of channels, regular/injected group. |
mbed_official | 237:f3da66175598 | 288 | For Analog Watchdog 2 and 3: There is no configuration for overall group of channels as AWD1. Set value 'ADC_ANALOGWATCHDOG_NONE' to reset channels group programmed with parameter 'Channel', set any other value to not use this parameter. |
mbed_official | 237:f3da66175598 | 289 | This parameter can be a value of @ref ADCEx_analog_watchdog_mode. */ |
mbed_official | 237:f3da66175598 | 290 | uint32_t Channel; /*!< Selects which ADC channel to monitor by analog watchdog. |
mbed_official | 237:f3da66175598 | 291 | For Analog Watchdog 1: this parameter has an effect only if parameter 'WatchdogMode' is configured on single channel. Only 1 channel can be monitored. |
mbed_official | 237:f3da66175598 | 292 | For Analog Watchdog 2 and 3: Several channels can be monitored (successive calls of HAL_ADC_AnalogWDGConfig() must be done, one for each channel. |
mbed_official | 237:f3da66175598 | 293 | Channels group reset can be done by setting WatchdogMode to 'ADC_ANALOGWATCHDOG_NONE'). |
mbed_official | 237:f3da66175598 | 294 | This parameter can be a value of @ref ADCEx_channels. */ |
mbed_official | 237:f3da66175598 | 295 | uint32_t ITMode; /*!< Specifies whether the analog watchdog is configured in interrupt or polling mode. |
mbed_official | 237:f3da66175598 | 296 | This parameter can be set to ENABLE or DISABLE */ |
mbed_official | 237:f3da66175598 | 297 | uint32_t HighThreshold; /*!< Configures the ADC analog watchdog High threshold value. |
mbed_official | 237:f3da66175598 | 298 | Depending of ADC resolution selected (12, 10, 8 or 6 bits), this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF, 0x3FF, 0xFF or 0x3F respectively. |
mbed_official | 237:f3da66175598 | 299 | Note: Analog watchdog 2 and 3 are limited to a resolution of 8 bits: if ADC resolution is 12 bits |
mbed_official | 237:f3da66175598 | 300 | the 4 LSB are ignored, if ADC resolution is 10 bits the 2 LSB are ignored. */ |
mbed_official | 237:f3da66175598 | 301 | uint32_t LowThreshold; /*!< Configures the ADC analog watchdog High threshold value. |
mbed_official | 237:f3da66175598 | 302 | Depending of ADC resolution selected (12, 10, 8 or 6 bits), this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF, 0x3FF, 0xFF or 0x3F respectively. |
mbed_official | 237:f3da66175598 | 303 | Note: Analog watchdog 2 and 3 are limited to a resolution of 8 bits: if ADC resolution is 12 bits |
mbed_official | 237:f3da66175598 | 304 | the 4 LSB are ignored, if ADC resolution is 10 bits the 2 LSB are ignored. */ |
mbed_official | 237:f3da66175598 | 305 | }ADC_AnalogWDGConfTypeDef; |
mbed_official | 237:f3da66175598 | 306 | |
mbed_official | 237:f3da66175598 | 307 | /** |
mbed_official | 237:f3da66175598 | 308 | * @brief Structure definition of ADC multimode |
mbed_official | 237:f3da66175598 | 309 | * @note The setting of these parameters with function HAL_ADCEx_MultiModeConfigChannel() is conditioned to ADCs state (both ADCs of the common group). |
mbed_official | 237:f3da66175598 | 310 | * State of ADCs of the common group must be: disabled. |
mbed_official | 237:f3da66175598 | 311 | */ |
mbed_official | 237:f3da66175598 | 312 | typedef struct |
mbed_official | 237:f3da66175598 | 313 | { |
mbed_official | 237:f3da66175598 | 314 | uint32_t Mode; /*!< Configures the ADC to operate in independent or multi mode. |
mbed_official | 237:f3da66175598 | 315 | This parameter can be a value of @ref ADCEx_Common_mode */ |
mbed_official | 237:f3da66175598 | 316 | uint32_t DMAAccessMode; /*!< Configures the DMA mode for multi ADC mode: |
mbed_official | 237:f3da66175598 | 317 | selection whether 2 DMA channels (each ADC use its own DMA channel) or 1 DMA channel (one DMA channel for both ADC, DMA of ADC master) |
mbed_official | 237:f3da66175598 | 318 | This parameter can be a value of @ref ADCEx_Direct_memory_access_mode_for_multimode |
mbed_official | 237:f3da66175598 | 319 | Caution: Limitations with multimode DMA access enabled (1 DMA channel used): In case of dual mode in high speed (more than 5Msps) or high activity of DMA by other peripherals, there is a risk of DMA overrun. |
mbed_official | 237:f3da66175598 | 320 | Therefore, it is recommended to disable multimode DMA access: each ADC use its own DMA channel. */ |
mbed_official | 237:f3da66175598 | 321 | uint32_t TwoSamplingDelay; /*!< Configures the Delay between 2 sampling phases. |
mbed_official | 237:f3da66175598 | 322 | This parameter can be a value of @ref ADCEx_delay_between_2_sampling_phases |
mbed_official | 237:f3da66175598 | 323 | Delay range depends on selected resolution: from 1 to 12 clock cycles for 12 bits, from 1 to 10 clock cycles for 10 bits |
mbed_official | 237:f3da66175598 | 324 | from 1 to 8 clock cycles for 8 bits, from 1 to 6 clock cycles for 6 bits */ |
mbed_official | 237:f3da66175598 | 325 | }ADC_MultiModeTypeDef; |
mbed_official | 237:f3da66175598 | 326 | #endif /* STM32F303xC || STM32F358xC || STM32F302xC || STM32F303x8 || STM32F328xx || STM32F334x8 || STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 327 | |
mbed_official | 237:f3da66175598 | 328 | #if defined(STM32F373xC) || defined(STM32F378xx) |
mbed_official | 237:f3da66175598 | 329 | /** |
mbed_official | 237:f3da66175598 | 330 | * @brief Structure definition of ADC and regular group initialization |
mbed_official | 237:f3da66175598 | 331 | * @note Parameters of this structure are shared within 2 scopes: |
mbed_official | 237:f3da66175598 | 332 | * - Scope entire ADC (affects regular and injected groups): DataAlign, ScanConvMode. |
mbed_official | 237:f3da66175598 | 333 | * - Scope regular group: ContinuousConvMode, NbrOfConversion, DiscontinuousConvMode, NbrOfDiscConversion, ExternalTrigConvEdge, ExternalTrigConv. |
mbed_official | 237:f3da66175598 | 334 | * @note The setting of these parameters with function HAL_ADC_Init() is conditioned to ADC state. |
mbed_official | 237:f3da66175598 | 335 | * ADC can be either disabled or enabled without conversion on going on regular group. |
mbed_official | 237:f3da66175598 | 336 | */ |
mbed_official | 237:f3da66175598 | 337 | typedef struct |
mbed_official | 237:f3da66175598 | 338 | { |
mbed_official | 237:f3da66175598 | 339 | uint32_t DataAlign; /*!< Specifies ADC data alignment to right (MSB on register bit 11 and LSB on register bit 0) (default setting) |
mbed_official | 237:f3da66175598 | 340 | 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). |
mbed_official | 237:f3da66175598 | 341 | This parameter can be a value of @ref ADCEx_Data_align */ |
mbed_official | 237:f3da66175598 | 342 | uint32_t ScanConvMode; /*!< Configures the sequencer of regular and injected groups. |
mbed_official | 237:f3da66175598 | 343 | This parameter can be associated to parameter 'DiscontinuousConvMode' to have main sequence subdivided in successive parts. |
mbed_official | 237:f3da66175598 | 344 | If disabled: Conversion is performed in single mode (one channel converted, the one defined in rank 1). |
mbed_official | 237:f3da66175598 | 345 | Parameters 'NbrOfConversion' and 'InjectedNbrOfConversion' are discarded (equivalent to set to 1). |
mbed_official | 237:f3da66175598 | 346 | If enabled: Conversions are performed in sequence mode (multiple ranks defined by 'NbrOfConversion'/'InjectedNbrOfConversion' and each channel rank). |
mbed_official | 237:f3da66175598 | 347 | Scan direction is upward: from rank1 to rank 'n'. |
mbed_official | 237:f3da66175598 | 348 | This parameter can be a value of @ref ADCEx_Scan_mode |
mbed_official | 237:f3da66175598 | 349 | Note: For regular group, this parameter should be enabled in conversion either by polling (HAL_ADC_Start with Discontinuous mode and NbrOfDiscConversion=1) |
mbed_official | 237:f3da66175598 | 350 | or by DMA (HAL_ADC_Start_DMA), but not by interruption (HAL_ADC_Start_IT): in scan mode, interruption is triggered only on the |
mbed_official | 237:f3da66175598 | 351 | the last conversion of the sequence. All previous conversions would be overwritten by the last one. |
mbed_official | 237:f3da66175598 | 352 | Injected group used with scan mode has not this constraint: each rank has its own result register, no data is overwritten. */ |
mbed_official | 237:f3da66175598 | 353 | uint32_t ContinuousConvMode; /*!< Specifies whether the conversion is performed in single mode (one conversion) or continuous mode for regular group, |
mbed_official | 237:f3da66175598 | 354 | after the selected trigger occurred (software start or external trigger). |
mbed_official | 237:f3da66175598 | 355 | This parameter can be set to ENABLE or DISABLE. */ |
mbed_official | 237:f3da66175598 | 356 | uint32_t NbrOfConversion; /*!< Specifies the number of ranks that will be converted within the regular group sequencer. |
mbed_official | 237:f3da66175598 | 357 | To use regular group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled. |
mbed_official | 237:f3da66175598 | 358 | This parameter must be a number between Min_Data = 1 and Max_Data = 16. */ |
mbed_official | 237:f3da66175598 | 359 | uint32_t DiscontinuousConvMode; /*!< Specifies whether the conversions sequence of regular group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts). |
mbed_official | 237:f3da66175598 | 360 | Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded. |
mbed_official | 237:f3da66175598 | 361 | Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded. |
mbed_official | 237:f3da66175598 | 362 | This parameter can be set to ENABLE or DISABLE. */ |
mbed_official | 237:f3da66175598 | 363 | uint32_t NbrOfDiscConversion; /*!< Specifies the number of discontinuous conversions in which the main sequence of regular group (parameter NbrOfConversion) will be subdivided. |
mbed_official | 237:f3da66175598 | 364 | If parameter 'DiscontinuousConvMode' is disabled, this parameter is discarded. |
mbed_official | 237:f3da66175598 | 365 | This parameter must be a number between Min_Data = 1 and Max_Data = 8. */ |
mbed_official | 237:f3da66175598 | 366 | uint32_t ExternalTrigConv; /*!< Selects the external event used to trigger the conversion start of regular group. |
mbed_official | 237:f3da66175598 | 367 | If set to ADC_SOFTWARE_START, external triggers are disabled. |
mbed_official | 237:f3da66175598 | 368 | If set to external trigger source, triggering is on event rising edge. |
mbed_official | 237:f3da66175598 | 369 | This parameter can be a value of @ref ADCEx_External_trigger_source_Regular */ |
mbed_official | 237:f3da66175598 | 370 | }ADC_InitTypeDef; |
mbed_official | 237:f3da66175598 | 371 | |
mbed_official | 237:f3da66175598 | 372 | /** |
mbed_official | 237:f3da66175598 | 373 | * @brief Structure definition of ADC channel for regular group |
mbed_official | 237:f3da66175598 | 374 | * @note The setting of these parameters with function HAL_ADC_ConfigChannel() is conditioned to ADC state. |
mbed_official | 237:f3da66175598 | 375 | * ADC can be either disabled or enabled without conversion on going on regular group. |
mbed_official | 237:f3da66175598 | 376 | */ |
mbed_official | 237:f3da66175598 | 377 | typedef struct |
mbed_official | 237:f3da66175598 | 378 | { |
mbed_official | 237:f3da66175598 | 379 | uint32_t Channel; /*!< Specifies the channel to configure into ADC regular group. |
mbed_official | 237:f3da66175598 | 380 | This parameter can be a value of @ref ADCEx_channels |
mbed_official | 237:f3da66175598 | 381 | Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability. */ |
mbed_official | 237:f3da66175598 | 382 | uint32_t Rank; /*!< Specifies the rank in the regular group sequencer |
mbed_official | 237:f3da66175598 | 383 | This parameter can be a value of @ref ADCEx_regular_rank |
mbed_official | 237:f3da66175598 | 384 | 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) */ |
mbed_official | 237:f3da66175598 | 385 | uint32_t SamplingTime; /*!< Sample time value to be set for the selected channel. |
mbed_official | 237:f3da66175598 | 386 | Unit: ADC clock cycles |
mbed_official | 237:f3da66175598 | 387 | Conversion time is addition of sampling time and processing time (12.5 ADC clock cycles at ADC resolution 12 bits). |
mbed_official | 237:f3da66175598 | 388 | This parameter can be a value of @ref ADCEx_sampling_times |
mbed_official | 237:f3da66175598 | 389 | Note: In case of usage of internal measurement channels Temperature Sensor, |
mbed_official | 237:f3da66175598 | 390 | the recommended sampling time is at least 17.1us (sampling time setting to be chosen in function of ADC clock frequency) */ |
mbed_official | 237:f3da66175598 | 391 | }ADC_ChannelConfTypeDef; |
mbed_official | 237:f3da66175598 | 392 | |
mbed_official | 237:f3da66175598 | 393 | /** |
mbed_official | 237:f3da66175598 | 394 | * @brief ADC Configuration injected Channel structure definition |
mbed_official | 237:f3da66175598 | 395 | * @note Parameters of this structure are shared within 2 scopes: |
mbed_official | 237:f3da66175598 | 396 | * - Scope channel: InjectedChannel, InjectedRank, InjectedSamplingTime, InjectedOffset |
mbed_official | 237:f3da66175598 | 397 | * - Scope injected group (affects all channels of injected group): InjectedNbrOfConversion, InjectedDiscontinuousConvMode, |
mbed_official | 237:f3da66175598 | 398 | * AutoInjectedConv, ExternalTrigInjecConvEdge, ExternalTrigInjecConv. |
mbed_official | 237:f3da66175598 | 399 | * @note The setting of these parameters with function HAL_ADCEx_InjectedConfigChannel() is conditioned to ADC state. |
mbed_official | 237:f3da66175598 | 400 | * ADC state can be either: |
mbed_official | 237:f3da66175598 | 401 | * - For all parameters: ADC disabled (this is the only possible ADC state to modify parameter 'ExternalTrigInjecConv') |
mbed_official | 237:f3da66175598 | 402 | * - For all except parameters 'ExternalTrigInjecConv': ADC enabled without conversion on going on injected group. |
mbed_official | 237:f3da66175598 | 403 | */ |
mbed_official | 237:f3da66175598 | 404 | typedef struct |
mbed_official | 237:f3da66175598 | 405 | { |
mbed_official | 237:f3da66175598 | 406 | uint32_t InjectedChannel; /*!< Selection of ADC channel to configure |
mbed_official | 237:f3da66175598 | 407 | This parameter can be a value of @ref ADCEx_channels |
mbed_official | 237:f3da66175598 | 408 | Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability. */ |
mbed_official | 237:f3da66175598 | 409 | uint32_t InjectedRank; /*!< Rank in the injected group sequencer |
mbed_official | 237:f3da66175598 | 410 | This parameter must be a value of @ref ADCEx_injected_rank |
mbed_official | 237:f3da66175598 | 411 | 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) */ |
mbed_official | 237:f3da66175598 | 412 | uint32_t InjectedSamplingTime; /*!< Sample time value to be set for the selected channel. |
mbed_official | 237:f3da66175598 | 413 | Unit: ADC clock cycles |
mbed_official | 237:f3da66175598 | 414 | Conversion time is the addition of sampling time and processing time (12.5 ADC clock cycles at ADC resolution 12 bits). |
mbed_official | 237:f3da66175598 | 415 | This parameter can be a value of @ref ADCEx_sampling_times |
mbed_official | 237:f3da66175598 | 416 | Note: In case of usage of internal measurement channels Temperature Sensor, |
mbed_official | 237:f3da66175598 | 417 | the recommended sampling time is at least 17.1us (sampling time setting to be chosen in function of ADC clock frequency) */ |
mbed_official | 237:f3da66175598 | 418 | uint32_t InjectedOffset; /*!< Defines the offset to be subtracted from the raw converted data (for channels set on injected group only). |
mbed_official | 237:f3da66175598 | 419 | Offset value must be a positive number. |
mbed_official | 237:f3da66175598 | 420 | Depending of ADC resolution selected (12, 10, 8 or 6 bits), |
mbed_official | 237:f3da66175598 | 421 | this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF, 0x3FF, 0xFF or 0x3F respectively. */ |
mbed_official | 237:f3da66175598 | 422 | uint32_t InjectedNbrOfConversion; /*!< Specifies the number of ranks that will be converted within the injected group sequencer. |
mbed_official | 237:f3da66175598 | 423 | To use the injected group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled. |
mbed_official | 237:f3da66175598 | 424 | This parameter must be a number between Min_Data = 1 and Max_Data = 4. |
mbed_official | 237:f3da66175598 | 425 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
mbed_official | 237:f3da66175598 | 426 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
mbed_official | 237:f3da66175598 | 427 | uint32_t InjectedDiscontinuousConvMode; /*!< Specifies whether the conversions sequence of injected group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts). |
mbed_official | 237:f3da66175598 | 428 | Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded. |
mbed_official | 237:f3da66175598 | 429 | Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded. |
mbed_official | 237:f3da66175598 | 430 | This parameter can be set to ENABLE or DISABLE. |
mbed_official | 237:f3da66175598 | 431 | Note: For injected group, number of discontinuous ranks increment is fixed to one-by-one. |
mbed_official | 237:f3da66175598 | 432 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
mbed_official | 237:f3da66175598 | 433 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
mbed_official | 237:f3da66175598 | 434 | uint32_t AutoInjectedConv; /*!< Enables or disables the selected ADC automatic injected group conversion after regular one |
mbed_official | 237:f3da66175598 | 435 | This parameter can be set to ENABLE or DISABLE. |
mbed_official | 237:f3da66175598 | 436 | Note: To use Automatic injected conversion, discontinuous mode must be disabled ('DiscontinuousConvMode' and 'InjectedDiscontinuousConvMode' set to DISABLE) |
mbed_official | 237:f3da66175598 | 437 | Note: To use Automatic injected conversion, injected group external triggers must be disabled ('ExternalTrigInjecConv' set to ADC_SOFTWARE_START) |
mbed_official | 237:f3da66175598 | 438 | Note: In case of DMA used with regular group: if DMA configured in normal mode (single shot) JAUTO will be stopped upon DMA transfer complete. |
mbed_official | 237:f3da66175598 | 439 | To maintain JAUTO always enabled, DMA must be configured in circular mode. |
mbed_official | 237:f3da66175598 | 440 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
mbed_official | 237:f3da66175598 | 441 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
mbed_official | 237:f3da66175598 | 442 | uint32_t ExternalTrigInjecConv; /*!< Selects the external event used to trigger the conversion start of injected group. |
mbed_official | 237:f3da66175598 | 443 | If set to ADC_INJECTED_SOFTWARE_START, external triggers are disabled. |
mbed_official | 237:f3da66175598 | 444 | If set to external trigger source, triggering is on event rising edge. |
mbed_official | 237:f3da66175598 | 445 | This parameter can be a value of @ref ADCEx_External_trigger_source_Injected |
mbed_official | 237:f3da66175598 | 446 | Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion). |
mbed_official | 237:f3da66175598 | 447 | If ADC is enabled, this parameter setting is bypassed without error reporting (as it can be the expected behaviour in case of another parameter update on the fly) |
mbed_official | 237:f3da66175598 | 448 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
mbed_official | 237:f3da66175598 | 449 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
mbed_official | 237:f3da66175598 | 450 | }ADC_InjectionConfTypeDef; |
mbed_official | 237:f3da66175598 | 451 | |
mbed_official | 237:f3da66175598 | 452 | /** |
mbed_official | 237:f3da66175598 | 453 | * @brief ADC Configuration analog watchdog definition |
mbed_official | 237:f3da66175598 | 454 | * @note The setting of these parameters with function is conditioned to ADC state. |
mbed_official | 237:f3da66175598 | 455 | * ADC state can be either disabled or enabled without conversion on going on regular and injected groups. |
mbed_official | 237:f3da66175598 | 456 | */ |
mbed_official | 237:f3da66175598 | 457 | typedef struct |
mbed_official | 237:f3da66175598 | 458 | { |
mbed_official | 237:f3da66175598 | 459 | uint32_t WatchdogMode; /*!< Configures the ADC analog watchdog mode: single/all channels, regular/injected group. |
mbed_official | 237:f3da66175598 | 460 | This parameter can be a value of @ref ADCEx_analog_watchdog_mode. */ |
mbed_official | 237:f3da66175598 | 461 | uint32_t Channel; /*!< Selects which ADC channel to monitor by analog watchdog. |
mbed_official | 237:f3da66175598 | 462 | This parameter has an effect only if watchdog mode is configured on single channel (parameter WatchdogMode) |
mbed_official | 237:f3da66175598 | 463 | This parameter can be a value of @ref ADCEx_channels. */ |
mbed_official | 237:f3da66175598 | 464 | uint32_t ITMode; /*!< Specifies whether the analog watchdog is configured in interrupt or polling mode. |
mbed_official | 237:f3da66175598 | 465 | This parameter can be set to ENABLE or DISABLE */ |
mbed_official | 237:f3da66175598 | 466 | uint32_t HighThreshold; /*!< Configures the ADC analog watchdog High threshold value. |
mbed_official | 237:f3da66175598 | 467 | This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */ |
mbed_official | 237:f3da66175598 | 468 | uint32_t LowThreshold; /*!< Configures the ADC analog watchdog High threshold value. |
mbed_official | 237:f3da66175598 | 469 | This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */ |
mbed_official | 237:f3da66175598 | 470 | uint32_t WatchdogNumber; /*!< Reserved for future use, can be set to 0 */ |
mbed_official | 237:f3da66175598 | 471 | }ADC_AnalogWDGConfTypeDef; |
mbed_official | 237:f3da66175598 | 472 | #endif /* STM32F373xC || STM32F378xx */ |
mbed_official | 237:f3da66175598 | 473 | |
mbed_official | 237:f3da66175598 | 474 | |
mbed_official | 237:f3da66175598 | 475 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 476 | |
mbed_official | 237:f3da66175598 | 477 | /** @defgroup ADCEx_Exported_Constants |
mbed_official | 237:f3da66175598 | 478 | * @{ |
mbed_official | 237:f3da66175598 | 479 | */ |
mbed_official | 237:f3da66175598 | 480 | |
mbed_official | 237:f3da66175598 | 481 | /** @defgroup ADCEx_Error_Code |
mbed_official | 237:f3da66175598 | 482 | * @{ |
mbed_official | 237:f3da66175598 | 483 | */ |
mbed_official | 237:f3da66175598 | 484 | #define HAL_ADC_ERROR_NONE ((uint32_t)0x00) /*!< No error */ |
mbed_official | 237:f3da66175598 | 485 | #define HAL_ADC_ERROR_INTERNAL ((uint32_t)0x01) /*!< ADC IP internal error: if problem of clocking, |
mbed_official | 237:f3da66175598 | 486 | enable/disable, erroneous state */ |
mbed_official | 237:f3da66175598 | 487 | #define HAL_ADC_ERROR_OVR ((uint32_t)0x02) /*!< Overrun error */ |
mbed_official | 237:f3da66175598 | 488 | #define HAL_ADC_ERROR_DMA ((uint32_t)0x04) /*!< DMA transfer error */ |
mbed_official | 237:f3da66175598 | 489 | #define HAL_ADC_ERROR_JQOVF ((uint32_t)0x08) /*!< Injected context queue overflow error */ |
mbed_official | 237:f3da66175598 | 490 | /** |
mbed_official | 237:f3da66175598 | 491 | * @} |
mbed_official | 237:f3da66175598 | 492 | */ |
mbed_official | 237:f3da66175598 | 493 | |
mbed_official | 237:f3da66175598 | 494 | #if defined(STM32F303xC) || defined(STM32F358xx) || defined(STM32F302xC) || defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8) || defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 495 | /** @defgroup ADCEx_ClockPrescaler |
mbed_official | 237:f3da66175598 | 496 | * @{ |
mbed_official | 237:f3da66175598 | 497 | */ |
mbed_official | 237:f3da66175598 | 498 | #define ADC_CLOCK_ASYNC ((uint32_t)0x00000000) /*!< ADC asynchronous clock derived from ADC dedicated PLL */ |
mbed_official | 237:f3da66175598 | 499 | |
mbed_official | 237:f3da66175598 | 500 | #if defined(STM32F303xC) || defined(STM32F358xx) || defined(STM32F302xC) || defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8) |
mbed_official | 237:f3da66175598 | 501 | #define ADC_CLOCK_SYNC_PCLK_DIV1 ((uint32_t)ADC12_CCR_CKMODE_0) /*!< ADC synchronous clock derived from AHB clock without prescaler */ |
mbed_official | 237:f3da66175598 | 502 | #define ADC_CLOCK_SYNC_PCLK_DIV2 ((uint32_t)ADC12_CCR_CKMODE_1) /*!< ADC synchronous clock derived from AHB clock divided by a prescaler of 2 */ |
mbed_official | 237:f3da66175598 | 503 | #define ADC_CLOCK_SYNC_PCLK_DIV4 ((uint32_t)ADC12_CCR_CKMODE) /*!< ADC synchronous clock derived from AHB clock divided by a prescaler of 4 */ |
mbed_official | 237:f3da66175598 | 504 | #endif /* STM32F303xC || STM32F358xx || STM32F302xC || STM32F303x8 || STM32F328xx || STM32F334x8 */ |
mbed_official | 237:f3da66175598 | 505 | #if defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 506 | #define ADC_CLOCK_SYNC_PCLK_DIV1 ((uint32_t)ADC1_CCR_CKMODE_0) /*!< ADC synchronous clock derived from AHB clock without prescaler */ |
mbed_official | 237:f3da66175598 | 507 | #define ADC_CLOCK_SYNC_PCLK_DIV2 ((uint32_t)ADC1_CCR_CKMODE_1) /*!< ADC synchronous clock derived from AHB clock divided by a prescaler of 2 */ |
mbed_official | 237:f3da66175598 | 508 | #define ADC_CLOCK_SYNC_PCLK_DIV4 ((uint32_t)ADC1_CCR_CKMODE) /*!< ADC synchronous clock derived from AHB clock divided by a prescaler of 4 */ |
mbed_official | 237:f3da66175598 | 509 | #endif /* STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 510 | |
mbed_official | 237:f3da66175598 | 511 | #define ADC_CLOCKPRESCALER_PCLK_DIV1 ADC_CLOCK_SYNC_PCLK_DIV1 /* Obsolete naming, kept for compatibility with some other devices */ |
mbed_official | 237:f3da66175598 | 512 | #define ADC_CLOCKPRESCALER_PCLK_DIV2 ADC_CLOCK_SYNC_PCLK_DIV2 /* Obsolete naming, kept for compatibility with some other devices */ |
mbed_official | 237:f3da66175598 | 513 | #define ADC_CLOCKPRESCALER_PCLK_DIV4 ADC_CLOCK_SYNC_PCLK_DIV4 /* Obsolete naming, kept for compatibility with some other devices */ |
mbed_official | 237:f3da66175598 | 514 | |
mbed_official | 237:f3da66175598 | 515 | #define IS_ADC_CLOCKPRESCALER(ADC_CLOCK) (((ADC_CLOCK) == ADC_CLOCK_ASYNC) || \ |
mbed_official | 237:f3da66175598 | 516 | ((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV1) || \ |
mbed_official | 237:f3da66175598 | 517 | ((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV2) || \ |
mbed_official | 237:f3da66175598 | 518 | ((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV4) ) |
mbed_official | 237:f3da66175598 | 519 | /** |
mbed_official | 237:f3da66175598 | 520 | * @} |
mbed_official | 237:f3da66175598 | 521 | */ |
mbed_official | 237:f3da66175598 | 522 | |
mbed_official | 237:f3da66175598 | 523 | /** @defgroup ADCEx_Resolution |
mbed_official | 237:f3da66175598 | 524 | * @{ |
mbed_official | 237:f3da66175598 | 525 | */ |
mbed_official | 237:f3da66175598 | 526 | #define ADC_RESOLUTION12b ((uint32_t)0x00000000) /*!< ADC 12-bit resolution */ |
mbed_official | 237:f3da66175598 | 527 | #define ADC_RESOLUTION10b ((uint32_t)ADC_CFGR_RES_0) /*!< ADC 10-bit resolution */ |
mbed_official | 237:f3da66175598 | 528 | #define ADC_RESOLUTION8b ((uint32_t)ADC_CFGR_RES_1) /*!< ADC 8-bit resolution */ |
mbed_official | 237:f3da66175598 | 529 | #define ADC_RESOLUTION6b ((uint32_t)ADC_CFGR_RES) /*!< ADC 6-bit resolution */ |
mbed_official | 237:f3da66175598 | 530 | |
mbed_official | 237:f3da66175598 | 531 | #define IS_ADC_RESOLUTION(RESOLUTION) (((RESOLUTION) == ADC_RESOLUTION12b) || \ |
mbed_official | 237:f3da66175598 | 532 | ((RESOLUTION) == ADC_RESOLUTION10b) || \ |
mbed_official | 237:f3da66175598 | 533 | ((RESOLUTION) == ADC_RESOLUTION8b) || \ |
mbed_official | 237:f3da66175598 | 534 | ((RESOLUTION) == ADC_RESOLUTION6b) ) |
mbed_official | 237:f3da66175598 | 535 | |
mbed_official | 237:f3da66175598 | 536 | #define IS_ADC_RESOLUTION_8_6_BITS(RESOLUTION) (((RESOLUTION) == ADC_RESOLUTION8b) || \ |
mbed_official | 237:f3da66175598 | 537 | ((RESOLUTION) == ADC_RESOLUTION6b) ) |
mbed_official | 237:f3da66175598 | 538 | /** |
mbed_official | 237:f3da66175598 | 539 | * @} |
mbed_official | 237:f3da66175598 | 540 | */ |
mbed_official | 237:f3da66175598 | 541 | |
mbed_official | 237:f3da66175598 | 542 | /** @defgroup ADCEx_Data_align |
mbed_official | 237:f3da66175598 | 543 | * @{ |
mbed_official | 237:f3da66175598 | 544 | */ |
mbed_official | 237:f3da66175598 | 545 | #define ADC_DATAALIGN_RIGHT ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 546 | #define ADC_DATAALIGN_LEFT ((uint32_t)ADC_CFGR_ALIGN) |
mbed_official | 237:f3da66175598 | 547 | |
mbed_official | 237:f3da66175598 | 548 | #define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DATAALIGN_RIGHT) || \ |
mbed_official | 237:f3da66175598 | 549 | ((ALIGN) == ADC_DATAALIGN_LEFT) ) |
mbed_official | 237:f3da66175598 | 550 | /** |
mbed_official | 237:f3da66175598 | 551 | * @} |
mbed_official | 237:f3da66175598 | 552 | */ |
mbed_official | 237:f3da66175598 | 553 | |
mbed_official | 237:f3da66175598 | 554 | /** @defgroup ADCEx_Scan_mode |
mbed_official | 237:f3da66175598 | 555 | * @{ |
mbed_official | 237:f3da66175598 | 556 | */ |
mbed_official | 237:f3da66175598 | 557 | #define ADC_SCAN_DISABLE ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 558 | #define ADC_SCAN_ENABLE ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 559 | |
mbed_official | 237:f3da66175598 | 560 | #define IS_ADC_SCAN_MODE(SCAN_MODE) (((SCAN_MODE) == ADC_SCAN_DISABLE) || \ |
mbed_official | 237:f3da66175598 | 561 | ((SCAN_MODE) == ADC_SCAN_ENABLE) ) |
mbed_official | 237:f3da66175598 | 562 | /** |
mbed_official | 237:f3da66175598 | 563 | * @} |
mbed_official | 237:f3da66175598 | 564 | */ |
mbed_official | 237:f3da66175598 | 565 | |
mbed_official | 237:f3da66175598 | 566 | /** @defgroup ADCEx_External_trigger_edge_Regular |
mbed_official | 237:f3da66175598 | 567 | * @{ |
mbed_official | 237:f3da66175598 | 568 | */ |
mbed_official | 237:f3da66175598 | 569 | #define ADC_EXTERNALTRIGCONVEDGE_NONE ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 570 | #define ADC_EXTERNALTRIGCONVEDGE_RISING ((uint32_t)ADC_CFGR_EXTEN_0) |
mbed_official | 237:f3da66175598 | 571 | #define ADC_EXTERNALTRIGCONVEDGE_FALLING ((uint32_t)ADC_CFGR_EXTEN_1) |
mbed_official | 237:f3da66175598 | 572 | #define ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING ((uint32_t)ADC_CFGR_EXTEN) |
mbed_official | 237:f3da66175598 | 573 | |
mbed_official | 237:f3da66175598 | 574 | #define IS_ADC_EXTTRIG_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGCONVEDGE_NONE) || \ |
mbed_official | 237:f3da66175598 | 575 | ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISING) || \ |
mbed_official | 237:f3da66175598 | 576 | ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_FALLING) || \ |
mbed_official | 237:f3da66175598 | 577 | ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING) ) |
mbed_official | 237:f3da66175598 | 578 | /** |
mbed_official | 237:f3da66175598 | 579 | * @} |
mbed_official | 237:f3da66175598 | 580 | */ |
mbed_official | 237:f3da66175598 | 581 | |
mbed_official | 237:f3da66175598 | 582 | /** @defgroup ADCEx_External_trigger_source_Regular |
mbed_official | 237:f3da66175598 | 583 | * @{ |
mbed_official | 237:f3da66175598 | 584 | */ |
mbed_official | 237:f3da66175598 | 585 | #if defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 586 | /*!< List of external triggers with generic trigger name, independently of */ |
mbed_official | 237:f3da66175598 | 587 | /* ADC target (caution: applies to other ADCs sharing the same common group), */ |
mbed_official | 237:f3da66175598 | 588 | /* sorted by trigger name: */ |
mbed_official | 237:f3da66175598 | 589 | |
mbed_official | 237:f3da66175598 | 590 | /*!< External triggers of regular group for ADC1&ADC2 only */ |
mbed_official | 237:f3da66175598 | 591 | #define ADC_EXTERNALTRIGCONV_T1_CC1 ADC1_2_EXTERNALTRIG_T1_CC1 |
mbed_official | 237:f3da66175598 | 592 | #define ADC_EXTERNALTRIGCONV_T1_CC2 ADC1_2_EXTERNALTRIG_T1_CC2 |
mbed_official | 237:f3da66175598 | 593 | #define ADC_EXTERNALTRIGCONV_T2_CC2 ADC1_2_EXTERNALTRIG_T2_CC2 |
mbed_official | 237:f3da66175598 | 594 | #define ADC_EXTERNALTRIGCONV_T3_CC4 ADC1_2_EXTERNALTRIG_T3_CC4 |
mbed_official | 237:f3da66175598 | 595 | #define ADC_EXTERNALTRIGCONV_T4_CC4 ADC1_2_EXTERNALTRIG_T4_CC4 |
mbed_official | 237:f3da66175598 | 596 | #define ADC_EXTERNALTRIGCONV_T6_TRGO ADC1_2_EXTERNALTRIG_T6_TRGO |
mbed_official | 237:f3da66175598 | 597 | #define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC1_2_EXTERNALTRIG_EXT_IT11 |
mbed_official | 237:f3da66175598 | 598 | |
mbed_official | 237:f3da66175598 | 599 | /*!< External triggers of regular group for ADC3&ADC4 only */ |
mbed_official | 237:f3da66175598 | 600 | #define ADC_EXTERNALTRIGCONV_T2_CC1 ADC3_4_EXTERNALTRIG_T2_CC1 |
mbed_official | 237:f3da66175598 | 601 | #define ADC_EXTERNALTRIGCONV_T2_CC3 ADC3_4_EXTERNALTRIG_T2_CC3 |
mbed_official | 237:f3da66175598 | 602 | #define ADC_EXTERNALTRIGCONV_T3_CC1 ADC3_4_EXTERNALTRIG_T3_CC1 |
mbed_official | 237:f3da66175598 | 603 | #define ADC_EXTERNALTRIGCONV_T4_CC1 ADC3_4_EXTERNALTRIG_T4_CC1 |
mbed_official | 237:f3da66175598 | 604 | #define ADC_EXTERNALTRIGCONV_T7_TRGO ADC3_4_EXTERNALTRIG_T7_TRGO |
mbed_official | 237:f3da66175598 | 605 | #define ADC_EXTERNALTRIGCONV_T8_CC1 ADC3_4_EXTERNALTRIG_T8_CC1 |
mbed_official | 237:f3da66175598 | 606 | #define ADC_EXTERNALTRIGCONV_EXT_IT2 ADC3_4_EXTERNALTRIG_EXT_IT2 |
mbed_official | 237:f3da66175598 | 607 | |
mbed_official | 237:f3da66175598 | 608 | /*!< External triggers of regular group for ADC1&ADC2, ADC3&ADC4 */ |
mbed_official | 237:f3da66175598 | 609 | /* Note: Triggers affected to group ADC1_2 by default, redirected to group */ |
mbed_official | 237:f3da66175598 | 610 | /* ADC3_4 by driver when needed. */ |
mbed_official | 237:f3da66175598 | 611 | #define ADC_EXTERNALTRIGCONV_T1_CC3 ADC1_2_EXTERNALTRIG_T1_CC3 |
mbed_official | 237:f3da66175598 | 612 | #define ADC_EXTERNALTRIGCONV_T1_TRGO ADC1_2_EXTERNALTRIG_T1_TRGO |
mbed_official | 237:f3da66175598 | 613 | #define ADC_EXTERNALTRIGCONV_T1_TRGO2 ADC1_2_EXTERNALTRIG_T1_TRGO2 |
mbed_official | 237:f3da66175598 | 614 | #define ADC_EXTERNALTRIGCONV_T2_TRGO ADC1_2_EXTERNALTRIG_T2_TRGO |
mbed_official | 237:f3da66175598 | 615 | #define ADC_EXTERNALTRIGCONV_T3_TRGO ADC1_2_EXTERNALTRIG_T3_TRGO |
mbed_official | 237:f3da66175598 | 616 | #define ADC_EXTERNALTRIGCONV_T4_TRGO ADC1_2_EXTERNALTRIG_T4_TRGO |
mbed_official | 237:f3da66175598 | 617 | #define ADC_EXTERNALTRIGCONV_T8_TRGO ADC1_2_EXTERNALTRIG_T8_TRGO |
mbed_official | 237:f3da66175598 | 618 | #define ADC_EXTERNALTRIGCONV_T8_TRGO2 ADC1_2_EXTERNALTRIG_T8_TRGO2 |
mbed_official | 237:f3da66175598 | 619 | #define ADC_EXTERNALTRIGCONV_T15_TRGO ADC1_2_EXTERNALTRIG_T15_TRGO |
mbed_official | 237:f3da66175598 | 620 | |
mbed_official | 237:f3da66175598 | 621 | #define ADC_SOFTWARE_START ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 622 | |
mbed_official | 237:f3da66175598 | 623 | #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \ |
mbed_official | 237:f3da66175598 | 624 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \ |
mbed_official | 237:f3da66175598 | 625 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \ |
mbed_official | 237:f3da66175598 | 626 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC4) || \ |
mbed_official | 237:f3da66175598 | 627 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \ |
mbed_official | 237:f3da66175598 | 628 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T6_TRGO) || \ |
mbed_official | 237:f3da66175598 | 629 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \ |
mbed_official | 237:f3da66175598 | 630 | \ |
mbed_official | 237:f3da66175598 | 631 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC1) || \ |
mbed_official | 237:f3da66175598 | 632 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC3) || \ |
mbed_official | 237:f3da66175598 | 633 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC1) || \ |
mbed_official | 237:f3da66175598 | 634 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC1) || \ |
mbed_official | 237:f3da66175598 | 635 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T7_TRGO) || \ |
mbed_official | 237:f3da66175598 | 636 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_CC1) || \ |
mbed_official | 237:f3da66175598 | 637 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT2) || \ |
mbed_official | 237:f3da66175598 | 638 | \ |
mbed_official | 237:f3da66175598 | 639 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \ |
mbed_official | 237:f3da66175598 | 640 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO) || \ |
mbed_official | 237:f3da66175598 | 641 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO2) || \ |
mbed_official | 237:f3da66175598 | 642 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \ |
mbed_official | 237:f3da66175598 | 643 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \ |
mbed_official | 237:f3da66175598 | 644 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_TRGO) || \ |
mbed_official | 237:f3da66175598 | 645 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO) || \ |
mbed_official | 237:f3da66175598 | 646 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO2) || \ |
mbed_official | 237:f3da66175598 | 647 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T15_TRGO) || \ |
mbed_official | 237:f3da66175598 | 648 | \ |
mbed_official | 237:f3da66175598 | 649 | ((REGTRIG) == ADC_SOFTWARE_START) ) |
mbed_official | 237:f3da66175598 | 650 | #endif /* STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 651 | |
mbed_official | 237:f3da66175598 | 652 | #if defined(STM32F302xC) |
mbed_official | 237:f3da66175598 | 653 | /*!< List of external triggers with generic trigger name, independently of */ |
mbed_official | 237:f3da66175598 | 654 | /* ADC target (caution: applies to other ADCs sharing the same common group), */ |
mbed_official | 237:f3da66175598 | 655 | /* sorted by trigger name: */ |
mbed_official | 237:f3da66175598 | 656 | |
mbed_official | 237:f3da66175598 | 657 | /*!< External triggers of regular group for ADC1&ADC2 */ |
mbed_official | 237:f3da66175598 | 658 | #define ADC_EXTERNALTRIGCONV_T1_CC1 ADC1_2_EXTERNALTRIG_T1_CC1 |
mbed_official | 237:f3da66175598 | 659 | #define ADC_EXTERNALTRIGCONV_T1_CC2 ADC1_2_EXTERNALTRIG_T1_CC2 |
mbed_official | 237:f3da66175598 | 660 | #define ADC_EXTERNALTRIGCONV_T1_CC3 ADC1_2_EXTERNALTRIG_T1_CC3 |
mbed_official | 237:f3da66175598 | 661 | #define ADC_EXTERNALTRIGCONV_T1_TRGO ADC1_2_EXTERNALTRIG_T1_TRGO |
mbed_official | 237:f3da66175598 | 662 | #define ADC_EXTERNALTRIGCONV_T1_TRGO2 ADC1_2_EXTERNALTRIG_T1_TRGO2 |
mbed_official | 237:f3da66175598 | 663 | #define ADC_EXTERNALTRIGCONV_T2_CC2 ADC1_2_EXTERNALTRIG_T2_CC2 |
mbed_official | 237:f3da66175598 | 664 | #define ADC_EXTERNALTRIGCONV_T2_TRGO ADC1_2_EXTERNALTRIG_T2_TRGO |
mbed_official | 237:f3da66175598 | 665 | #define ADC_EXTERNALTRIGCONV_T3_CC4 ADC1_2_EXTERNALTRIG_T3_CC4 |
mbed_official | 237:f3da66175598 | 666 | #define ADC_EXTERNALTRIGCONV_T3_TRGO ADC1_2_EXTERNALTRIG_T3_TRGO |
mbed_official | 237:f3da66175598 | 667 | #define ADC_EXTERNALTRIGCONV_T4_CC4 ADC1_2_EXTERNALTRIG_T4_CC4 |
mbed_official | 237:f3da66175598 | 668 | #define ADC_EXTERNALTRIGCONV_T4_TRGO ADC1_2_EXTERNALTRIG_T4_TRGO |
mbed_official | 237:f3da66175598 | 669 | #define ADC_EXTERNALTRIGCONV_T6_TRGO ADC1_2_EXTERNALTRIG_T6_TRGO |
mbed_official | 237:f3da66175598 | 670 | #define ADC_EXTERNALTRIGCONV_T15_TRGO ADC1_2_EXTERNALTRIG_T15_TRGO |
mbed_official | 237:f3da66175598 | 671 | #define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC1_2_EXTERNALTRIG_EXT_IT11 |
mbed_official | 237:f3da66175598 | 672 | |
mbed_official | 237:f3da66175598 | 673 | #define ADC_SOFTWARE_START ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 674 | |
mbed_official | 237:f3da66175598 | 675 | #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \ |
mbed_official | 237:f3da66175598 | 676 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \ |
mbed_official | 237:f3da66175598 | 677 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \ |
mbed_official | 237:f3da66175598 | 678 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \ |
mbed_official | 237:f3da66175598 | 679 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \ |
mbed_official | 237:f3da66175598 | 680 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \ |
mbed_official | 237:f3da66175598 | 681 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \ |
mbed_official | 237:f3da66175598 | 682 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO) || \ |
mbed_official | 237:f3da66175598 | 683 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO2) || \ |
mbed_official | 237:f3da66175598 | 684 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \ |
mbed_official | 237:f3da66175598 | 685 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_TRGO) || \ |
mbed_official | 237:f3da66175598 | 686 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T6_TRGO) || \ |
mbed_official | 237:f3da66175598 | 687 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T15_TRGO) || \ |
mbed_official | 237:f3da66175598 | 688 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC4) || \ |
mbed_official | 237:f3da66175598 | 689 | \ |
mbed_official | 237:f3da66175598 | 690 | ((REGTRIG) == ADC_SOFTWARE_START) ) |
mbed_official | 237:f3da66175598 | 691 | #endif /* STM32F302xC */ |
mbed_official | 237:f3da66175598 | 692 | |
mbed_official | 237:f3da66175598 | 693 | #if defined(STM32F303x8) || defined(STM32F328xx) |
mbed_official | 237:f3da66175598 | 694 | /*!< List of external triggers with generic trigger name, independently of */ |
mbed_official | 237:f3da66175598 | 695 | /* ADC target (caution: applies to other ADCs sharing the same common group), */ |
mbed_official | 237:f3da66175598 | 696 | /* sorted by trigger name: */ |
mbed_official | 237:f3da66175598 | 697 | |
mbed_official | 237:f3da66175598 | 698 | /*!< External triggers of regular group for ADC1&ADC2 */ |
mbed_official | 237:f3da66175598 | 699 | #define ADC_EXTERNALTRIGCONV_T1_CC1 ADC1_2_EXTERNALTRIG_T1_CC1 |
mbed_official | 237:f3da66175598 | 700 | #define ADC_EXTERNALTRIGCONV_T1_CC2 ADC1_2_EXTERNALTRIG_T1_CC2 |
mbed_official | 237:f3da66175598 | 701 | #define ADC_EXTERNALTRIGCONV_T1_CC3 ADC1_2_EXTERNALTRIG_T1_CC3 |
mbed_official | 237:f3da66175598 | 702 | #define ADC_EXTERNALTRIGCONV_T1_TRGO ADC1_2_EXTERNALTRIG_T1_TRGO |
mbed_official | 237:f3da66175598 | 703 | #define ADC_EXTERNALTRIGCONV_T1_TRGO2 ADC1_2_EXTERNALTRIG_T1_TRGO2 |
mbed_official | 237:f3da66175598 | 704 | #define ADC_EXTERNALTRIGCONV_T2_CC2 ADC1_2_EXTERNALTRIG_T2_CC2 |
mbed_official | 237:f3da66175598 | 705 | #define ADC_EXTERNALTRIGCONV_T2_TRGO ADC1_2_EXTERNALTRIG_T2_TRGO |
mbed_official | 237:f3da66175598 | 706 | #define ADC_EXTERNALTRIGCONV_T3_CC4 ADC1_2_EXTERNALTRIG_T3_CC4 |
mbed_official | 237:f3da66175598 | 707 | #define ADC_EXTERNALTRIGCONV_T3_TRGO ADC1_2_EXTERNALTRIG_T3_TRGO |
mbed_official | 237:f3da66175598 | 708 | #define ADC_EXTERNALTRIGCONV_T4_CC4 ADC1_2_EXTERNALTRIG_T4_CC4 |
mbed_official | 237:f3da66175598 | 709 | #define ADC_EXTERNALTRIGCONV_T4_TRGO ADC1_2_EXTERNALTRIG_T4_TRGO |
mbed_official | 237:f3da66175598 | 710 | #define ADC_EXTERNALTRIGCONV_T8_TRGO ADC1_2_EXTERNALTRIG_T8_TRGO |
mbed_official | 237:f3da66175598 | 711 | #define ADC_EXTERNALTRIGCONV_T8_TRGO2 ADC1_2_EXTERNALTRIG_T8_TRGO2 |
mbed_official | 237:f3da66175598 | 712 | #define ADC_EXTERNALTRIGCONV_T6_TRGO ADC1_2_EXTERNALTRIG_T6_TRGO |
mbed_official | 237:f3da66175598 | 713 | #define ADC_EXTERNALTRIGCONV_T15_TRGO ADC1_2_EXTERNALTRIG_T15_TRGO |
mbed_official | 237:f3da66175598 | 714 | #define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC1_2_EXTERNALTRIG_EXT_IT11 |
mbed_official | 237:f3da66175598 | 715 | |
mbed_official | 237:f3da66175598 | 716 | #define ADC_SOFTWARE_START ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 717 | |
mbed_official | 237:f3da66175598 | 718 | #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \ |
mbed_official | 237:f3da66175598 | 719 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \ |
mbed_official | 237:f3da66175598 | 720 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \ |
mbed_official | 237:f3da66175598 | 721 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \ |
mbed_official | 237:f3da66175598 | 722 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \ |
mbed_official | 237:f3da66175598 | 723 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \ |
mbed_official | 237:f3da66175598 | 724 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \ |
mbed_official | 237:f3da66175598 | 725 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO) || \ |
mbed_official | 237:f3da66175598 | 726 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO2) || \ |
mbed_official | 237:f3da66175598 | 727 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO) || \ |
mbed_official | 237:f3da66175598 | 728 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO2) || \ |
mbed_official | 237:f3da66175598 | 729 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \ |
mbed_official | 237:f3da66175598 | 730 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_TRGO) || \ |
mbed_official | 237:f3da66175598 | 731 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T6_TRGO) || \ |
mbed_official | 237:f3da66175598 | 732 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T15_TRGO) || \ |
mbed_official | 237:f3da66175598 | 733 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC4) || \ |
mbed_official | 237:f3da66175598 | 734 | \ |
mbed_official | 237:f3da66175598 | 735 | ((REGTRIG) == ADC_SOFTWARE_START) ) |
mbed_official | 237:f3da66175598 | 736 | #endif /* STM32F303x8 || STM32F328xx */ |
mbed_official | 237:f3da66175598 | 737 | |
mbed_official | 237:f3da66175598 | 738 | #if defined(STM32F334x8) |
mbed_official | 237:f3da66175598 | 739 | /*!< List of external triggers with generic trigger name, independently of */ |
mbed_official | 237:f3da66175598 | 740 | /* ADC target (caution: applies to other ADCs sharing the same common group), */ |
mbed_official | 237:f3da66175598 | 741 | /* sorted by trigger name: */ |
mbed_official | 237:f3da66175598 | 742 | |
mbed_official | 237:f3da66175598 | 743 | /*!< External triggers of regular group for ADC1&ADC2 */ |
mbed_official | 237:f3da66175598 | 744 | #define ADC_EXTERNALTRIGCONV_T1_CC1 ADC1_2_EXTERNALTRIG_T1_CC1 |
mbed_official | 237:f3da66175598 | 745 | #define ADC_EXTERNALTRIGCONV_T1_CC2 ADC1_2_EXTERNALTRIG_T1_CC2 |
mbed_official | 237:f3da66175598 | 746 | #define ADC_EXTERNALTRIGCONV_T1_CC3 ADC1_2_EXTERNALTRIG_T1_CC3 |
mbed_official | 237:f3da66175598 | 747 | #define ADC_EXTERNALTRIGCONV_T1_TRGO ADC1_2_EXTERNALTRIG_T1_TRGO |
mbed_official | 237:f3da66175598 | 748 | #define ADC_EXTERNALTRIGCONV_T1_TRGO2 ADC1_2_EXTERNALTRIG_T1_TRGO2 |
mbed_official | 237:f3da66175598 | 749 | #define ADC_EXTERNALTRIGCONV_T2_CC2 ADC1_2_EXTERNALTRIG_T2_CC2 |
mbed_official | 237:f3da66175598 | 750 | #define ADC_EXTERNALTRIGCONV_T2_TRGO ADC1_2_EXTERNALTRIG_T2_TRGO |
mbed_official | 237:f3da66175598 | 751 | #define ADC_EXTERNALTRIGCONV_T3_CC4 ADC1_2_EXTERNALTRIG_T3_CC4 |
mbed_official | 237:f3da66175598 | 752 | #define ADC_EXTERNALTRIGCONV_T3_TRGO ADC1_2_EXTERNALTRIG_T3_TRGO |
mbed_official | 237:f3da66175598 | 753 | #define ADC_EXTERNALTRIGCONV_T6_TRGO ADC1_2_EXTERNALTRIG_T6_TRGO |
mbed_official | 237:f3da66175598 | 754 | #define ADC_EXTERNALTRIGCONV_T15_TRGO ADC1_2_EXTERNALTRIG_T15_TRGO |
mbed_official | 237:f3da66175598 | 755 | #define ADC_EXTERNALTRIGCONVHRTIM_TRG1 ADC1_2_EXTERNALTRIG_HRTIM_TRG1 |
mbed_official | 237:f3da66175598 | 756 | #define ADC_EXTERNALTRIGCONVHRTIM_TRG3 ADC1_2_EXTERNALTRIG_HRTIM_TRG3 |
mbed_official | 237:f3da66175598 | 757 | #define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC1_2_EXTERNALTRIG_EXT_IT11 |
mbed_official | 237:f3da66175598 | 758 | |
mbed_official | 237:f3da66175598 | 759 | #define ADC_SOFTWARE_START ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 760 | |
mbed_official | 237:f3da66175598 | 761 | #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \ |
mbed_official | 237:f3da66175598 | 762 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \ |
mbed_official | 237:f3da66175598 | 763 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \ |
mbed_official | 237:f3da66175598 | 764 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \ |
mbed_official | 237:f3da66175598 | 765 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \ |
mbed_official | 237:f3da66175598 | 766 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \ |
mbed_official | 237:f3da66175598 | 767 | ((REGTRIG) == ADC_EXTERNALTRIGCONVHRTIM_TRG1) || \ |
mbed_official | 237:f3da66175598 | 768 | ((REGTRIG) == ADC_EXTERNALTRIGCONVHRTIM_TRG3) || \ |
mbed_official | 237:f3da66175598 | 769 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO) || \ |
mbed_official | 237:f3da66175598 | 770 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO2) || \ |
mbed_official | 237:f3da66175598 | 771 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \ |
mbed_official | 237:f3da66175598 | 772 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T6_TRGO) || \ |
mbed_official | 237:f3da66175598 | 773 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T15_TRGO) || \ |
mbed_official | 237:f3da66175598 | 774 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC4) || \ |
mbed_official | 237:f3da66175598 | 775 | \ |
mbed_official | 237:f3da66175598 | 776 | ((REGTRIG) == ADC_SOFTWARE_START) ) |
mbed_official | 237:f3da66175598 | 777 | #endif /* STM32F334x8 */ |
mbed_official | 237:f3da66175598 | 778 | |
mbed_official | 237:f3da66175598 | 779 | #if defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 780 | /* List of external triggers with generic trigger name, sorted by trigger */ |
mbed_official | 237:f3da66175598 | 781 | /* name: */ |
mbed_official | 237:f3da66175598 | 782 | |
mbed_official | 237:f3da66175598 | 783 | /* External triggers of regular group for ADC1 */ |
mbed_official | 237:f3da66175598 | 784 | #define ADC_EXTERNALTRIGCONV_T1_CC1 ADC1_EXTERNALTRIG_T1_CC1 |
mbed_official | 237:f3da66175598 | 785 | #define ADC_EXTERNALTRIGCONV_T1_CC2 ADC1_EXTERNALTRIG_T1_CC2 |
mbed_official | 237:f3da66175598 | 786 | #define ADC_EXTERNALTRIGCONV_T1_CC3 ADC1_EXTERNALTRIG_T1_CC3 |
mbed_official | 237:f3da66175598 | 787 | #define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC1_EXTERNALTRIG_EXT_IT11 |
mbed_official | 237:f3da66175598 | 788 | #define ADC_EXTERNALTRIGCONV_T1_TRGO ADC1_EXTERNALTRIG_T1_TRGO |
mbed_official | 237:f3da66175598 | 789 | #define ADC_EXTERNALTRIGCONV_T1_TRGO2 ADC1_EXTERNALTRIG_T1_TRGO2 |
mbed_official | 237:f3da66175598 | 790 | #define ADC_EXTERNALTRIGCONV_T2_TRGO ADC1_EXTERNALTRIG_T2_TRGO |
mbed_official | 237:f3da66175598 | 791 | #define ADC_EXTERNALTRIGCONV_T6_TRGO ADC1_EXTERNALTRIG_T6_TRGO |
mbed_official | 237:f3da66175598 | 792 | #define ADC_EXTERNALTRIGCONV_T15_TRGO ADC1_EXTERNALTRIG_T15_TRGO |
mbed_official | 237:f3da66175598 | 793 | #define ADC_SOFTWARE_START ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 794 | |
mbed_official | 237:f3da66175598 | 795 | #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \ |
mbed_official | 237:f3da66175598 | 796 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \ |
mbed_official | 237:f3da66175598 | 797 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \ |
mbed_official | 237:f3da66175598 | 798 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \ |
mbed_official | 237:f3da66175598 | 799 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO) || \ |
mbed_official | 237:f3da66175598 | 800 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO2) || \ |
mbed_official | 237:f3da66175598 | 801 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \ |
mbed_official | 237:f3da66175598 | 802 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T6_TRGO) || \ |
mbed_official | 237:f3da66175598 | 803 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T15_TRGO) || \ |
mbed_official | 237:f3da66175598 | 804 | ((REGTRIG) == ADC_SOFTWARE_START) ) |
mbed_official | 237:f3da66175598 | 805 | #endif /* STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 806 | /** |
mbed_official | 237:f3da66175598 | 807 | * @} |
mbed_official | 237:f3da66175598 | 808 | */ |
mbed_official | 237:f3da66175598 | 809 | |
mbed_official | 237:f3da66175598 | 810 | /** @defgroup ADCEx_Internal_HAL_driver_Ext_trig_src_Regular |
mbed_official | 237:f3da66175598 | 811 | * @{ |
mbed_official | 237:f3da66175598 | 812 | */ |
mbed_official | 237:f3da66175598 | 813 | #if defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 814 | /* List of external triggers for common groups ADC1&ADC2 and/or ADC3&ADC4: */ |
mbed_official | 237:f3da66175598 | 815 | /* (used internally by HAL driver. To not use into HAL structure parameters) */ |
mbed_official | 237:f3da66175598 | 816 | |
mbed_official | 237:f3da66175598 | 817 | /* External triggers of regular group for ADC1 & ADC2 */ |
mbed_official | 237:f3da66175598 | 818 | #define ADC1_2_EXTERNALTRIG_T1_CC1 ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 819 | #define ADC1_2_EXTERNALTRIG_T1_CC2 ((uint32_t)ADC_CFGR_EXTSEL_0) |
mbed_official | 237:f3da66175598 | 820 | #define ADC1_2_EXTERNALTRIG_T1_CC3 ((uint32_t)ADC_CFGR_EXTSEL_1) |
mbed_official | 237:f3da66175598 | 821 | #define ADC1_2_EXTERNALTRIG_T2_CC2 ((uint32_t)(ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 822 | #define ADC1_2_EXTERNALTRIG_T3_TRGO ((uint32_t)ADC_CFGR_EXTSEL_2) |
mbed_official | 237:f3da66175598 | 823 | #define ADC1_2_EXTERNALTRIG_T4_CC4 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 824 | #define ADC1_2_EXTERNALTRIG_EXT_IT11 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 825 | #define ADC1_2_EXTERNALTRIG_T8_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 826 | #define ADC1_2_EXTERNALTRIG_T8_TRGO2 ((uint32_t) ADC_CFGR_EXTSEL_3) |
mbed_official | 237:f3da66175598 | 827 | #define ADC1_2_EXTERNALTRIG_T1_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 828 | #define ADC1_2_EXTERNALTRIG_T1_TRGO2 ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 829 | #define ADC1_2_EXTERNALTRIG_T2_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 830 | #define ADC1_2_EXTERNALTRIG_T4_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2)) |
mbed_official | 237:f3da66175598 | 831 | #define ADC1_2_EXTERNALTRIG_T6_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 832 | #define ADC1_2_EXTERNALTRIG_T15_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 833 | #define ADC1_2_EXTERNALTRIG_T3_CC4 ((uint32_t)ADC_CFGR_EXTSEL) |
mbed_official | 237:f3da66175598 | 834 | |
mbed_official | 237:f3da66175598 | 835 | /* External triggers of regular group for ADC3 & ADC4 */ |
mbed_official | 237:f3da66175598 | 836 | #define ADC3_4_EXTERNALTRIG_T3_CC1 ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 837 | #define ADC3_4_EXTERNALTRIG_T2_CC3 ((uint32_t)ADC_CFGR_EXTSEL_0) |
mbed_official | 237:f3da66175598 | 838 | #define ADC3_4_EXTERNALTRIG_T1_CC3 ((uint32_t)ADC_CFGR_EXTSEL_1) |
mbed_official | 237:f3da66175598 | 839 | #define ADC3_4_EXTERNALTRIG_T8_CC1 ((uint32_t)(ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 840 | #define ADC3_4_EXTERNALTRIG_T8_TRGO ((uint32_t)ADC_CFGR_EXTSEL_2) |
mbed_official | 237:f3da66175598 | 841 | #define ADC3_4_EXTERNALTRIG_EXT_IT2 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 842 | #define ADC3_4_EXTERNALTRIG_T4_CC1 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 843 | #define ADC3_4_EXTERNALTRIG_T2_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 844 | #define ADC3_4_EXTERNALTRIG_T8_TRGO2 ((uint32_t)ADC_CFGR_EXTSEL_3) |
mbed_official | 237:f3da66175598 | 845 | #define ADC3_4_EXTERNALTRIG_T1_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 846 | #define ADC3_4_EXTERNALTRIG_T1_TRGO2 ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 847 | #define ADC3_4_EXTERNALTRIG_T3_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 848 | #define ADC3_4_EXTERNALTRIG_T4_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2)) |
mbed_official | 237:f3da66175598 | 849 | #define ADC3_4_EXTERNALTRIG_T7_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 850 | #define ADC3_4_EXTERNALTRIG_T15_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 851 | #define ADC3_4_EXTERNALTRIG_T2_CC1 ((uint32_t)ADC_CFGR_EXTSEL) |
mbed_official | 237:f3da66175598 | 852 | #endif /* STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 853 | |
mbed_official | 237:f3da66175598 | 854 | #if defined(STM32F302xC) |
mbed_official | 237:f3da66175598 | 855 | /* List of external triggers of common group ADC1&ADC2: */ |
mbed_official | 237:f3da66175598 | 856 | /* (used internally by HAL driver. To not use into HAL structure parameters) */ |
mbed_official | 237:f3da66175598 | 857 | #define ADC1_2_EXTERNALTRIG_T1_CC1 ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 858 | #define ADC1_2_EXTERNALTRIG_T1_CC2 ((uint32_t)ADC_CFGR_EXTSEL_0) |
mbed_official | 237:f3da66175598 | 859 | #define ADC1_2_EXTERNALTRIG_T1_CC3 ((uint32_t)ADC_CFGR_EXTSEL_1) |
mbed_official | 237:f3da66175598 | 860 | #define ADC1_2_EXTERNALTRIG_T2_CC2 ((uint32_t)(ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 861 | #define ADC1_2_EXTERNALTRIG_T3_TRGO ((uint32_t)ADC_CFGR_EXTSEL_2) |
mbed_official | 237:f3da66175598 | 862 | #define ADC1_2_EXTERNALTRIG_T4_CC4 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 863 | #define ADC1_2_EXTERNALTRIG_EXT_IT11 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 864 | #define ADC1_2_EXTERNALTRIG_T1_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 865 | #define ADC1_2_EXTERNALTRIG_T1_TRGO2 ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 866 | #define ADC1_2_EXTERNALTRIG_T2_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 867 | #define ADC1_2_EXTERNALTRIG_T4_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2)) |
mbed_official | 237:f3da66175598 | 868 | #define ADC1_2_EXTERNALTRIG_T6_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 869 | #define ADC1_2_EXTERNALTRIG_T15_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 870 | #define ADC1_2_EXTERNALTRIG_T3_CC4 ((uint32_t)ADC_CFGR_EXTSEL) |
mbed_official | 237:f3da66175598 | 871 | #endif /* STM32F302xC */ |
mbed_official | 237:f3da66175598 | 872 | |
mbed_official | 237:f3da66175598 | 873 | #if defined(STM32F303x8) || defined(STM32F328xx) |
mbed_official | 237:f3da66175598 | 874 | /* List of external triggers of common group ADC1&ADC2: */ |
mbed_official | 237:f3da66175598 | 875 | /* (used internally by HAL driver. To not use into HAL structure parameters) */ |
mbed_official | 237:f3da66175598 | 876 | #define ADC1_2_EXTERNALTRIG_T1_CC1 ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 877 | #define ADC1_2_EXTERNALTRIG_T1_CC2 ((uint32_t)ADC_CFGR_EXTSEL_0) |
mbed_official | 237:f3da66175598 | 878 | #define ADC1_2_EXTERNALTRIG_T1_CC3 ((uint32_t)ADC_CFGR_EXTSEL_1) |
mbed_official | 237:f3da66175598 | 879 | #define ADC1_2_EXTERNALTRIG_T2_CC2 ((uint32_t)(ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 880 | #define ADC1_2_EXTERNALTRIG_T3_TRGO ((uint32_t)ADC_CFGR_EXTSEL_2) |
mbed_official | 237:f3da66175598 | 881 | #define ADC1_2_EXTERNALTRIG_T4_CC4 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 882 | #define ADC1_2_EXTERNALTRIG_EXT_IT11 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 883 | #define ADC1_2_EXTERNALTRIG_T8_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 884 | #define ADC1_2_EXTERNALTRIG_T8_TRGO2 ((uint32_t) ADC_CFGR_EXTSEL_3) |
mbed_official | 237:f3da66175598 | 885 | #define ADC1_2_EXTERNALTRIG_T1_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 886 | #define ADC1_2_EXTERNALTRIG_T1_TRGO2 ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 887 | #define ADC1_2_EXTERNALTRIG_T2_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 888 | #define ADC1_2_EXTERNALTRIG_T4_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2)) |
mbed_official | 237:f3da66175598 | 889 | #define ADC1_2_EXTERNALTRIG_T6_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 890 | #define ADC1_2_EXTERNALTRIG_T15_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 891 | #define ADC1_2_EXTERNALTRIG_T3_CC4 ((uint32_t)ADC_CFGR_EXTSEL) |
mbed_official | 237:f3da66175598 | 892 | #endif /* STM32F303x8 || STM32F328xx */ |
mbed_official | 237:f3da66175598 | 893 | |
mbed_official | 237:f3da66175598 | 894 | #if defined(STM32F334x8) |
mbed_official | 237:f3da66175598 | 895 | /* List of external triggers of common group ADC1&ADC2: */ |
mbed_official | 237:f3da66175598 | 896 | /* (used internally by HAL driver. To not use into HAL structure parameters) */ |
mbed_official | 237:f3da66175598 | 897 | #define ADC1_2_EXTERNALTRIG_T1_CC1 ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 898 | #define ADC1_2_EXTERNALTRIG_T1_CC2 ((uint32_t)ADC_CFGR_EXTSEL_0) |
mbed_official | 237:f3da66175598 | 899 | #define ADC1_2_EXTERNALTRIG_T1_CC3 ((uint32_t)ADC_CFGR_EXTSEL_1) |
mbed_official | 237:f3da66175598 | 900 | #define ADC1_2_EXTERNALTRIG_T2_CC2 ((uint32_t)(ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 901 | #define ADC1_2_EXTERNALTRIG_T3_TRGO ((uint32_t)ADC_CFGR_EXTSEL_2) |
mbed_official | 237:f3da66175598 | 902 | #define ADC1_2_EXTERNALTRIG_EXT_IT11 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 903 | #define ADC1_2_EXTERNALTRIG_HRTIM_TRG1 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 904 | #define ADC1_2_EXTERNALTRIG_HRTIM_TRG3 ((uint32_t) ADC_CFGR_EXTSEL_3) |
mbed_official | 237:f3da66175598 | 905 | #define ADC1_2_EXTERNALTRIG_T1_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 906 | #define ADC1_2_EXTERNALTRIG_T1_TRGO2 ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 907 | #define ADC1_2_EXTERNALTRIG_T2_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 908 | #define ADC1_2_EXTERNALTRIG_T6_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 909 | #define ADC1_2_EXTERNALTRIG_T15_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 910 | #define ADC1_2_EXTERNALTRIG_T3_CC4 ((uint32_t)ADC_CFGR_EXTSEL) |
mbed_official | 237:f3da66175598 | 911 | #endif /* STM32F334x8 */ |
mbed_official | 237:f3da66175598 | 912 | |
mbed_official | 237:f3da66175598 | 913 | #if defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 914 | /* List of external triggers of regular group for ADC1: */ |
mbed_official | 237:f3da66175598 | 915 | /* (used internally by HAL driver. To not use into HAL structure parameters) */ |
mbed_official | 237:f3da66175598 | 916 | #define ADC1_EXTERNALTRIG_T1_CC1 ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 917 | #define ADC1_EXTERNALTRIG_T1_CC2 ((uint32_t)ADC_CFGR_EXTSEL_0) |
mbed_official | 237:f3da66175598 | 918 | #define ADC1_EXTERNALTRIG_T1_CC3 ((uint32_t)ADC_CFGR_EXTSEL_1) |
mbed_official | 237:f3da66175598 | 919 | #define ADC1_EXTERNALTRIG_EXT_IT11 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 920 | #define ADC1_EXTERNALTRIG_T1_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 921 | #define ADC1_EXTERNALTRIG_T1_TRGO2 ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 922 | #define ADC1_EXTERNALTRIG_T2_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 923 | #define ADC1_EXTERNALTRIG_T6_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 924 | #define ADC1_EXTERNALTRIG_T15_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 925 | #define ADC_SOFTWARE_START ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 926 | #endif /* STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 927 | /** |
mbed_official | 237:f3da66175598 | 928 | * @} |
mbed_official | 237:f3da66175598 | 929 | */ |
mbed_official | 237:f3da66175598 | 930 | |
mbed_official | 237:f3da66175598 | 931 | |
mbed_official | 237:f3da66175598 | 932 | /** @defgroup ADCEx_EOCSelection |
mbed_official | 237:f3da66175598 | 933 | * @{ |
mbed_official | 237:f3da66175598 | 934 | */ |
mbed_official | 237:f3da66175598 | 935 | #define EOC_SINGLE_CONV ((uint32_t) ADC_ISR_EOC) |
mbed_official | 237:f3da66175598 | 936 | #define EOC_SEQ_CONV ((uint32_t) ADC_ISR_EOS) |
mbed_official | 237:f3da66175598 | 937 | #define EOC_SINGLE_SEQ_CONV ((uint32_t)(ADC_ISR_EOC | ADC_ISR_EOS)) /*!< reserved for future use */ |
mbed_official | 237:f3da66175598 | 938 | |
mbed_official | 237:f3da66175598 | 939 | #define IS_ADC_EOC_SELECTION(EOC_SELECTION) (((EOC_SELECTION) == EOC_SINGLE_CONV) || \ |
mbed_official | 237:f3da66175598 | 940 | ((EOC_SELECTION) == EOC_SEQ_CONV) || \ |
mbed_official | 237:f3da66175598 | 941 | ((EOC_SELECTION) == EOC_SINGLE_SEQ_CONV) ) |
mbed_official | 237:f3da66175598 | 942 | /** |
mbed_official | 237:f3da66175598 | 943 | * @} |
mbed_official | 237:f3da66175598 | 944 | */ |
mbed_official | 237:f3da66175598 | 945 | |
mbed_official | 237:f3da66175598 | 946 | /** @defgroup ADCEx_Overrun |
mbed_official | 237:f3da66175598 | 947 | * @{ |
mbed_official | 237:f3da66175598 | 948 | */ |
mbed_official | 237:f3da66175598 | 949 | #define OVR_DATA_OVERWRITTEN ((uint32_t)0x00000000) /*!< Default setting, to be used for compatibility with other STM32 devices */ |
mbed_official | 237:f3da66175598 | 950 | #define OVR_DATA_PRESERVED ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 951 | |
mbed_official | 237:f3da66175598 | 952 | #define IS_ADC_OVERRUN(OVR) (((OVR) == OVR_DATA_PRESERVED) || \ |
mbed_official | 237:f3da66175598 | 953 | ((OVR) == OVR_DATA_OVERWRITTEN) ) |
mbed_official | 237:f3da66175598 | 954 | /** |
mbed_official | 237:f3da66175598 | 955 | * @} |
mbed_official | 237:f3da66175598 | 956 | */ |
mbed_official | 237:f3da66175598 | 957 | |
mbed_official | 237:f3da66175598 | 958 | /** @defgroup ADCEx_channels |
mbed_official | 237:f3da66175598 | 959 | * @{ |
mbed_official | 237:f3da66175598 | 960 | */ |
mbed_official | 237:f3da66175598 | 961 | /* Note: Depending on devices, some channels may not be available on package */ |
mbed_official | 237:f3da66175598 | 962 | /* pins. Refer to device datasheet for channels availability. */ |
mbed_official | 237:f3da66175598 | 963 | #define ADC_CHANNEL_1 ((uint32_t)(ADC_SQR3_SQ10_0)) |
mbed_official | 237:f3da66175598 | 964 | #define ADC_CHANNEL_2 ((uint32_t)(ADC_SQR3_SQ10_1)) |
mbed_official | 237:f3da66175598 | 965 | #define ADC_CHANNEL_3 ((uint32_t)(ADC_SQR3_SQ10_1 | ADC_SQR3_SQ10_0)) |
mbed_official | 237:f3da66175598 | 966 | #define ADC_CHANNEL_4 ((uint32_t)(ADC_SQR3_SQ10_2)) |
mbed_official | 237:f3da66175598 | 967 | #define ADC_CHANNEL_5 ((uint32_t)(ADC_SQR3_SQ10_2 | ADC_SQR3_SQ10_0)) |
mbed_official | 237:f3da66175598 | 968 | #define ADC_CHANNEL_6 ((uint32_t)(ADC_SQR3_SQ10_2 | ADC_SQR3_SQ10_1)) |
mbed_official | 237:f3da66175598 | 969 | #define ADC_CHANNEL_7 ((uint32_t)(ADC_SQR3_SQ10_2 | ADC_SQR3_SQ10_1 | ADC_SQR3_SQ10_0)) |
mbed_official | 237:f3da66175598 | 970 | #define ADC_CHANNEL_8 ((uint32_t)(ADC_SQR3_SQ10_3)) |
mbed_official | 237:f3da66175598 | 971 | #define ADC_CHANNEL_9 ((uint32_t)(ADC_SQR3_SQ10_3 | ADC_SQR3_SQ10_0)) |
mbed_official | 237:f3da66175598 | 972 | #define ADC_CHANNEL_10 ((uint32_t)(ADC_SQR3_SQ10_3 | ADC_SQR3_SQ10_1)) |
mbed_official | 237:f3da66175598 | 973 | #define ADC_CHANNEL_11 ((uint32_t)(ADC_SQR3_SQ10_3 | ADC_SQR3_SQ10_1 | ADC_SQR3_SQ10_0)) |
mbed_official | 237:f3da66175598 | 974 | #define ADC_CHANNEL_12 ((uint32_t)(ADC_SQR3_SQ10_3 | ADC_SQR3_SQ10_2)) |
mbed_official | 237:f3da66175598 | 975 | #define ADC_CHANNEL_13 ((uint32_t)(ADC_SQR3_SQ10_3 | ADC_SQR3_SQ10_2 | ADC_SQR3_SQ10_0)) |
mbed_official | 237:f3da66175598 | 976 | #define ADC_CHANNEL_14 ((uint32_t)(ADC_SQR3_SQ10_3 | ADC_SQR3_SQ10_2 | ADC_SQR3_SQ10_1)) |
mbed_official | 237:f3da66175598 | 977 | #define ADC_CHANNEL_15 ((uint32_t)(ADC_SQR3_SQ10_3 | ADC_SQR3_SQ10_2 | ADC_SQR3_SQ10_1 | ADC_SQR3_SQ10_0)) |
mbed_official | 237:f3da66175598 | 978 | #define ADC_CHANNEL_16 ((uint32_t)(ADC_SQR3_SQ10_4)) |
mbed_official | 237:f3da66175598 | 979 | #define ADC_CHANNEL_17 ((uint32_t)(ADC_SQR3_SQ10_4 | ADC_SQR3_SQ10_0)) |
mbed_official | 237:f3da66175598 | 980 | #define ADC_CHANNEL_18 ((uint32_t)(ADC_SQR3_SQ10_4 | ADC_SQR3_SQ10_1)) |
mbed_official | 237:f3da66175598 | 981 | |
mbed_official | 237:f3da66175598 | 982 | /* Note: Vopamp1, TempSensor and Vbat internal channels available on ADC1 only */ |
mbed_official | 237:f3da66175598 | 983 | #define ADC_CHANNEL_VOPAMP1 ADC_CHANNEL_15 |
mbed_official | 237:f3da66175598 | 984 | #define ADC_CHANNEL_TEMPSENSOR ADC_CHANNEL_16 |
mbed_official | 237:f3da66175598 | 985 | #define ADC_CHANNEL_VBAT ADC_CHANNEL_17 |
mbed_official | 237:f3da66175598 | 986 | |
mbed_official | 237:f3da66175598 | 987 | /* Note: Vopamp2/3/4 internal channels available on ADC2/3/4 respectively */ |
mbed_official | 237:f3da66175598 | 988 | #define ADC_CHANNEL_VOPAMP2 ADC_CHANNEL_17 |
mbed_official | 237:f3da66175598 | 989 | #define ADC_CHANNEL_VOPAMP3 ADC_CHANNEL_17 |
mbed_official | 237:f3da66175598 | 990 | #define ADC_CHANNEL_VOPAMP4 ADC_CHANNEL_17 |
mbed_official | 237:f3da66175598 | 991 | |
mbed_official | 237:f3da66175598 | 992 | /* Note: VrefInt internal channels available on all ADCs, but only */ |
mbed_official | 237:f3da66175598 | 993 | /* one ADC is allowed to be connected to VrefInt at the same time. */ |
mbed_official | 237:f3da66175598 | 994 | #define ADC_CHANNEL_VREFINT ((uint32_t)ADC_CHANNEL_18) |
mbed_official | 237:f3da66175598 | 995 | |
mbed_official | 237:f3da66175598 | 996 | #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) == ADC_CHANNEL_1) || \ |
mbed_official | 237:f3da66175598 | 997 | ((CHANNEL) == ADC_CHANNEL_2) || \ |
mbed_official | 237:f3da66175598 | 998 | ((CHANNEL) == ADC_CHANNEL_3) || \ |
mbed_official | 237:f3da66175598 | 999 | ((CHANNEL) == ADC_CHANNEL_4) || \ |
mbed_official | 237:f3da66175598 | 1000 | ((CHANNEL) == ADC_CHANNEL_5) || \ |
mbed_official | 237:f3da66175598 | 1001 | ((CHANNEL) == ADC_CHANNEL_6) || \ |
mbed_official | 237:f3da66175598 | 1002 | ((CHANNEL) == ADC_CHANNEL_7) || \ |
mbed_official | 237:f3da66175598 | 1003 | ((CHANNEL) == ADC_CHANNEL_8) || \ |
mbed_official | 237:f3da66175598 | 1004 | ((CHANNEL) == ADC_CHANNEL_9) || \ |
mbed_official | 237:f3da66175598 | 1005 | ((CHANNEL) == ADC_CHANNEL_10) || \ |
mbed_official | 237:f3da66175598 | 1006 | ((CHANNEL) == ADC_CHANNEL_11) || \ |
mbed_official | 237:f3da66175598 | 1007 | ((CHANNEL) == ADC_CHANNEL_12) || \ |
mbed_official | 237:f3da66175598 | 1008 | ((CHANNEL) == ADC_CHANNEL_13) || \ |
mbed_official | 237:f3da66175598 | 1009 | ((CHANNEL) == ADC_CHANNEL_14) || \ |
mbed_official | 237:f3da66175598 | 1010 | ((CHANNEL) == ADC_CHANNEL_15) || \ |
mbed_official | 237:f3da66175598 | 1011 | ((CHANNEL) == ADC_CHANNEL_TEMPSENSOR) || \ |
mbed_official | 237:f3da66175598 | 1012 | ((CHANNEL) == ADC_CHANNEL_VBAT) || \ |
mbed_official | 237:f3da66175598 | 1013 | ((CHANNEL) == ADC_CHANNEL_VREFINT) || \ |
mbed_official | 237:f3da66175598 | 1014 | ((CHANNEL) == ADC_CHANNEL_VOPAMP1) || \ |
mbed_official | 237:f3da66175598 | 1015 | ((CHANNEL) == ADC_CHANNEL_VOPAMP2) || \ |
mbed_official | 237:f3da66175598 | 1016 | ((CHANNEL) == ADC_CHANNEL_VOPAMP3) || \ |
mbed_official | 237:f3da66175598 | 1017 | ((CHANNEL) == ADC_CHANNEL_VOPAMP4) ) |
mbed_official | 237:f3da66175598 | 1018 | |
mbed_official | 237:f3da66175598 | 1019 | #define IS_ADC_DIFF_CHANNEL(CHANNEL) (((CHANNEL) == ADC_CHANNEL_1) || \ |
mbed_official | 237:f3da66175598 | 1020 | ((CHANNEL) == ADC_CHANNEL_2) || \ |
mbed_official | 237:f3da66175598 | 1021 | ((CHANNEL) == ADC_CHANNEL_3) || \ |
mbed_official | 237:f3da66175598 | 1022 | ((CHANNEL) == ADC_CHANNEL_4) || \ |
mbed_official | 237:f3da66175598 | 1023 | ((CHANNEL) == ADC_CHANNEL_5) || \ |
mbed_official | 237:f3da66175598 | 1024 | ((CHANNEL) == ADC_CHANNEL_6) || \ |
mbed_official | 237:f3da66175598 | 1025 | ((CHANNEL) == ADC_CHANNEL_7) || \ |
mbed_official | 237:f3da66175598 | 1026 | ((CHANNEL) == ADC_CHANNEL_8) || \ |
mbed_official | 237:f3da66175598 | 1027 | ((CHANNEL) == ADC_CHANNEL_9) || \ |
mbed_official | 237:f3da66175598 | 1028 | ((CHANNEL) == ADC_CHANNEL_10) || \ |
mbed_official | 237:f3da66175598 | 1029 | ((CHANNEL) == ADC_CHANNEL_11) || \ |
mbed_official | 237:f3da66175598 | 1030 | ((CHANNEL) == ADC_CHANNEL_12) || \ |
mbed_official | 237:f3da66175598 | 1031 | ((CHANNEL) == ADC_CHANNEL_13) || \ |
mbed_official | 237:f3da66175598 | 1032 | ((CHANNEL) == ADC_CHANNEL_14) ) |
mbed_official | 237:f3da66175598 | 1033 | |
mbed_official | 237:f3da66175598 | 1034 | /** |
mbed_official | 237:f3da66175598 | 1035 | * @} |
mbed_official | 237:f3da66175598 | 1036 | */ |
mbed_official | 237:f3da66175598 | 1037 | |
mbed_official | 237:f3da66175598 | 1038 | /** @defgroup ADCEx_sampling_times |
mbed_official | 237:f3da66175598 | 1039 | * @{ |
mbed_official | 237:f3da66175598 | 1040 | */ |
mbed_official | 237:f3da66175598 | 1041 | #define ADC_SAMPLETIME_1CYCLE_5 ((uint32_t)0x00000000) /*!< Sampling time 1.5 ADC clock cycle */ |
mbed_official | 237:f3da66175598 | 1042 | #define ADC_SAMPLETIME_2CYCLES_5 ((uint32_t)ADC_SMPR2_SMP10_0) /*!< Sampling time 2.5 ADC clock cycles */ |
mbed_official | 237:f3da66175598 | 1043 | #define ADC_SAMPLETIME_4CYCLES_5 ((uint32_t)ADC_SMPR2_SMP10_1) /*!< Sampling time 4.5 ADC clock cycles */ |
mbed_official | 237:f3da66175598 | 1044 | #define ADC_SAMPLETIME_7CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP10_1 | ADC_SMPR2_SMP10_0)) /*!< Sampling time 7.5 ADC clock cycles */ |
mbed_official | 237:f3da66175598 | 1045 | #define ADC_SAMPLETIME_19CYCLES_5 ((uint32_t)ADC_SMPR2_SMP10_2) /*!< Sampling time 19.5 ADC clock cycles */ |
mbed_official | 237:f3da66175598 | 1046 | #define ADC_SAMPLETIME_61CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP10_2 | ADC_SMPR2_SMP10_0)) /*!< Sampling time 61.5 ADC clock cycles */ |
mbed_official | 237:f3da66175598 | 1047 | #define ADC_SAMPLETIME_181CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP10_2 | ADC_SMPR2_SMP10_1)) /*!< Sampling time 181.5 ADC clock cycles */ |
mbed_official | 237:f3da66175598 | 1048 | #define ADC_SAMPLETIME_601CYCLES_5 ((uint32_t)ADC_SMPR2_SMP10) /*!< Sampling time 601.5 ADC clock cycles */ |
mbed_official | 237:f3da66175598 | 1049 | |
mbed_official | 237:f3da66175598 | 1050 | #define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SAMPLETIME_1CYCLE_5) || \ |
mbed_official | 237:f3da66175598 | 1051 | ((TIME) == ADC_SAMPLETIME_2CYCLES_5) || \ |
mbed_official | 237:f3da66175598 | 1052 | ((TIME) == ADC_SAMPLETIME_4CYCLES_5) || \ |
mbed_official | 237:f3da66175598 | 1053 | ((TIME) == ADC_SAMPLETIME_7CYCLES_5) || \ |
mbed_official | 237:f3da66175598 | 1054 | ((TIME) == ADC_SAMPLETIME_19CYCLES_5) || \ |
mbed_official | 237:f3da66175598 | 1055 | ((TIME) == ADC_SAMPLETIME_61CYCLES_5) || \ |
mbed_official | 237:f3da66175598 | 1056 | ((TIME) == ADC_SAMPLETIME_181CYCLES_5) || \ |
mbed_official | 237:f3da66175598 | 1057 | ((TIME) == ADC_SAMPLETIME_601CYCLES_5) ) |
mbed_official | 237:f3da66175598 | 1058 | /** |
mbed_official | 237:f3da66175598 | 1059 | * @} |
mbed_official | 237:f3da66175598 | 1060 | */ |
mbed_official | 237:f3da66175598 | 1061 | |
mbed_official | 237:f3da66175598 | 1062 | /** @defgroup ADCEx_SingleDifferential |
mbed_official | 237:f3da66175598 | 1063 | * @{ |
mbed_official | 237:f3da66175598 | 1064 | */ |
mbed_official | 237:f3da66175598 | 1065 | #define ADC_SINGLE_ENDED ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 1066 | #define ADC_DIFFERENTIAL_ENDED ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 1067 | |
mbed_official | 237:f3da66175598 | 1068 | #define IS_ADC_SINGLE_DIFFERENTIAL(SING_DIFF) (((SING_DIFF) == ADC_SINGLE_ENDED) || \ |
mbed_official | 237:f3da66175598 | 1069 | ((SING_DIFF) == ADC_DIFFERENTIAL_ENDED) ) |
mbed_official | 237:f3da66175598 | 1070 | /** |
mbed_official | 237:f3da66175598 | 1071 | * @} |
mbed_official | 237:f3da66175598 | 1072 | */ |
mbed_official | 237:f3da66175598 | 1073 | |
mbed_official | 237:f3da66175598 | 1074 | /** @defgroup ADCEx_OffsetNumber |
mbed_official | 237:f3da66175598 | 1075 | * @{ |
mbed_official | 237:f3da66175598 | 1076 | */ |
mbed_official | 237:f3da66175598 | 1077 | #define ADC_OFFSET_NONE ((uint32_t)0x00) |
mbed_official | 237:f3da66175598 | 1078 | #define ADC_OFFSET_1 ((uint32_t)0x01) |
mbed_official | 237:f3da66175598 | 1079 | #define ADC_OFFSET_2 ((uint32_t)0x02) |
mbed_official | 237:f3da66175598 | 1080 | #define ADC_OFFSET_3 ((uint32_t)0x03) |
mbed_official | 237:f3da66175598 | 1081 | #define ADC_OFFSET_4 ((uint32_t)0x04) |
mbed_official | 237:f3da66175598 | 1082 | |
mbed_official | 237:f3da66175598 | 1083 | #define IS_ADC_OFFSET_NUMBER(OFFSET_NUMBER) (((OFFSET_NUMBER) == ADC_OFFSET_NONE) || \ |
mbed_official | 237:f3da66175598 | 1084 | ((OFFSET_NUMBER) == ADC_OFFSET_1) || \ |
mbed_official | 237:f3da66175598 | 1085 | ((OFFSET_NUMBER) == ADC_OFFSET_2) || \ |
mbed_official | 237:f3da66175598 | 1086 | ((OFFSET_NUMBER) == ADC_OFFSET_3) || \ |
mbed_official | 237:f3da66175598 | 1087 | ((OFFSET_NUMBER) == ADC_OFFSET_4) ) |
mbed_official | 237:f3da66175598 | 1088 | /** |
mbed_official | 237:f3da66175598 | 1089 | * @} |
mbed_official | 237:f3da66175598 | 1090 | */ |
mbed_official | 237:f3da66175598 | 1091 | |
mbed_official | 237:f3da66175598 | 1092 | /** @defgroup ADCEx_regular_rank |
mbed_official | 237:f3da66175598 | 1093 | * @{ |
mbed_official | 237:f3da66175598 | 1094 | */ |
mbed_official | 237:f3da66175598 | 1095 | #define ADC_REGULAR_RANK_1 ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 1096 | #define ADC_REGULAR_RANK_2 ((uint32_t)0x00000002) |
mbed_official | 237:f3da66175598 | 1097 | #define ADC_REGULAR_RANK_3 ((uint32_t)0x00000003) |
mbed_official | 237:f3da66175598 | 1098 | #define ADC_REGULAR_RANK_4 ((uint32_t)0x00000004) |
mbed_official | 237:f3da66175598 | 1099 | #define ADC_REGULAR_RANK_5 ((uint32_t)0x00000005) |
mbed_official | 237:f3da66175598 | 1100 | #define ADC_REGULAR_RANK_6 ((uint32_t)0x00000006) |
mbed_official | 237:f3da66175598 | 1101 | #define ADC_REGULAR_RANK_7 ((uint32_t)0x00000007) |
mbed_official | 237:f3da66175598 | 1102 | #define ADC_REGULAR_RANK_8 ((uint32_t)0x00000008) |
mbed_official | 237:f3da66175598 | 1103 | #define ADC_REGULAR_RANK_9 ((uint32_t)0x00000009) |
mbed_official | 237:f3da66175598 | 1104 | #define ADC_REGULAR_RANK_10 ((uint32_t)0x0000000A) |
mbed_official | 237:f3da66175598 | 1105 | #define ADC_REGULAR_RANK_11 ((uint32_t)0x0000000B) |
mbed_official | 237:f3da66175598 | 1106 | #define ADC_REGULAR_RANK_12 ((uint32_t)0x0000000C) |
mbed_official | 237:f3da66175598 | 1107 | #define ADC_REGULAR_RANK_13 ((uint32_t)0x0000000D) |
mbed_official | 237:f3da66175598 | 1108 | #define ADC_REGULAR_RANK_14 ((uint32_t)0x0000000E) |
mbed_official | 237:f3da66175598 | 1109 | #define ADC_REGULAR_RANK_15 ((uint32_t)0x0000000F) |
mbed_official | 237:f3da66175598 | 1110 | #define ADC_REGULAR_RANK_16 ((uint32_t)0x00000010) |
mbed_official | 237:f3da66175598 | 1111 | |
mbed_official | 237:f3da66175598 | 1112 | #define IS_ADC_REGULAR_RANK(CHANNEL) (((CHANNEL) == ADC_REGULAR_RANK_1 ) || \ |
mbed_official | 237:f3da66175598 | 1113 | ((CHANNEL) == ADC_REGULAR_RANK_2 ) || \ |
mbed_official | 237:f3da66175598 | 1114 | ((CHANNEL) == ADC_REGULAR_RANK_3 ) || \ |
mbed_official | 237:f3da66175598 | 1115 | ((CHANNEL) == ADC_REGULAR_RANK_4 ) || \ |
mbed_official | 237:f3da66175598 | 1116 | ((CHANNEL) == ADC_REGULAR_RANK_5 ) || \ |
mbed_official | 237:f3da66175598 | 1117 | ((CHANNEL) == ADC_REGULAR_RANK_6 ) || \ |
mbed_official | 237:f3da66175598 | 1118 | ((CHANNEL) == ADC_REGULAR_RANK_7 ) || \ |
mbed_official | 237:f3da66175598 | 1119 | ((CHANNEL) == ADC_REGULAR_RANK_8 ) || \ |
mbed_official | 237:f3da66175598 | 1120 | ((CHANNEL) == ADC_REGULAR_RANK_9 ) || \ |
mbed_official | 237:f3da66175598 | 1121 | ((CHANNEL) == ADC_REGULAR_RANK_10) || \ |
mbed_official | 237:f3da66175598 | 1122 | ((CHANNEL) == ADC_REGULAR_RANK_11) || \ |
mbed_official | 237:f3da66175598 | 1123 | ((CHANNEL) == ADC_REGULAR_RANK_12) || \ |
mbed_official | 237:f3da66175598 | 1124 | ((CHANNEL) == ADC_REGULAR_RANK_13) || \ |
mbed_official | 237:f3da66175598 | 1125 | ((CHANNEL) == ADC_REGULAR_RANK_14) || \ |
mbed_official | 237:f3da66175598 | 1126 | ((CHANNEL) == ADC_REGULAR_RANK_15) || \ |
mbed_official | 237:f3da66175598 | 1127 | ((CHANNEL) == ADC_REGULAR_RANK_16) ) |
mbed_official | 237:f3da66175598 | 1128 | /** |
mbed_official | 237:f3da66175598 | 1129 | * @} |
mbed_official | 237:f3da66175598 | 1130 | */ |
mbed_official | 237:f3da66175598 | 1131 | |
mbed_official | 237:f3da66175598 | 1132 | /** @defgroup ADCEx_injected_rank |
mbed_official | 237:f3da66175598 | 1133 | * @{ |
mbed_official | 237:f3da66175598 | 1134 | */ |
mbed_official | 237:f3da66175598 | 1135 | #define ADC_INJECTED_RANK_1 ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 1136 | #define ADC_INJECTED_RANK_2 ((uint32_t)0x00000002) |
mbed_official | 237:f3da66175598 | 1137 | #define ADC_INJECTED_RANK_3 ((uint32_t)0x00000003) |
mbed_official | 237:f3da66175598 | 1138 | #define ADC_INJECTED_RANK_4 ((uint32_t)0x00000004) |
mbed_official | 237:f3da66175598 | 1139 | |
mbed_official | 237:f3da66175598 | 1140 | #define IS_ADC_INJECTED_RANK(CHANNEL) (((CHANNEL) == ADC_INJECTED_RANK_1) || \ |
mbed_official | 237:f3da66175598 | 1141 | ((CHANNEL) == ADC_INJECTED_RANK_2) || \ |
mbed_official | 237:f3da66175598 | 1142 | ((CHANNEL) == ADC_INJECTED_RANK_3) || \ |
mbed_official | 237:f3da66175598 | 1143 | ((CHANNEL) == ADC_INJECTED_RANK_4) ) |
mbed_official | 237:f3da66175598 | 1144 | /** |
mbed_official | 237:f3da66175598 | 1145 | * @} |
mbed_official | 237:f3da66175598 | 1146 | */ |
mbed_official | 237:f3da66175598 | 1147 | |
mbed_official | 237:f3da66175598 | 1148 | /** @defgroup ADCEx_External_trigger_edge_Injected |
mbed_official | 237:f3da66175598 | 1149 | * @{ |
mbed_official | 237:f3da66175598 | 1150 | */ |
mbed_official | 237:f3da66175598 | 1151 | #define ADC_EXTERNALTRIGINJECCONV_EDGE_NONE ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 1152 | #define ADC_EXTERNALTRIGINJECCONV_EDGE_RISING ((uint32_t)ADC_JSQR_JEXTEN_0) |
mbed_official | 237:f3da66175598 | 1153 | #define ADC_EXTERNALTRIGINJECCONV_EDGE_FALLING ((uint32_t)ADC_JSQR_JEXTEN_1) |
mbed_official | 237:f3da66175598 | 1154 | #define ADC_EXTERNALTRIGINJECCONV_EDGE_RISINGFALLING ((uint32_t)ADC_JSQR_JEXTEN) |
mbed_official | 237:f3da66175598 | 1155 | |
mbed_official | 237:f3da66175598 | 1156 | #define IS_ADC_EXTTRIGINJEC_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_NONE) || \ |
mbed_official | 237:f3da66175598 | 1157 | ((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_RISING) || \ |
mbed_official | 237:f3da66175598 | 1158 | ((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_FALLING) || \ |
mbed_official | 237:f3da66175598 | 1159 | ((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_RISINGFALLING) ) |
mbed_official | 237:f3da66175598 | 1160 | /** |
mbed_official | 237:f3da66175598 | 1161 | * @} |
mbed_official | 237:f3da66175598 | 1162 | */ |
mbed_official | 237:f3da66175598 | 1163 | |
mbed_official | 237:f3da66175598 | 1164 | /** @defgroup ADCEx_External_trigger_source_Injected |
mbed_official | 237:f3da66175598 | 1165 | * @{ |
mbed_official | 237:f3da66175598 | 1166 | */ |
mbed_official | 237:f3da66175598 | 1167 | #if defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 1168 | /* List of external triggers with generic trigger name, independently of ADC */ |
mbed_official | 237:f3da66175598 | 1169 | /* target (caution: applies to other ADCs sharing the same common group), */ |
mbed_official | 237:f3da66175598 | 1170 | /* sorted by trigger name: */ |
mbed_official | 237:f3da66175598 | 1171 | |
mbed_official | 237:f3da66175598 | 1172 | /* External triggers of injected group for ADC1&ADC2 only */ |
mbed_official | 237:f3da66175598 | 1173 | #define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ADC1_2_EXTERNALTRIGINJEC_T2_CC1 |
mbed_official | 237:f3da66175598 | 1174 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC1 ADC1_2_EXTERNALTRIGINJEC_T3_CC1 |
mbed_official | 237:f3da66175598 | 1175 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC3 ADC1_2_EXTERNALTRIGINJEC_T3_CC3 |
mbed_official | 237:f3da66175598 | 1176 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ADC1_2_EXTERNALTRIGINJEC_T3_CC4 |
mbed_official | 237:f3da66175598 | 1177 | #define ADC_EXTERNALTRIGINJECCONV_T6_TRGO ADC1_2_EXTERNALTRIGINJEC_T6_TRGO |
mbed_official | 237:f3da66175598 | 1178 | #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC1_2_EXTERNALTRIGINJEC_EXT_IT15 |
mbed_official | 237:f3da66175598 | 1179 | |
mbed_official | 237:f3da66175598 | 1180 | /* External triggers of injected group for ADC3&ADC4 only */ |
mbed_official | 237:f3da66175598 | 1181 | #define ADC_EXTERNALTRIGINJECCONV_T1_CC3 ADC3_4_EXTERNALTRIGINJEC_T1_CC3 |
mbed_official | 237:f3da66175598 | 1182 | #define ADC_EXTERNALTRIGINJECCONV_T4_CC3 ADC3_4_EXTERNALTRIGINJEC_T4_CC3 |
mbed_official | 237:f3da66175598 | 1183 | #define ADC_EXTERNALTRIGINJECCONV_T4_CC4 ADC3_4_EXTERNALTRIGINJEC_T4_CC4 |
mbed_official | 237:f3da66175598 | 1184 | #define ADC_EXTERNALTRIGINJECCONV_T7_TRGO ADC3_4_EXTERNALTRIGINJEC_T7_TRGO |
mbed_official | 237:f3da66175598 | 1185 | #define ADC_EXTERNALTRIGINJECCONV_T8_CC2 ADC3_4_EXTERNALTRIGINJEC_T8_CC2 |
mbed_official | 237:f3da66175598 | 1186 | |
mbed_official | 237:f3da66175598 | 1187 | /* External triggers of injected group for ADC1&ADC2, ADC3&ADC4 */ |
mbed_official | 237:f3da66175598 | 1188 | /* Note: Triggers affected to group ADC1_2 by default, redirected to group */ |
mbed_official | 237:f3da66175598 | 1189 | /* ADC3_4 by driver when needed. */ |
mbed_official | 237:f3da66175598 | 1190 | #define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ADC1_2_EXTERNALTRIGINJEC_T1_CC4 |
mbed_official | 237:f3da66175598 | 1191 | #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ADC1_2_EXTERNALTRIGINJEC_T1_TRGO |
mbed_official | 237:f3da66175598 | 1192 | #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO2 ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2 |
mbed_official | 237:f3da66175598 | 1193 | #define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ADC1_2_EXTERNALTRIGINJEC_T2_TRGO |
mbed_official | 237:f3da66175598 | 1194 | #define ADC_EXTERNALTRIGINJECCONV_T3_TRGO ADC1_2_EXTERNALTRIGINJEC_T3_TRGO |
mbed_official | 237:f3da66175598 | 1195 | #define ADC_EXTERNALTRIGINJECCONV_T4_TRGO ADC1_2_EXTERNALTRIGINJEC_T4_TRGO |
mbed_official | 237:f3da66175598 | 1196 | #define ADC_EXTERNALTRIGINJECCONV_T8_CC4 ADC1_2_EXTERNALTRIGINJEC_T8_CC4 |
mbed_official | 237:f3da66175598 | 1197 | #define ADC_EXTERNALTRIGINJECCONV_T8_TRGO ADC1_2_EXTERNALTRIGINJEC_T8_TRGO |
mbed_official | 237:f3da66175598 | 1198 | #define ADC_EXTERNALTRIGINJECCONV_T8_TRGO2 ADC1_2_EXTERNALTRIGINJEC_T8_TRGO2 |
mbed_official | 237:f3da66175598 | 1199 | #define ADC_EXTERNALTRIGINJECCONV_T15_TRGO ADC1_2_EXTERNALTRIGINJEC_T15_TRGO |
mbed_official | 237:f3da66175598 | 1200 | |
mbed_official | 237:f3da66175598 | 1201 | #define ADC_INJECTED_SOFTWARE_START ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 1202 | |
mbed_official | 237:f3da66175598 | 1203 | #define IS_ADC_EXTTRIGINJEC(INJTRIG) (((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \ |
mbed_official | 237:f3da66175598 | 1204 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC1) || \ |
mbed_official | 237:f3da66175598 | 1205 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \ |
mbed_official | 237:f3da66175598 | 1206 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T6_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1207 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \ |
mbed_official | 237:f3da66175598 | 1208 | \ |
mbed_official | 237:f3da66175598 | 1209 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_CC3) || \ |
mbed_official | 237:f3da66175598 | 1210 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_CC4) || \ |
mbed_official | 237:f3da66175598 | 1211 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T7_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1212 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC2) || \ |
mbed_official | 237:f3da66175598 | 1213 | \ |
mbed_official | 237:f3da66175598 | 1214 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \ |
mbed_official | 237:f3da66175598 | 1215 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1216 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO2) || \ |
mbed_official | 237:f3da66175598 | 1217 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1218 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC3) || \ |
mbed_official | 237:f3da66175598 | 1219 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1220 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1221 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC4) || \ |
mbed_official | 237:f3da66175598 | 1222 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1223 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO2) || \ |
mbed_official | 237:f3da66175598 | 1224 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T15_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1225 | \ |
mbed_official | 237:f3da66175598 | 1226 | ((INJTRIG) == ADC_INJECTED_SOFTWARE_START) ) |
mbed_official | 237:f3da66175598 | 1227 | #endif /* STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 1228 | |
mbed_official | 237:f3da66175598 | 1229 | #if defined(STM32F302xC) |
mbed_official | 237:f3da66175598 | 1230 | /*!< List of external triggers with generic trigger name, independently of */ |
mbed_official | 237:f3da66175598 | 1231 | /* ADC target (caution: applies to other ADCs sharing the same common group), */ |
mbed_official | 237:f3da66175598 | 1232 | /* sorted by trigger name: */ |
mbed_official | 237:f3da66175598 | 1233 | |
mbed_official | 237:f3da66175598 | 1234 | /* External triggers of injected group for ADC1&ADC2 */ |
mbed_official | 237:f3da66175598 | 1235 | #define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ADC1_2_EXTERNALTRIGINJEC_T1_CC4 |
mbed_official | 237:f3da66175598 | 1236 | #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ADC1_2_EXTERNALTRIGINJEC_T1_TRGO |
mbed_official | 237:f3da66175598 | 1237 | #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO2 ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2 |
mbed_official | 237:f3da66175598 | 1238 | #define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ADC1_2_EXTERNALTRIGINJEC_T2_CC1 |
mbed_official | 237:f3da66175598 | 1239 | #define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ADC1_2_EXTERNALTRIGINJEC_T2_TRGO |
mbed_official | 237:f3da66175598 | 1240 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC1 ADC1_2_EXTERNALTRIGINJEC_T3_CC1 |
mbed_official | 237:f3da66175598 | 1241 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC3 ADC1_2_EXTERNALTRIGINJEC_T3_CC3 |
mbed_official | 237:f3da66175598 | 1242 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ADC1_2_EXTERNALTRIGINJEC_T3_CC4 |
mbed_official | 237:f3da66175598 | 1243 | #define ADC_EXTERNALTRIGINJECCONV_T3_TRGO ADC1_2_EXTERNALTRIGINJEC_T3_TRGO |
mbed_official | 237:f3da66175598 | 1244 | #define ADC_EXTERNALTRIGINJECCONV_T4_TRGO ADC1_2_EXTERNALTRIGINJEC_T4_TRGO |
mbed_official | 237:f3da66175598 | 1245 | #define ADC_EXTERNALTRIGINJECCONV_T6_TRGO ADC1_2_EXTERNALTRIGINJEC_T6_TRGO |
mbed_official | 237:f3da66175598 | 1246 | #define ADC_EXTERNALTRIGINJECCONV_T15_TRGO ADC1_2_EXTERNALTRIGINJEC_T15_TRGO |
mbed_official | 237:f3da66175598 | 1247 | #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC1_2_EXTERNALTRIGINJEC_EXT_IT15 |
mbed_official | 237:f3da66175598 | 1248 | |
mbed_official | 237:f3da66175598 | 1249 | #define ADC_INJECTED_SOFTWARE_START ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 1250 | |
mbed_official | 237:f3da66175598 | 1251 | #define IS_ADC_EXTTRIGINJEC(INJTRIG) (((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1252 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \ |
mbed_official | 237:f3da66175598 | 1253 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1254 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \ |
mbed_official | 237:f3da66175598 | 1255 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \ |
mbed_official | 237:f3da66175598 | 1256 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1257 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \ |
mbed_official | 237:f3da66175598 | 1258 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO2) || \ |
mbed_official | 237:f3da66175598 | 1259 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC3) || \ |
mbed_official | 237:f3da66175598 | 1260 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1261 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC1) || \ |
mbed_official | 237:f3da66175598 | 1262 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T6_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1263 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T15_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1264 | ((INJTRIG) == ADC_INJECTED_SOFTWARE_START) ) |
mbed_official | 237:f3da66175598 | 1265 | #endif /* STM32F302xC */ |
mbed_official | 237:f3da66175598 | 1266 | |
mbed_official | 237:f3da66175598 | 1267 | #if defined(STM32F303x8) || defined(STM32F328xx) |
mbed_official | 237:f3da66175598 | 1268 | /*!< List of external triggers with generic trigger name, independently of */ |
mbed_official | 237:f3da66175598 | 1269 | /* ADC target (caution: applies to other ADCs sharing the same common group), */ |
mbed_official | 237:f3da66175598 | 1270 | /* sorted by trigger name: */ |
mbed_official | 237:f3da66175598 | 1271 | |
mbed_official | 237:f3da66175598 | 1272 | /* External triggers of injected group for ADC1&ADC2 */ |
mbed_official | 237:f3da66175598 | 1273 | #define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ADC1_2_EXTERNALTRIGINJEC_T1_CC4 |
mbed_official | 237:f3da66175598 | 1274 | #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ADC1_2_EXTERNALTRIGINJEC_T1_TRGO |
mbed_official | 237:f3da66175598 | 1275 | #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO2 ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2 |
mbed_official | 237:f3da66175598 | 1276 | #define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ADC1_2_EXTERNALTRIGINJEC_T2_CC1 |
mbed_official | 237:f3da66175598 | 1277 | #define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ADC1_2_EXTERNALTRIGINJEC_T2_TRGO |
mbed_official | 237:f3da66175598 | 1278 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC1 ADC1_2_EXTERNALTRIGINJEC_T3_CC1 |
mbed_official | 237:f3da66175598 | 1279 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC3 ADC1_2_EXTERNALTRIGINJEC_T3_CC3 |
mbed_official | 237:f3da66175598 | 1280 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ADC1_2_EXTERNALTRIGINJEC_T3_CC4 |
mbed_official | 237:f3da66175598 | 1281 | #define ADC_EXTERNALTRIGINJECCONV_T3_TRGO ADC1_2_EXTERNALTRIGINJEC_T3_TRGO |
mbed_official | 237:f3da66175598 | 1282 | #define ADC_EXTERNALTRIGINJECCONV_T4_TRGO ADC1_2_EXTERNALTRIGINJEC_T4_TRGO |
mbed_official | 237:f3da66175598 | 1283 | #define ADC_EXTERNALTRIGINJECCONV_T6_TRGO ADC1_2_EXTERNALTRIGINJEC_T6_TRGO |
mbed_official | 237:f3da66175598 | 1284 | #define ADC_EXTERNALTRIGINJECCONV_T8_CC4 ADC1_2_EXTERNALTRIGINJEC_T8_CC4 |
mbed_official | 237:f3da66175598 | 1285 | #define ADC_EXTERNALTRIGINJECCONV_T8_TRGO ADC1_2_EXTERNALTRIGINJEC_T8_TRGO |
mbed_official | 237:f3da66175598 | 1286 | #define ADC_EXTERNALTRIGINJECCONV_T8_TRGO2 ADC1_2_EXTERNALTRIGINJEC_T8_TRGO2 |
mbed_official | 237:f3da66175598 | 1287 | #define ADC_EXTERNALTRIGINJECCONV_T15_TRGO ADC1_2_EXTERNALTRIGINJEC_T15_TRGO |
mbed_official | 237:f3da66175598 | 1288 | #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC1_2_EXTERNALTRIGINJEC_EXT_IT15 |
mbed_official | 237:f3da66175598 | 1289 | |
mbed_official | 237:f3da66175598 | 1290 | #define ADC_INJECTED_SOFTWARE_START ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 1291 | |
mbed_official | 237:f3da66175598 | 1292 | #define IS_ADC_EXTTRIGINJEC(INJTRIG) (((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1293 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \ |
mbed_official | 237:f3da66175598 | 1294 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1295 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \ |
mbed_official | 237:f3da66175598 | 1296 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \ |
mbed_official | 237:f3da66175598 | 1297 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1298 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \ |
mbed_official | 237:f3da66175598 | 1299 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC4) || \ |
mbed_official | 237:f3da66175598 | 1300 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO2) || \ |
mbed_official | 237:f3da66175598 | 1301 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1302 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO2) || \ |
mbed_official | 237:f3da66175598 | 1303 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC3) || \ |
mbed_official | 237:f3da66175598 | 1304 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1305 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC1) || \ |
mbed_official | 237:f3da66175598 | 1306 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T6_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1307 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T15_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1308 | ((INJTRIG) == ADC_INJECTED_SOFTWARE_START) ) |
mbed_official | 237:f3da66175598 | 1309 | #endif /* STM32F303x8 || STM32F328xx */ |
mbed_official | 237:f3da66175598 | 1310 | |
mbed_official | 237:f3da66175598 | 1311 | #if defined(STM32F334x8) |
mbed_official | 237:f3da66175598 | 1312 | /*!< List of external triggers with generic trigger name, independently of */ |
mbed_official | 237:f3da66175598 | 1313 | /* ADC target (caution: applies to other ADCs sharing the same common group), */ |
mbed_official | 237:f3da66175598 | 1314 | /* sorted by trigger name: */ |
mbed_official | 237:f3da66175598 | 1315 | |
mbed_official | 237:f3da66175598 | 1316 | /* External triggers of injected group for ADC1&ADC2 */ |
mbed_official | 237:f3da66175598 | 1317 | #define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ADC1_2_EXTERNALTRIGINJEC_T1_CC4 |
mbed_official | 237:f3da66175598 | 1318 | #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ADC1_2_EXTERNALTRIGINJEC_T1_TRGO |
mbed_official | 237:f3da66175598 | 1319 | #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO2 ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2 |
mbed_official | 237:f3da66175598 | 1320 | #define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ADC1_2_EXTERNALTRIGINJEC_T2_CC1 |
mbed_official | 237:f3da66175598 | 1321 | #define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ADC1_2_EXTERNALTRIGINJEC_T2_TRGO |
mbed_official | 237:f3da66175598 | 1322 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC1 ADC1_2_EXTERNALTRIGINJEC_T3_CC1 |
mbed_official | 237:f3da66175598 | 1323 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC3 ADC1_2_EXTERNALTRIGINJEC_T3_CC3 |
mbed_official | 237:f3da66175598 | 1324 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ADC1_2_EXTERNALTRIGINJEC_T3_CC4 |
mbed_official | 237:f3da66175598 | 1325 | #define ADC_EXTERNALTRIGINJECCONV_T3_TRGO ADC1_2_EXTERNALTRIGINJEC_T3_TRGO |
mbed_official | 237:f3da66175598 | 1326 | #define ADC_EXTERNALTRIGINJECCONV_T6_TRGO ADC1_2_EXTERNALTRIGINJEC_T6_TRGO |
mbed_official | 237:f3da66175598 | 1327 | #define ADC_EXTERNALTRIGINJECCONV_T15_TRGO ADC1_2_EXTERNALTRIGINJEC_T15_TRGO |
mbed_official | 237:f3da66175598 | 1328 | #define ADC_EXTERNALTRIGINJECCONV_HRTIM_TRG2 ADC1_2_EXTERNALTRIGINJEC_HRTIM_TRG2 |
mbed_official | 237:f3da66175598 | 1329 | #define ADC_EXTERNALTRIGINJECCONV_HRTIM_TRG4 ADC1_2_EXTERNALTRIGINJEC_HRTIM_TRG4 |
mbed_official | 237:f3da66175598 | 1330 | #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC1_2_EXTERNALTRIGINJEC_EXT_IT15 |
mbed_official | 237:f3da66175598 | 1331 | |
mbed_official | 237:f3da66175598 | 1332 | #define ADC_INJECTED_SOFTWARE_START ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 1333 | |
mbed_official | 237:f3da66175598 | 1334 | #define IS_ADC_EXTTRIGINJEC(INJTRIG) (((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1335 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \ |
mbed_official | 237:f3da66175598 | 1336 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1337 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \ |
mbed_official | 237:f3da66175598 | 1338 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \ |
mbed_official | 237:f3da66175598 | 1339 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \ |
mbed_official | 237:f3da66175598 | 1340 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO2) || \ |
mbed_official | 237:f3da66175598 | 1341 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_HRTIM_TRG2) || \ |
mbed_official | 237:f3da66175598 | 1342 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_HRTIM_TRG4) || \ |
mbed_official | 237:f3da66175598 | 1343 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC3) || \ |
mbed_official | 237:f3da66175598 | 1344 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1345 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC1) || \ |
mbed_official | 237:f3da66175598 | 1346 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T6_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1347 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T15_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1348 | ((INJTRIG) == ADC_INJECTED_SOFTWARE_START) ) |
mbed_official | 237:f3da66175598 | 1349 | #endif /* STM32F334x8 */ |
mbed_official | 237:f3da66175598 | 1350 | |
mbed_official | 237:f3da66175598 | 1351 | #if defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 1352 | /* List of external triggers with generic trigger name, sorted by trigger */ |
mbed_official | 237:f3da66175598 | 1353 | /* name: */ |
mbed_official | 237:f3da66175598 | 1354 | |
mbed_official | 237:f3da66175598 | 1355 | /* External triggers of injected group for ADC1 */ |
mbed_official | 237:f3da66175598 | 1356 | #define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ADC1_EXTERNALTRIGINJEC_T1_CC4 |
mbed_official | 237:f3da66175598 | 1357 | #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ADC1_EXTERNALTRIGINJEC_T1_TRGO |
mbed_official | 237:f3da66175598 | 1358 | #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO2 ADC1_EXTERNALTRIGINJEC_T1_TRGO2 |
mbed_official | 237:f3da66175598 | 1359 | #define ADC_EXTERNALTRIGINJECCONV_T6_TRGO ADC1_EXTERNALTRIGINJEC_T6_TRGO |
mbed_official | 237:f3da66175598 | 1360 | #define ADC_EXTERNALTRIGINJECCONV_T15_TRGO ADC1_EXTERNALTRIGINJEC_T15_TRGO |
mbed_official | 237:f3da66175598 | 1361 | #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC1_EXTERNALTRIGINJEC_EXT_IT15 |
mbed_official | 237:f3da66175598 | 1362 | |
mbed_official | 237:f3da66175598 | 1363 | #define ADC_INJECTED_SOFTWARE_START ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 1364 | |
mbed_official | 237:f3da66175598 | 1365 | #define IS_ADC_EXTTRIGINJEC(INJTRIG) (((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1366 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \ |
mbed_official | 237:f3da66175598 | 1367 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \ |
mbed_official | 237:f3da66175598 | 1368 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO2) || \ |
mbed_official | 237:f3da66175598 | 1369 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T6_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1370 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T15_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1371 | ((INJTRIG) == ADC_INJECTED_SOFTWARE_START) ) |
mbed_official | 237:f3da66175598 | 1372 | #endif /* STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 1373 | /** |
mbed_official | 237:f3da66175598 | 1374 | * @} |
mbed_official | 237:f3da66175598 | 1375 | */ |
mbed_official | 237:f3da66175598 | 1376 | |
mbed_official | 237:f3da66175598 | 1377 | /** @defgroup ADCEx_Internal_HAL_driver_Ext_trig_src_Injected |
mbed_official | 237:f3da66175598 | 1378 | * @{ |
mbed_official | 237:f3da66175598 | 1379 | */ |
mbed_official | 237:f3da66175598 | 1380 | #if defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 1381 | /* List of external triggers sorted of groups ADC1&ADC2 and/or ADC3&ADC4: */ |
mbed_official | 237:f3da66175598 | 1382 | /* (used internally by HAL driver. To not use into HAL structure parameters) */ |
mbed_official | 237:f3da66175598 | 1383 | |
mbed_official | 237:f3da66175598 | 1384 | /* External triggers for injected groups of ADC1 & ADC2 */ |
mbed_official | 237:f3da66175598 | 1385 | #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 1386 | #define ADC1_2_EXTERNALTRIGINJEC_T1_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_0) |
mbed_official | 237:f3da66175598 | 1387 | #define ADC1_2_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t)ADC_JSQR_JEXTSEL_1) |
mbed_official | 237:f3da66175598 | 1388 | #define ADC1_2_EXTERNALTRIGINJEC_T2_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1389 | #define ADC1_2_EXTERNALTRIGINJEC_T3_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_2) |
mbed_official | 237:f3da66175598 | 1390 | #define ADC1_2_EXTERNALTRIGINJEC_T4_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1391 | #define ADC1_2_EXTERNALTRIGINJEC_EXT_IT15 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1392 | #define ADC1_2_EXTERNALTRIGINJEC_T8_CC4 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1393 | #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2 ((uint32_t)ADC_JSQR_JEXTSEL_3) |
mbed_official | 237:f3da66175598 | 1394 | #define ADC1_2_EXTERNALTRIGINJEC_T8_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1395 | #define ADC1_2_EXTERNALTRIGINJEC_T8_TRGO2 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1396 | #define ADC1_2_EXTERNALTRIGINJEC_T3_CC3 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1397 | #define ADC1_2_EXTERNALTRIGINJEC_T3_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2)) |
mbed_official | 237:f3da66175598 | 1398 | #define ADC1_2_EXTERNALTRIGINJEC_T3_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1399 | #define ADC1_2_EXTERNALTRIGINJEC_T6_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1400 | #define ADC1_2_EXTERNALTRIGINJEC_T15_TRGO ((uint32_t)ADC_JSQR_JEXTSEL) |
mbed_official | 237:f3da66175598 | 1401 | |
mbed_official | 237:f3da66175598 | 1402 | /* External triggers for injected groups of ADC3 & ADC4 */ |
mbed_official | 237:f3da66175598 | 1403 | /* Note: External triggers JEXT2 and JEXT5 are the same (TIM4_CC3 event). */ |
mbed_official | 237:f3da66175598 | 1404 | /* JEXT2 is the main trigger, JEXT5 could be redirected to another */ |
mbed_official | 237:f3da66175598 | 1405 | /* in future devices. */ |
mbed_official | 237:f3da66175598 | 1406 | /* However, this channel is implemented with a SW offset of 0x10000 for */ |
mbed_official | 237:f3da66175598 | 1407 | /* differentiation between similar triggers of common groups ADC1&ADC2, */ |
mbed_official | 237:f3da66175598 | 1408 | /* ADC3&ADC4 (Differentiation processed into macro */ |
mbed_official | 237:f3da66175598 | 1409 | /* __HAL_ADC_JSQR_JEXTSEL) */ |
mbed_official | 237:f3da66175598 | 1410 | #define ADC3_4_EXTERNALTRIGINJEC_T1_TRGO ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 1411 | #define ADC3_4_EXTERNALTRIGINJEC_T1_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_0) |
mbed_official | 237:f3da66175598 | 1412 | #define ADC3_4_EXTERNALTRIGINJEC_T4_CC3 ((uint32_t)ADC_JSQR_JEXTSEL_1 | 0x10000) |
mbed_official | 237:f3da66175598 | 1413 | #define ADC3_4_EXTERNALTRIGINJEC_T8_CC2 ((uint32_t)(ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1414 | #define ADC3_4_EXTERNALTRIGINJEC_T8_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_2) |
mbed_official | 237:f3da66175598 | 1415 | #define ADC3_4_EXTERNALTRIGINJEC_T4_CC4 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1416 | #define ADC3_4_EXTERNALTRIGINJEC_T4_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1417 | #define ADC3_4_EXTERNALTRIGINJEC_T1_TRGO2 ((uint32_t)ADC_JSQR_JEXTSEL_3) |
mbed_official | 237:f3da66175598 | 1418 | #define ADC3_4_EXTERNALTRIGINJEC_T8_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1419 | #define ADC3_4_EXTERNALTRIGINJEC_T8_TRGO2 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1420 | #define ADC3_4_EXTERNALTRIGINJEC_T1_CC3 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1421 | #define ADC3_4_EXTERNALTRIGINJEC_T3_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2)) |
mbed_official | 237:f3da66175598 | 1422 | #define ADC3_4_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1423 | #define ADC3_4_EXTERNALTRIGINJEC_T7_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1424 | #define ADC3_4_EXTERNALTRIGINJEC_T15_TRGO ((uint32_t)ADC_JSQR_JEXTSEL) |
mbed_official | 237:f3da66175598 | 1425 | #endif /* STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 1426 | |
mbed_official | 237:f3da66175598 | 1427 | #if defined(STM32F302xC) |
mbed_official | 237:f3da66175598 | 1428 | /* List of external triggers of group ADC1&ADC2: */ |
mbed_official | 237:f3da66175598 | 1429 | /* (used internally by HAL driver. To not use into HAL structure parameters) */ |
mbed_official | 237:f3da66175598 | 1430 | #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 1431 | #define ADC1_2_EXTERNALTRIGINJEC_T1_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_0) |
mbed_official | 237:f3da66175598 | 1432 | #define ADC1_2_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t)ADC_JSQR_JEXTSEL_1) |
mbed_official | 237:f3da66175598 | 1433 | #define ADC1_2_EXTERNALTRIGINJEC_T2_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1434 | #define ADC1_2_EXTERNALTRIGINJEC_T3_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_2) |
mbed_official | 237:f3da66175598 | 1435 | #define ADC1_2_EXTERNALTRIGINJEC_T4_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1436 | #define ADC1_2_EXTERNALTRIGINJEC_EXT_IT15 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1437 | #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2 ((uint32_t)ADC_JSQR_JEXTSEL_3) |
mbed_official | 237:f3da66175598 | 1438 | #define ADC1_2_EXTERNALTRIGINJEC_T3_CC3 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1439 | #define ADC1_2_EXTERNALTRIGINJEC_T3_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2)) |
mbed_official | 237:f3da66175598 | 1440 | #define ADC1_2_EXTERNALTRIGINJEC_T3_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1441 | #define ADC1_2_EXTERNALTRIGINJEC_T6_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1442 | #define ADC1_2_EXTERNALTRIGINJEC_T15_TRGO ((uint32_t)ADC_JSQR_JEXTSEL) |
mbed_official | 237:f3da66175598 | 1443 | #endif /* STM32F302xC */ |
mbed_official | 237:f3da66175598 | 1444 | |
mbed_official | 237:f3da66175598 | 1445 | #if defined(STM32F303x8) || defined(STM32F328xx) |
mbed_official | 237:f3da66175598 | 1446 | /* List of external triggers of group ADC1&ADC2: */ |
mbed_official | 237:f3da66175598 | 1447 | /* (used internally by HAL driver. To not use into HAL structure parameters) */ |
mbed_official | 237:f3da66175598 | 1448 | #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 1449 | #define ADC1_2_EXTERNALTRIGINJEC_T1_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_0) |
mbed_official | 237:f3da66175598 | 1450 | #define ADC1_2_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t)ADC_JSQR_JEXTSEL_1) |
mbed_official | 237:f3da66175598 | 1451 | #define ADC1_2_EXTERNALTRIGINJEC_T2_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1452 | #define ADC1_2_EXTERNALTRIGINJEC_T3_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_2) |
mbed_official | 237:f3da66175598 | 1453 | #define ADC1_2_EXTERNALTRIGINJEC_T4_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1454 | #define ADC1_2_EXTERNALTRIGINJEC_EXT_IT15 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1455 | #define ADC1_2_EXTERNALTRIGINJEC_T8_CC4 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1456 | #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2 ((uint32_t)ADC_JSQR_JEXTSEL_3) |
mbed_official | 237:f3da66175598 | 1457 | #define ADC1_2_EXTERNALTRIGINJEC_T8_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1458 | #define ADC1_2_EXTERNALTRIGINJEC_T8_TRGO2 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1459 | #define ADC1_2_EXTERNALTRIGINJEC_T3_CC3 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1460 | #define ADC1_2_EXTERNALTRIGINJEC_T3_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2)) |
mbed_official | 237:f3da66175598 | 1461 | #define ADC1_2_EXTERNALTRIGINJEC_T3_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1462 | #define ADC1_2_EXTERNALTRIGINJEC_T6_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1463 | #define ADC1_2_EXTERNALTRIGINJEC_T15_TRGO ((uint32_t)ADC_JSQR_JEXTSEL) |
mbed_official | 237:f3da66175598 | 1464 | #endif /* STM32F303x8 || STM32F328xx */ |
mbed_official | 237:f3da66175598 | 1465 | |
mbed_official | 237:f3da66175598 | 1466 | #if defined(STM32F334x8) |
mbed_official | 237:f3da66175598 | 1467 | /* List of external triggers of group ADC1&ADC2: */ |
mbed_official | 237:f3da66175598 | 1468 | /* (used internally by HAL driver. To not use into HAL structure parameters) */ |
mbed_official | 237:f3da66175598 | 1469 | #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 1470 | #define ADC1_2_EXTERNALTRIGINJEC_T1_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_0) |
mbed_official | 237:f3da66175598 | 1471 | #define ADC1_2_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t)ADC_JSQR_JEXTSEL_1) |
mbed_official | 237:f3da66175598 | 1472 | #define ADC1_2_EXTERNALTRIGINJEC_T2_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1473 | #define ADC1_2_EXTERNALTRIGINJEC_T3_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_2) |
mbed_official | 237:f3da66175598 | 1474 | #define ADC1_2_EXTERNALTRIGINJEC_EXT_IT15 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1475 | #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2 ((uint32_t)ADC_JSQR_JEXTSEL_3) |
mbed_official | 237:f3da66175598 | 1476 | #define ADC1_2_EXTERNALTRIGINJEC_HRTIM_TRG2 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1477 | #define ADC1_2_EXTERNALTRIGINJEC_HRTIM_TRG4 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1478 | #define ADC1_2_EXTERNALTRIGINJEC_T3_CC3 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1479 | #define ADC1_2_EXTERNALTRIGINJEC_T3_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2)) |
mbed_official | 237:f3da66175598 | 1480 | #define ADC1_2_EXTERNALTRIGINJEC_T3_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1481 | #define ADC1_2_EXTERNALTRIGINJEC_T6_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1482 | #define ADC1_2_EXTERNALTRIGINJEC_T15_TRGO ((uint32_t)ADC_JSQR_JEXTSEL) |
mbed_official | 237:f3da66175598 | 1483 | #endif /* STM32F334x8 */ |
mbed_official | 237:f3da66175598 | 1484 | |
mbed_official | 237:f3da66175598 | 1485 | #if defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 1486 | /* List of external triggers of injected group for ADC1: */ |
mbed_official | 237:f3da66175598 | 1487 | /* (used internally by HAL driver. To not use into HAL structure parameters) */ |
mbed_official | 237:f3da66175598 | 1488 | #define ADC1_EXTERNALTRIGINJEC_T1_TRGO ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 1489 | #define ADC1_EXTERNALTRIGINJEC_T1_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_0) |
mbed_official | 237:f3da66175598 | 1490 | #define ADC1_EXTERNALTRIGINJEC_EXT_IT15 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1491 | #define ADC1_EXTERNALTRIGINJEC_T1_TRGO2 ((uint32_t)ADC_JSQR_JEXTSEL_3) |
mbed_official | 237:f3da66175598 | 1492 | #define ADC1_EXTERNALTRIGINJEC_T6_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1493 | #define ADC1_EXTERNALTRIGINJEC_T15_TRGO ((uint32_t)ADC_JSQR_JEXTSEL) |
mbed_official | 237:f3da66175598 | 1494 | #endif /* STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 1495 | /** |
mbed_official | 237:f3da66175598 | 1496 | * @} |
mbed_official | 237:f3da66175598 | 1497 | */ |
mbed_official | 237:f3da66175598 | 1498 | |
mbed_official | 237:f3da66175598 | 1499 | /** @defgroup ADCEx_Common_mode |
mbed_official | 237:f3da66175598 | 1500 | * @{ |
mbed_official | 237:f3da66175598 | 1501 | */ |
mbed_official | 237:f3da66175598 | 1502 | #define ADC_MODE_INDEPENDENT ((uint32_t)(0x00000000)) |
mbed_official | 237:f3da66175598 | 1503 | #define ADC_DUALMODE_REGSIMULT_INJECSIMULT ((uint32_t)(ADC12_CCR_MULTI_0)) |
mbed_official | 237:f3da66175598 | 1504 | #define ADC_DUALMODE_REGSIMULT_ALTERTRIG ((uint32_t)(ADC12_CCR_MULTI_1)) |
mbed_official | 237:f3da66175598 | 1505 | #define ADC_DUALMODE_INJECSIMULT ((uint32_t)(ADC12_CCR_MULTI_2 | ADC12_CCR_MULTI_0)) |
mbed_official | 237:f3da66175598 | 1506 | #define ADC_DUALMODE_REGSIMULT ((uint32_t)(ADC12_CCR_MULTI_2 | ADC12_CCR_MULTI_1)) |
mbed_official | 237:f3da66175598 | 1507 | #define ADC_DUALMODE_INTERL ((uint32_t)(ADC12_CCR_MULTI_2 | ADC12_CCR_MULTI_1 | ADC12_CCR_MULTI_0)) |
mbed_official | 237:f3da66175598 | 1508 | #define ADC_DUALMODE_ALTERTRIG ((uint32_t)(ADC12_CCR_MULTI_3 | ADC12_CCR_MULTI_0)) |
mbed_official | 237:f3da66175598 | 1509 | |
mbed_official | 237:f3da66175598 | 1510 | #define IS_ADC_MODE(MODE) (((MODE) == ADC_MODE_INDEPENDENT) || \ |
mbed_official | 237:f3da66175598 | 1511 | ((MODE) == ADC_DUALMODE_REGSIMULT_INJECSIMULT) || \ |
mbed_official | 237:f3da66175598 | 1512 | ((MODE) == ADC_DUALMODE_REGSIMULT_ALTERTRIG) || \ |
mbed_official | 237:f3da66175598 | 1513 | ((MODE) == ADC_DUALMODE_INJECSIMULT) || \ |
mbed_official | 237:f3da66175598 | 1514 | ((MODE) == ADC_DUALMODE_REGSIMULT) || \ |
mbed_official | 237:f3da66175598 | 1515 | ((MODE) == ADC_DUALMODE_INTERL) || \ |
mbed_official | 237:f3da66175598 | 1516 | ((MODE) == ADC_DUALMODE_ALTERTRIG) ) |
mbed_official | 237:f3da66175598 | 1517 | /** |
mbed_official | 237:f3da66175598 | 1518 | * @} |
mbed_official | 237:f3da66175598 | 1519 | */ |
mbed_official | 237:f3da66175598 | 1520 | |
mbed_official | 237:f3da66175598 | 1521 | |
mbed_official | 237:f3da66175598 | 1522 | /** @defgroup ADCEx_Direct_memory_access_mode_for_multimode |
mbed_official | 237:f3da66175598 | 1523 | * @{ |
mbed_official | 237:f3da66175598 | 1524 | */ |
mbed_official | 237:f3da66175598 | 1525 | #define ADC_DMAACCESSMODE_DISABLED ((uint32_t)0x00000000) /*!< DMA multimode disabled: each ADC will use its own DMA channel */ |
mbed_official | 237:f3da66175598 | 1526 | #define ADC_DMAACCESSMODE_12_10_BITS ((uint32_t)ADC12_CCR_MDMA_1) /*!< DMA multimode enabled (one DMA channel for both ADC, DMA of ADC master) for 12 and 10 bits resolution */ |
mbed_official | 237:f3da66175598 | 1527 | #define ADC_DMAACCESSMODE_8_6_BITS ((uint32_t)ADC12_CCR_MDMA) /*!< DMA multimode enabled (one DMA channel for both ADC, DMA of ADC master) for 8 and 6 bits resolution */ |
mbed_official | 237:f3da66175598 | 1528 | |
mbed_official | 237:f3da66175598 | 1529 | #define IS_ADC_DMA_ACCESS_MODE(MODE) (((MODE) == ADC_DMAACCESSMODE_DISABLED) || \ |
mbed_official | 237:f3da66175598 | 1530 | ((MODE) == ADC_DMAACCESSMODE_12_10_BITS) || \ |
mbed_official | 237:f3da66175598 | 1531 | ((MODE) == ADC_DMAACCESSMODE_8_6_BITS) ) |
mbed_official | 237:f3da66175598 | 1532 | /** |
mbed_official | 237:f3da66175598 | 1533 | * @} |
mbed_official | 237:f3da66175598 | 1534 | */ |
mbed_official | 237:f3da66175598 | 1535 | |
mbed_official | 237:f3da66175598 | 1536 | /** @defgroup ADCEx_delay_between_2_sampling_phases |
mbed_official | 237:f3da66175598 | 1537 | * @{ |
mbed_official | 237:f3da66175598 | 1538 | */ |
mbed_official | 237:f3da66175598 | 1539 | #define ADC_TWOSAMPLINGDELAY_1CYCLE ((uint32_t)(0x00000000)) |
mbed_official | 237:f3da66175598 | 1540 | #define ADC_TWOSAMPLINGDELAY_2CYCLES ((uint32_t)(ADC12_CCR_DELAY_0)) |
mbed_official | 237:f3da66175598 | 1541 | #define ADC_TWOSAMPLINGDELAY_3CYCLES ((uint32_t)(ADC12_CCR_DELAY_1)) |
mbed_official | 237:f3da66175598 | 1542 | #define ADC_TWOSAMPLINGDELAY_4CYCLES ((uint32_t)(ADC12_CCR_DELAY_1 | ADC12_CCR_DELAY_0)) |
mbed_official | 237:f3da66175598 | 1543 | #define ADC_TWOSAMPLINGDELAY_5CYCLES ((uint32_t)(ADC12_CCR_DELAY_2)) |
mbed_official | 237:f3da66175598 | 1544 | #define ADC_TWOSAMPLINGDELAY_6CYCLES ((uint32_t)(ADC12_CCR_DELAY_2 | ADC12_CCR_DELAY_0)) |
mbed_official | 237:f3da66175598 | 1545 | #define ADC_TWOSAMPLINGDELAY_7CYCLES ((uint32_t)(ADC12_CCR_DELAY_2 | ADC12_CCR_DELAY_1)) |
mbed_official | 237:f3da66175598 | 1546 | #define ADC_TWOSAMPLINGDELAY_8CYCLES ((uint32_t)(ADC12_CCR_DELAY_2 | ADC12_CCR_DELAY_1 | ADC12_CCR_DELAY_0)) |
mbed_official | 237:f3da66175598 | 1547 | #define ADC_TWOSAMPLINGDELAY_9CYCLES ((uint32_t)(ADC12_CCR_DELAY_3)) |
mbed_official | 237:f3da66175598 | 1548 | #define ADC_TWOSAMPLINGDELAY_10CYCLES ((uint32_t)(ADC12_CCR_DELAY_3 | ADC12_CCR_DELAY_0)) |
mbed_official | 237:f3da66175598 | 1549 | #define ADC_TWOSAMPLINGDELAY_11CYCLES ((uint32_t)(ADC12_CCR_DELAY_3 | ADC12_CCR_DELAY_1)) |
mbed_official | 237:f3da66175598 | 1550 | #define ADC_TWOSAMPLINGDELAY_12CYCLES ((uint32_t)(ADC12_CCR_DELAY_3 | ADC12_CCR_DELAY_1 | ADC12_CCR_DELAY_0)) |
mbed_official | 237:f3da66175598 | 1551 | |
mbed_official | 237:f3da66175598 | 1552 | #define IS_ADC_SAMPLING_DELAY(DELAY) (((DELAY) == ADC_TWOSAMPLINGDELAY_1CYCLE) || \ |
mbed_official | 237:f3da66175598 | 1553 | ((DELAY) == ADC_TWOSAMPLINGDELAY_2CYCLES) || \ |
mbed_official | 237:f3da66175598 | 1554 | ((DELAY) == ADC_TWOSAMPLINGDELAY_3CYCLES) || \ |
mbed_official | 237:f3da66175598 | 1555 | ((DELAY) == ADC_TWOSAMPLINGDELAY_4CYCLES) || \ |
mbed_official | 237:f3da66175598 | 1556 | ((DELAY) == ADC_TWOSAMPLINGDELAY_5CYCLES) || \ |
mbed_official | 237:f3da66175598 | 1557 | ((DELAY) == ADC_TWOSAMPLINGDELAY_6CYCLES) || \ |
mbed_official | 237:f3da66175598 | 1558 | ((DELAY) == ADC_TWOSAMPLINGDELAY_7CYCLES) || \ |
mbed_official | 237:f3da66175598 | 1559 | ((DELAY) == ADC_TWOSAMPLINGDELAY_8CYCLES) || \ |
mbed_official | 237:f3da66175598 | 1560 | ((DELAY) == ADC_TWOSAMPLINGDELAY_9CYCLES) || \ |
mbed_official | 237:f3da66175598 | 1561 | ((DELAY) == ADC_TWOSAMPLINGDELAY_10CYCLES) || \ |
mbed_official | 237:f3da66175598 | 1562 | ((DELAY) == ADC_TWOSAMPLINGDELAY_11CYCLES) || \ |
mbed_official | 237:f3da66175598 | 1563 | ((DELAY) == ADC_TWOSAMPLINGDELAY_12CYCLES) ) |
mbed_official | 237:f3da66175598 | 1564 | /** |
mbed_official | 237:f3da66175598 | 1565 | * @} |
mbed_official | 237:f3da66175598 | 1566 | */ |
mbed_official | 237:f3da66175598 | 1567 | |
mbed_official | 237:f3da66175598 | 1568 | /** @defgroup ADCEx_analog_watchdog_number |
mbed_official | 237:f3da66175598 | 1569 | * @{ |
mbed_official | 237:f3da66175598 | 1570 | */ |
mbed_official | 237:f3da66175598 | 1571 | #define ADC_ANALOGWATCHDOG_1 ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 1572 | #define ADC_ANALOGWATCHDOG_2 ((uint32_t)0x00000002) |
mbed_official | 237:f3da66175598 | 1573 | #define ADC_ANALOGWATCHDOG_3 ((uint32_t)0x00000003) |
mbed_official | 237:f3da66175598 | 1574 | |
mbed_official | 237:f3da66175598 | 1575 | #define IS_ADC_ANALOG_WATCHDOG_NUMBER(WATCHDOG) (((WATCHDOG) == ADC_ANALOGWATCHDOG_1) || \ |
mbed_official | 237:f3da66175598 | 1576 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_2) || \ |
mbed_official | 237:f3da66175598 | 1577 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_3) ) |
mbed_official | 237:f3da66175598 | 1578 | /** |
mbed_official | 237:f3da66175598 | 1579 | * @} |
mbed_official | 237:f3da66175598 | 1580 | */ |
mbed_official | 237:f3da66175598 | 1581 | |
mbed_official | 237:f3da66175598 | 1582 | /** @defgroup ADCEx_analog_watchdog_mode |
mbed_official | 237:f3da66175598 | 1583 | * @{ |
mbed_official | 237:f3da66175598 | 1584 | */ |
mbed_official | 237:f3da66175598 | 1585 | #define ADC_ANALOGWATCHDOG_NONE ((uint32_t) 0x00000000) |
mbed_official | 237:f3da66175598 | 1586 | #define ADC_ANALOGWATCHDOG_SINGLE_REG ((uint32_t)(ADC_CFGR_AWD1SGL | ADC_CFGR_AWD1EN)) |
mbed_official | 237:f3da66175598 | 1587 | #define ADC_ANALOGWATCHDOG_SINGLE_INJEC ((uint32_t)(ADC_CFGR_AWD1SGL | ADC_CFGR_JAWD1EN)) |
mbed_official | 237:f3da66175598 | 1588 | #define ADC_ANALOGWATCHDOG_SINGLE_REGINJEC ((uint32_t)(ADC_CFGR_AWD1SGL | ADC_CFGR_AWD1EN | ADC_CFGR_JAWD1EN)) |
mbed_official | 237:f3da66175598 | 1589 | #define ADC_ANALOGWATCHDOG_ALL_REG ((uint32_t) ADC_CFGR_AWD1EN) |
mbed_official | 237:f3da66175598 | 1590 | #define ADC_ANALOGWATCHDOG_ALL_INJEC ((uint32_t) ADC_CFGR_JAWD1EN) |
mbed_official | 237:f3da66175598 | 1591 | #define ADC_ANALOGWATCHDOG_ALL_REGINJEC ((uint32_t)(ADC_CFGR_AWD1EN | ADC_CFGR_JAWD1EN)) |
mbed_official | 237:f3da66175598 | 1592 | |
mbed_official | 237:f3da66175598 | 1593 | #define IS_ADC_ANALOG_WATCHDOG_MODE(WATCHDOG) (((WATCHDOG) == ADC_ANALOGWATCHDOG_NONE) || \ |
mbed_official | 237:f3da66175598 | 1594 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REG) || \ |
mbed_official | 237:f3da66175598 | 1595 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_INJEC) || \ |
mbed_official | 237:f3da66175598 | 1596 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REGINJEC) || \ |
mbed_official | 237:f3da66175598 | 1597 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REG) || \ |
mbed_official | 237:f3da66175598 | 1598 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_INJEC) || \ |
mbed_official | 237:f3da66175598 | 1599 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REGINJEC) ) |
mbed_official | 237:f3da66175598 | 1600 | /** |
mbed_official | 237:f3da66175598 | 1601 | * @} |
mbed_official | 237:f3da66175598 | 1602 | */ |
mbed_official | 237:f3da66175598 | 1603 | |
mbed_official | 237:f3da66175598 | 1604 | /** @defgroup ADC_conversion_type |
mbed_official | 237:f3da66175598 | 1605 | * @{ |
mbed_official | 237:f3da66175598 | 1606 | */ |
mbed_official | 237:f3da66175598 | 1607 | #define REGULAR_GROUP ((uint32_t)(ADC_FLAG_EOC | ADC_FLAG_EOS)) |
mbed_official | 237:f3da66175598 | 1608 | #define INJECTED_GROUP ((uint32_t)(ADC_FLAG_JEOC | ADC_FLAG_JEOS)) |
mbed_official | 237:f3da66175598 | 1609 | #define REGULAR_INJECTED_GROUP ((uint32_t)(ADC_FLAG_EOC | ADC_FLAG_EOS | ADC_FLAG_JEOC | ADC_FLAG_JEOS)) |
mbed_official | 237:f3da66175598 | 1610 | |
mbed_official | 237:f3da66175598 | 1611 | #define IS_ADC_CONVERSION_GROUP(CONVERSION) (((CONVERSION) == REGULAR_GROUP) || \ |
mbed_official | 237:f3da66175598 | 1612 | ((CONVERSION) == INJECTED_GROUP) || \ |
mbed_official | 237:f3da66175598 | 1613 | ((CONVERSION) == REGULAR_INJECTED_GROUP) ) |
mbed_official | 237:f3da66175598 | 1614 | /** |
mbed_official | 237:f3da66175598 | 1615 | * @} |
mbed_official | 237:f3da66175598 | 1616 | */ |
mbed_official | 237:f3da66175598 | 1617 | |
mbed_official | 237:f3da66175598 | 1618 | /** @defgroup ADCEx_Event_type |
mbed_official | 237:f3da66175598 | 1619 | * @{ |
mbed_official | 237:f3da66175598 | 1620 | */ |
mbed_official | 237:f3da66175598 | 1621 | #define AWD1_EVENT ((uint32_t)ADC_FLAG_AWD1) /*!< ADC Analog watchdog 1 event (main analog watchdog, present on all STM32 devices) */ |
mbed_official | 237:f3da66175598 | 1622 | #define AWD2_EVENT ((uint32_t)ADC_FLAG_AWD2) /*!< ADC Analog watchdog 2 event (additional analog watchdog, present only on STM32F3 devices) */ |
mbed_official | 237:f3da66175598 | 1623 | #define AWD3_EVENT ((uint32_t)ADC_FLAG_AWD3) /*!< ADC Analog watchdog 3 event (additional analog watchdog, present only on STM32F3 devices) */ |
mbed_official | 237:f3da66175598 | 1624 | #define OVR_EVENT ((uint32_t)ADC_FLAG_OVR) /*!< ADC overrun event */ |
mbed_official | 237:f3da66175598 | 1625 | #define JQOVF_EVENT ((uint32_t)ADC_FLAG_JQOVF) /*!< ADC Injected Context Queue Overflow event */ |
mbed_official | 237:f3da66175598 | 1626 | |
mbed_official | 237:f3da66175598 | 1627 | #define AWD_EVENT AWD1_EVENT /*!< ADC Analog watchdog 1 event: Naming for compatibility with other STM32 devices having only 1 analog watchdog */ |
mbed_official | 237:f3da66175598 | 1628 | |
mbed_official | 237:f3da66175598 | 1629 | #define IS_ADC_EVENT_TYPE(EVENT) (((EVENT) == AWD_EVENT) || \ |
mbed_official | 237:f3da66175598 | 1630 | ((EVENT) == AWD2_EVENT) || \ |
mbed_official | 237:f3da66175598 | 1631 | ((EVENT) == AWD3_EVENT) || \ |
mbed_official | 237:f3da66175598 | 1632 | ((EVENT) == OVR_EVENT) || \ |
mbed_official | 237:f3da66175598 | 1633 | ((EVENT) == JQOVF_EVENT) ) |
mbed_official | 237:f3da66175598 | 1634 | /** |
mbed_official | 237:f3da66175598 | 1635 | * @} |
mbed_official | 237:f3da66175598 | 1636 | */ |
mbed_official | 237:f3da66175598 | 1637 | |
mbed_official | 237:f3da66175598 | 1638 | /** @defgroup ADCEx_interrupts_definition |
mbed_official | 237:f3da66175598 | 1639 | * @{ |
mbed_official | 237:f3da66175598 | 1640 | */ |
mbed_official | 237:f3da66175598 | 1641 | #define ADC_IT_RDY ADC_IER_RDY /*!< ADC Ready (ADRDY) interrupt source */ |
mbed_official | 237:f3da66175598 | 1642 | #define ADC_IT_EOSMP ADC_IER_EOSMP /*!< ADC End of Sampling interrupt source */ |
mbed_official | 237:f3da66175598 | 1643 | #define ADC_IT_EOC ADC_IER_EOC /*!< ADC End of Regular Conversion interrupt source */ |
mbed_official | 237:f3da66175598 | 1644 | #define ADC_IT_EOS ADC_IER_EOS /*!< ADC End of Regular sequence of Conversions interrupt source */ |
mbed_official | 237:f3da66175598 | 1645 | #define ADC_IT_OVR ADC_IER_OVR /*!< ADC overrun interrupt source */ |
mbed_official | 237:f3da66175598 | 1646 | #define ADC_IT_JEOC ADC_IER_JEOC /*!< ADC End of Injected Conversion interrupt source */ |
mbed_official | 237:f3da66175598 | 1647 | #define ADC_IT_JEOS ADC_IER_JEOS /*!< ADC End of Injected sequence of Conversions interrupt source */ |
mbed_official | 237:f3da66175598 | 1648 | #define ADC_IT_AWD1 ADC_IER_AWD1 /*!< ADC Analog watchdog 1 interrupt source (main analog watchdog, present on all STM32 devices) */ |
mbed_official | 237:f3da66175598 | 1649 | #define ADC_IT_AWD2 ADC_IER_AWD2 /*!< ADC Analog watchdog 2 interrupt source (additional analog watchdog, present only on STM32F3 devices) */ |
mbed_official | 237:f3da66175598 | 1650 | #define ADC_IT_AWD3 ADC_IER_AWD3 /*!< ADC Analog watchdog 3 interrupt source (additional analog watchdog, present only on STM32F3 devices) */ |
mbed_official | 237:f3da66175598 | 1651 | #define ADC_IT_JQOVF ADC_IER_JQOVF /*!< ADC Injected Context Queue Overflow interrupt source */ |
mbed_official | 237:f3da66175598 | 1652 | |
mbed_official | 237:f3da66175598 | 1653 | #define ADC_IT_AWD ADC_IT_AWD1 /*!< ADC Analog watchdog 1 interrupt source: Naming for compatibility with other STM32 devices having only 1 analog watchdog */ |
mbed_official | 237:f3da66175598 | 1654 | |
mbed_official | 237:f3da66175598 | 1655 | /* Check of single flag */ |
mbed_official | 237:f3da66175598 | 1656 | #define IS_ADC_IT(IT) (((IT) == ADC_IT_RDY) || ((IT) == ADC_IT_EOSMP) || \ |
mbed_official | 237:f3da66175598 | 1657 | ((IT) == ADC_IT_EOC) || ((IT) == ADC_IT_EOS) || \ |
mbed_official | 237:f3da66175598 | 1658 | ((IT) == ADC_IT_OVR) || ((IT) == ADC_IT_EOS) || \ |
mbed_official | 237:f3da66175598 | 1659 | ((IT) == ADC_IT_JEOS) || ((IT) == ADC_IT_AWD1) || \ |
mbed_official | 237:f3da66175598 | 1660 | ((IT) == ADC_IT_AWD2) || ((IT) == ADC_IT_AWD3) || \ |
mbed_official | 237:f3da66175598 | 1661 | ((IT) == ADC_IT_JQOVF) ) |
mbed_official | 237:f3da66175598 | 1662 | /** |
mbed_official | 237:f3da66175598 | 1663 | * @} |
mbed_official | 237:f3da66175598 | 1664 | */ |
mbed_official | 237:f3da66175598 | 1665 | |
mbed_official | 237:f3da66175598 | 1666 | /** @defgroup ADCEx_flags_definition |
mbed_official | 237:f3da66175598 | 1667 | * @{ |
mbed_official | 237:f3da66175598 | 1668 | */ |
mbed_official | 237:f3da66175598 | 1669 | #define ADC_FLAG_RDY ADC_ISR_ADRD /*!< ADC Ready (ADRDY) flag */ |
mbed_official | 237:f3da66175598 | 1670 | #define ADC_FLAG_EOSMP ADC_ISR_EOSMP /*!< ADC End of Sampling flag */ |
mbed_official | 237:f3da66175598 | 1671 | #define ADC_FLAG_EOC ADC_ISR_EOC /*!< ADC End of Regular Conversion flag */ |
mbed_official | 237:f3da66175598 | 1672 | #define ADC_FLAG_EOS ADC_ISR_EOS /*!< ADC End of Regular sequence of Conversions flag */ |
mbed_official | 237:f3da66175598 | 1673 | #define ADC_FLAG_OVR ADC_ISR_OVR /*!< ADC overrun flag */ |
mbed_official | 237:f3da66175598 | 1674 | #define ADC_FLAG_JEOC ADC_ISR_JEOC /*!< ADC End of Injected Conversion flag */ |
mbed_official | 237:f3da66175598 | 1675 | #define ADC_FLAG_JEOS ADC_ISR_JEOS /*!< ADC End of Injected sequence of Conversions flag */ |
mbed_official | 237:f3da66175598 | 1676 | #define ADC_FLAG_AWD1 ADC_ISR_AWD1 /*!< ADC Analog watchdog 1 flag (main analog watchdog, present on all STM32 devices) */ |
mbed_official | 237:f3da66175598 | 1677 | #define ADC_FLAG_AWD2 ADC_ISR_AWD2 /*!< ADC Analog watchdog 2 flag (additional analog watchdog, present only on STM32F3 devices) */ |
mbed_official | 237:f3da66175598 | 1678 | #define ADC_FLAG_AWD3 ADC_ISR_AWD3 /*!< ADC Analog watchdog 3 flag (additional analog watchdog, present only on STM32F3 devices) */ |
mbed_official | 237:f3da66175598 | 1679 | #define ADC_FLAG_JQOVF ADC_ISR_JQOVF /*!< ADC Injected Context Queue Overflow flag */ |
mbed_official | 237:f3da66175598 | 1680 | |
mbed_official | 237:f3da66175598 | 1681 | #define ADC_FLAG_AWD ADC_FLAG_AWD1 /*!< ADC Analog watchdog 1 flag: Naming for compatibility with other STM32 devices having only 1 analog watchdog */ |
mbed_official | 237:f3da66175598 | 1682 | |
mbed_official | 237:f3da66175598 | 1683 | #define ADC_FLAG_ALL (ADC_FLAG_RDY | ADC_FLAG_EOSMP | ADC_FLAG_EOC | ADC_FLAG_EOS | \ |
mbed_official | 237:f3da66175598 | 1684 | ADC_FLAG_JEOC | ADC_FLAG_JEOS | ADC_FLAG_OVR | ADC_FLAG_AWD1 | \ |
mbed_official | 237:f3da66175598 | 1685 | ADC_FLAG_AWD2 | ADC_FLAG_AWD3 | ADC_FLAG_JQOVF) |
mbed_official | 237:f3da66175598 | 1686 | |
mbed_official | 237:f3da66175598 | 1687 | /* Combination of all post-conversion flags bits: EOC/EOS, JEOC/JEOS, OVR, AWDx */ |
mbed_official | 237:f3da66175598 | 1688 | #define ADC_FLAG_POSTCONV_ALL (ADC_FLAG_EOC | ADC_FLAG_EOS | ADC_FLAG_JEOC | ADC_FLAG_JEOS | \ |
mbed_official | 237:f3da66175598 | 1689 | ADC_FLAG_OVR | ADC_FLAG_AWD1 | ADC_FLAG_AWD2 | ADC_FLAG_AWD3 | \ |
mbed_official | 237:f3da66175598 | 1690 | ADC_FLAG_JQOVF) |
mbed_official | 237:f3da66175598 | 1691 | |
mbed_official | 237:f3da66175598 | 1692 | /* Check of single flag */ |
mbed_official | 237:f3da66175598 | 1693 | #define IS_ADC_FLAG(FLAG) (((FLAG) == ADC_FLAG_RDY) || ((FLAG) == ADC_FLAG_EOSMP) || \ |
mbed_official | 237:f3da66175598 | 1694 | ((FLAG) == ADC_FLAG_EOC) || ((FLAG) == ADC_FLAG_EOS) || \ |
mbed_official | 237:f3da66175598 | 1695 | ((FLAG) == ADC_FLAG_OVR) || ((FLAG) == ADC_FLAG_JEOC) || \ |
mbed_official | 237:f3da66175598 | 1696 | ((FLAG) == ADC_FLAG_JEOS) || ((FLAG) == ADC_FLAG_AWD1) || \ |
mbed_official | 237:f3da66175598 | 1697 | ((FLAG) == ADC_FLAG_AWD2) || ((FLAG) == ADC_FLAG_AWD3) || \ |
mbed_official | 237:f3da66175598 | 1698 | ((FLAG) == ADC_FLAG_JQOVF) ) |
mbed_official | 237:f3da66175598 | 1699 | /** |
mbed_official | 237:f3da66175598 | 1700 | * @} |
mbed_official | 237:f3da66175598 | 1701 | */ |
mbed_official | 237:f3da66175598 | 1702 | |
mbed_official | 237:f3da66175598 | 1703 | /** @defgroup ADC_multimode_bits |
mbed_official | 237:f3da66175598 | 1704 | * @{ |
mbed_official | 237:f3da66175598 | 1705 | */ |
mbed_official | 237:f3da66175598 | 1706 | #if defined(STM32F303xC) || defined(STM32F358xx) || defined(STM32F302xC) || defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8) |
mbed_official | 237:f3da66175598 | 1707 | #define ADC_CCR_MULTI ADC12_CCR_MULTI /*!< Multi ADC mode selection */ |
mbed_official | 237:f3da66175598 | 1708 | #define ADC_CCR_MULTI_0 ADC12_CCR_MULTI_0 /*!< MULTI bit 0 */ |
mbed_official | 237:f3da66175598 | 1709 | #define ADC_CCR_MULTI_1 ADC12_CCR_MULTI_1 /*!< MULTI bit 1 */ |
mbed_official | 237:f3da66175598 | 1710 | #define ADC_CCR_MULTI_2 ADC12_CCR_MULTI_2 /*!< MULTI bit 2 */ |
mbed_official | 237:f3da66175598 | 1711 | #define ADC_CCR_MULTI_3 ADC12_CCR_MULTI_3 /*!< MULTI bit 3 */ |
mbed_official | 237:f3da66175598 | 1712 | #define ADC_CCR_MULTI_4 ADC12_CCR_MULTI_4 /*!< MULTI bit 4 */ |
mbed_official | 237:f3da66175598 | 1713 | #define ADC_CCR_DELAY ADC12_CCR_DELAY /*!< Delay between 2 sampling phases */ |
mbed_official | 237:f3da66175598 | 1714 | #define ADC_CCR_DELAY_0 ADC12_CCR_DELAY_0 /*!< DELAY bit 0 */ |
mbed_official | 237:f3da66175598 | 1715 | #define ADC_CCR_DELAY_1 ADC12_CCR_DELAY_1 /*!< DELAY bit 1 */ |
mbed_official | 237:f3da66175598 | 1716 | #define ADC_CCR_DELAY_2 ADC12_CCR_DELAY_2 /*!< DELAY bit 2 */ |
mbed_official | 237:f3da66175598 | 1717 | #define ADC_CCR_DELAY_3 ADC12_CCR_DELAY_3 /*!< DELAY bit 3 */ |
mbed_official | 237:f3da66175598 | 1718 | #define ADC_CCR_DMACFG ADC12_CCR_DMACFG /*!< DMA configuration for multi-ADC mode */ |
mbed_official | 237:f3da66175598 | 1719 | #define ADC_CCR_MDMA ADC12_CCR_MDMA /*!< DMA mode for multi-ADC mode */ |
mbed_official | 237:f3da66175598 | 1720 | #define ADC_CCR_MDMA_0 ADC12_CCR_MDMA_0 /*!< MDMA bit 0 */ |
mbed_official | 237:f3da66175598 | 1721 | #define ADC_CCR_MDMA_1 ADC12_CCR_MDMA_1 /*!< MDMA bit 1 */ |
mbed_official | 237:f3da66175598 | 1722 | #define ADC_CCR_CKMODE ADC12_CCR_CKMODE /*!< ADC clock mode */ |
mbed_official | 237:f3da66175598 | 1723 | #define ADC_CCR_CKMODE_0 ADC12_CCR_CKMODE_0 /*!< CKMODE bit 0 */ |
mbed_official | 237:f3da66175598 | 1724 | #define ADC_CCR_CKMODE_1 ADC12_CCR_CKMODE_1 /*!< CKMODE bit 1 */ |
mbed_official | 237:f3da66175598 | 1725 | #define ADC_CCR_VREFEN ADC12_CCR_VREFEN /*!< VREFINT enable */ |
mbed_official | 237:f3da66175598 | 1726 | #define ADC_CCR_TSEN ADC12_CCR_TSEN /*!< Temperature sensor enable */ |
mbed_official | 237:f3da66175598 | 1727 | #define ADC_CCR_VBATEN ADC12_CCR_VBATEN /*!< VBAT enable */ |
mbed_official | 237:f3da66175598 | 1728 | #endif /* STM32F303xC || STM32F358xx || STM32F302xC || STM32F303x8 || STM32F328xx || STM32F334x8 */ |
mbed_official | 237:f3da66175598 | 1729 | |
mbed_official | 237:f3da66175598 | 1730 | #if defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 1731 | #define ADC_CCR_MULTI ADC1_CCR_MULTI /*!< Multi ADC mode selection */ |
mbed_official | 237:f3da66175598 | 1732 | #define ADC_CCR_MULTI_0 ADC1_CCR_MULTI_0 /*!< MULTI bit 0 */ |
mbed_official | 237:f3da66175598 | 1733 | #define ADC_CCR_MULTI_1 ADC1_CCR_MULTI_1 /*!< MULTI bit 1 */ |
mbed_official | 237:f3da66175598 | 1734 | #define ADC_CCR_MULTI_2 ADC1_CCR_MULTI_2 /*!< MULTI bit 2 */ |
mbed_official | 237:f3da66175598 | 1735 | #define ADC_CCR_MULTI_3 ADC1_CCR_MULTI_3 /*!< MULTI bit 3 */ |
mbed_official | 237:f3da66175598 | 1736 | #define ADC_CCR_MULTI_4 ADC1_CCR_MULTI_4 /*!< MULTI bit 4 */ |
mbed_official | 237:f3da66175598 | 1737 | #define ADC_CCR_DELAY ADC1_CCR_DELAY /*!< Delay between 2 sampling phases */ |
mbed_official | 237:f3da66175598 | 1738 | #define ADC_CCR_DELAY_0 ADC1_CCR_DELAY_0 /*!< DELAY bit 0 */ |
mbed_official | 237:f3da66175598 | 1739 | #define ADC_CCR_DELAY_1 ADC1_CCR_DELAY_1 /*!< DELAY bit 1 */ |
mbed_official | 237:f3da66175598 | 1740 | #define ADC_CCR_DELAY_2 ADC1_CCR_DELAY_2 /*!< DELAY bit 2 */ |
mbed_official | 237:f3da66175598 | 1741 | #define ADC_CCR_DELAY_3 ADC1_CCR_DELAY_3 /*!< DELAY bit 3 */ |
mbed_official | 237:f3da66175598 | 1742 | #define ADC_CCR_DMACFG ADC1_CCR_DMACFG /*!< DMA configuration for multi-ADC mode */ |
mbed_official | 237:f3da66175598 | 1743 | #define ADC_CCR_MDMA ADC1_CCR_MDMA /*!< DMA mode for multi-ADC mode */ |
mbed_official | 237:f3da66175598 | 1744 | #define ADC_CCR_MDMA_0 ADC1_CCR_MDMA_0 /*!< MDMA bit 0 */ |
mbed_official | 237:f3da66175598 | 1745 | #define ADC_CCR_MDMA_1 ADC1_CCR_MDMA_1 /*!< MDMA bit 1 */ |
mbed_official | 237:f3da66175598 | 1746 | #define ADC_CCR_CKMODE ADC1_CCR_CKMODE /*!< ADC clock mode */ |
mbed_official | 237:f3da66175598 | 1747 | #define ADC_CCR_CKMODE_0 ADC1_CCR_CKMODE_0 /*!< CKMODE bit 0 */ |
mbed_official | 237:f3da66175598 | 1748 | #define ADC_CCR_CKMODE_1 ADC1_CCR_CKMODE_1 /*!< CKMODE bit 1 */ |
mbed_official | 237:f3da66175598 | 1749 | #define ADC_CCR_VREFEN ADC1_CCR_VREFEN /*!< VREFINT enable */ |
mbed_official | 237:f3da66175598 | 1750 | #define ADC_CCR_TSEN ADC1_CCR_TSEN /*!< Temperature sensor enable */ |
mbed_official | 237:f3da66175598 | 1751 | #define ADC_CCR_VBATEN ADC1_CCR_VBATEN /*!< VBAT enable */ |
mbed_official | 237:f3da66175598 | 1752 | #endif /* STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 1753 | |
mbed_official | 237:f3da66175598 | 1754 | |
mbed_official | 237:f3da66175598 | 1755 | /** |
mbed_official | 237:f3da66175598 | 1756 | * @} |
mbed_official | 237:f3da66175598 | 1757 | */ |
mbed_official | 237:f3da66175598 | 1758 | |
mbed_official | 237:f3da66175598 | 1759 | |
mbed_official | 237:f3da66175598 | 1760 | |
mbed_official | 237:f3da66175598 | 1761 | /** |
mbed_official | 237:f3da66175598 | 1762 | * @} |
mbed_official | 237:f3da66175598 | 1763 | */ |
mbed_official | 237:f3da66175598 | 1764 | |
mbed_official | 237:f3da66175598 | 1765 | /** @defgroup ADCEx_range_verification |
mbed_official | 237:f3da66175598 | 1766 | * in function of ADC resolution selected (12, 10, 8 or 6 bits) |
mbed_official | 237:f3da66175598 | 1767 | * @{ |
mbed_official | 237:f3da66175598 | 1768 | */ |
mbed_official | 237:f3da66175598 | 1769 | #define IS_ADC_RANGE(RESOLUTION, ADC_VALUE) \ |
mbed_official | 237:f3da66175598 | 1770 | ((((RESOLUTION) == ADC_RESOLUTION12b) && ((ADC_VALUE) <= ((uint32_t)0x0FFF))) || \ |
mbed_official | 237:f3da66175598 | 1771 | (((RESOLUTION) == ADC_RESOLUTION10b) && ((ADC_VALUE) <= ((uint32_t)0x03FF))) || \ |
mbed_official | 237:f3da66175598 | 1772 | (((RESOLUTION) == ADC_RESOLUTION8b) && ((ADC_VALUE) <= ((uint32_t)0x00FF))) || \ |
mbed_official | 237:f3da66175598 | 1773 | (((RESOLUTION) == ADC_RESOLUTION6b) && ((ADC_VALUE) <= ((uint32_t)0x003F))) ) |
mbed_official | 237:f3da66175598 | 1774 | /** |
mbed_official | 237:f3da66175598 | 1775 | * @} |
mbed_official | 237:f3da66175598 | 1776 | */ |
mbed_official | 237:f3da66175598 | 1777 | |
mbed_official | 237:f3da66175598 | 1778 | /** @defgroup ADC_injected_nb_conv_verification |
mbed_official | 237:f3da66175598 | 1779 | * @{ |
mbed_official | 237:f3da66175598 | 1780 | */ |
mbed_official | 237:f3da66175598 | 1781 | #define IS_ADC_INJECTED_NB_CONV(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)4))) |
mbed_official | 237:f3da66175598 | 1782 | /** |
mbed_official | 237:f3da66175598 | 1783 | * @} |
mbed_official | 237:f3da66175598 | 1784 | */ |
mbed_official | 237:f3da66175598 | 1785 | |
mbed_official | 237:f3da66175598 | 1786 | /** @defgroup ADC_regular_nb_conv_verification |
mbed_official | 237:f3da66175598 | 1787 | * @{ |
mbed_official | 237:f3da66175598 | 1788 | */ |
mbed_official | 237:f3da66175598 | 1789 | #define IS_ADC_REGULAR_NB_CONV(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)16))) |
mbed_official | 237:f3da66175598 | 1790 | /** |
mbed_official | 237:f3da66175598 | 1791 | * @} |
mbed_official | 237:f3da66175598 | 1792 | */ |
mbed_official | 237:f3da66175598 | 1793 | |
mbed_official | 237:f3da66175598 | 1794 | /** @defgroup ADC_regular_discontinuous_mode_number_verification |
mbed_official | 237:f3da66175598 | 1795 | * @{ |
mbed_official | 237:f3da66175598 | 1796 | */ |
mbed_official | 237:f3da66175598 | 1797 | #define IS_ADC_REGULAR_DISCONT_NUMBER(NUMBER) (((NUMBER) >= ((uint32_t)1)) && ((NUMBER) <= ((uint32_t)8))) |
mbed_official | 237:f3da66175598 | 1798 | /** |
mbed_official | 237:f3da66175598 | 1799 | * @} |
mbed_official | 237:f3da66175598 | 1800 | */ |
mbed_official | 237:f3da66175598 | 1801 | |
mbed_official | 237:f3da66175598 | 1802 | /** @defgroup ADC_calibration_factor_length_verification |
mbed_official | 237:f3da66175598 | 1803 | * @{ |
mbed_official | 237:f3da66175598 | 1804 | */ |
mbed_official | 237:f3da66175598 | 1805 | /** |
mbed_official | 237:f3da66175598 | 1806 | * @brief Calibration factor length verification (7 bits maximum) |
mbed_official | 237:f3da66175598 | 1807 | * @param _Calibration_Factor_: Calibration factor value |
mbed_official | 237:f3da66175598 | 1808 | * @retval None |
mbed_official | 237:f3da66175598 | 1809 | */ |
mbed_official | 237:f3da66175598 | 1810 | #define IS_ADC_CALFACT(_Calibration_Factor_) ((_Calibration_Factor_) <= ((uint32_t)0x7F)) |
mbed_official | 237:f3da66175598 | 1811 | /** |
mbed_official | 237:f3da66175598 | 1812 | * @} |
mbed_official | 237:f3da66175598 | 1813 | */ |
mbed_official | 237:f3da66175598 | 1814 | #endif /* STM32F303xC || STM32F358xC || STM32F302xC || STM32F303x8 || STM32F328xx || STM32F334x8 || STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 1815 | |
mbed_official | 237:f3da66175598 | 1816 | |
mbed_official | 237:f3da66175598 | 1817 | #if defined(STM32F373xC) || defined(STM32F378xx) |
mbed_official | 237:f3da66175598 | 1818 | /** @defgroup ADCEx_Data_align |
mbed_official | 237:f3da66175598 | 1819 | * @{ |
mbed_official | 237:f3da66175598 | 1820 | */ |
mbed_official | 237:f3da66175598 | 1821 | #define ADC_DATAALIGN_RIGHT ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 1822 | #define ADC_DATAALIGN_LEFT ((uint32_t)ADC_CR2_ALIGN) |
mbed_official | 237:f3da66175598 | 1823 | |
mbed_official | 237:f3da66175598 | 1824 | #define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DATAALIGN_RIGHT) || \ |
mbed_official | 237:f3da66175598 | 1825 | ((ALIGN) == ADC_DATAALIGN_LEFT) ) |
mbed_official | 237:f3da66175598 | 1826 | /** |
mbed_official | 237:f3da66175598 | 1827 | * @} |
mbed_official | 237:f3da66175598 | 1828 | */ |
mbed_official | 237:f3da66175598 | 1829 | |
mbed_official | 237:f3da66175598 | 1830 | /** @defgroup ADCEx_Scan_mode |
mbed_official | 237:f3da66175598 | 1831 | * @{ |
mbed_official | 237:f3da66175598 | 1832 | */ |
mbed_official | 237:f3da66175598 | 1833 | #define ADC_SCAN_DISABLE ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 1834 | #define ADC_SCAN_ENABLE ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 1835 | |
mbed_official | 237:f3da66175598 | 1836 | #define IS_ADC_SCAN_MODE(SCAN_MODE) (((SCAN_MODE) == ADC_SCAN_DISABLE) || \ |
mbed_official | 237:f3da66175598 | 1837 | ((SCAN_MODE) == ADC_SCAN_ENABLE) ) |
mbed_official | 237:f3da66175598 | 1838 | /** |
mbed_official | 237:f3da66175598 | 1839 | * @} |
mbed_official | 237:f3da66175598 | 1840 | */ |
mbed_official | 237:f3da66175598 | 1841 | |
mbed_official | 237:f3da66175598 | 1842 | /** @defgroup ADCEx_External_trigger_edge_Regular |
mbed_official | 237:f3da66175598 | 1843 | * @{ |
mbed_official | 237:f3da66175598 | 1844 | */ |
mbed_official | 237:f3da66175598 | 1845 | #define ADC_EXTERNALTRIGCONVEDGE_NONE ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 1846 | #define ADC_EXTERNALTRIGCONVEDGE_RISING ((uint32_t)ADC_CR2_EXTTRIG) |
mbed_official | 237:f3da66175598 | 1847 | |
mbed_official | 237:f3da66175598 | 1848 | #define IS_ADC_EXTTRIG_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGCONVEDGE_NONE) || \ |
mbed_official | 237:f3da66175598 | 1849 | ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISING) ) |
mbed_official | 237:f3da66175598 | 1850 | /** |
mbed_official | 237:f3da66175598 | 1851 | * @} |
mbed_official | 237:f3da66175598 | 1852 | */ |
mbed_official | 237:f3da66175598 | 1853 | |
mbed_official | 237:f3da66175598 | 1854 | /** @defgroup ADCEx_External_trigger_source_Regular |
mbed_official | 237:f3da66175598 | 1855 | * @{ |
mbed_official | 237:f3da66175598 | 1856 | */ |
mbed_official | 237:f3da66175598 | 1857 | /* List of external triggers with generic trigger name, sorted by trigger */ |
mbed_official | 237:f3da66175598 | 1858 | /* name: */ |
mbed_official | 237:f3da66175598 | 1859 | |
mbed_official | 237:f3da66175598 | 1860 | /* External triggers of regular group for ADC1 */ |
mbed_official | 237:f3da66175598 | 1861 | #define ADC_EXTERNALTRIGCONV_T2_CC2 ADC_EXTERNALTRIG_T2_CC2 |
mbed_official | 237:f3da66175598 | 1862 | #define ADC_EXTERNALTRIGCONV_T3_TRGO ADC_EXTERNALTRIG_T3_TRGO |
mbed_official | 237:f3da66175598 | 1863 | #define ADC_EXTERNALTRIGCONV_T4_CC2 ADC_EXTERNALTRIG_T4_CC2 |
mbed_official | 237:f3da66175598 | 1864 | #define ADC_EXTERNALTRIGCONV_T19_TRGO ADC_EXTERNALTRIG_T19_TRGO |
mbed_official | 237:f3da66175598 | 1865 | #define ADC_EXTERNALTRIGCONV_T19_CC3 ADC_EXTERNALTRIG_T19_CC3 |
mbed_official | 237:f3da66175598 | 1866 | #define ADC_EXTERNALTRIGCONV_T19_CC4 ADC_EXTERNALTRIG_T19_CC4 |
mbed_official | 237:f3da66175598 | 1867 | #define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC_EXTERNALTRIG_EXT_IT11 |
mbed_official | 237:f3da66175598 | 1868 | #define ADC_SOFTWARE_START ADC_SWSTART |
mbed_official | 237:f3da66175598 | 1869 | |
mbed_official | 237:f3da66175598 | 1870 | #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \ |
mbed_official | 237:f3da66175598 | 1871 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1872 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC2) || \ |
mbed_official | 237:f3da66175598 | 1873 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T19_TRGO) || \ |
mbed_official | 237:f3da66175598 | 1874 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T19_CC3) || \ |
mbed_official | 237:f3da66175598 | 1875 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T19_CC4) || \ |
mbed_official | 237:f3da66175598 | 1876 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \ |
mbed_official | 237:f3da66175598 | 1877 | ((REGTRIG) == ADC_SOFTWARE_START) ) |
mbed_official | 237:f3da66175598 | 1878 | /** |
mbed_official | 237:f3da66175598 | 1879 | * @} |
mbed_official | 237:f3da66175598 | 1880 | */ |
mbed_official | 237:f3da66175598 | 1881 | |
mbed_official | 237:f3da66175598 | 1882 | |
mbed_official | 237:f3da66175598 | 1883 | /** @defgroup ADCEx_Internal_HAL_driver_Ext_trig_src_Regular |
mbed_official | 237:f3da66175598 | 1884 | * @{ |
mbed_official | 237:f3da66175598 | 1885 | */ |
mbed_official | 237:f3da66175598 | 1886 | |
mbed_official | 237:f3da66175598 | 1887 | /* List of external triggers of regular group for ADC1: */ |
mbed_official | 237:f3da66175598 | 1888 | /* (used internally by HAL driver. To not use into HAL structure parameters) */ |
mbed_official | 237:f3da66175598 | 1889 | |
mbed_official | 237:f3da66175598 | 1890 | /* External triggers of regular group for ADC1 */ |
mbed_official | 237:f3da66175598 | 1891 | #define ADC_EXTERNALTRIG_T19_TRGO ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 1892 | #define ADC_EXTERNALTRIG_T19_CC3 ((uint32_t)ADC_CR2_EXTSEL_0) |
mbed_official | 237:f3da66175598 | 1893 | #define ADC_EXTERNALTRIG_T19_CC4 ((uint32_t)ADC_CR2_EXTSEL_1) |
mbed_official | 237:f3da66175598 | 1894 | #define ADC_EXTERNALTRIG_T2_CC2 ((uint32_t)(ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1895 | #define ADC_EXTERNALTRIG_T3_TRGO ((uint32_t)ADC_CR2_EXTSEL_2) |
mbed_official | 237:f3da66175598 | 1896 | #define ADC_EXTERNALTRIG_T4_CC2 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1897 | #define ADC_EXTERNALTRIG_EXT_IT11 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1)) |
mbed_official | 237:f3da66175598 | 1898 | #define ADC_SWSTART ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0)) |
mbed_official | 237:f3da66175598 | 1899 | |
mbed_official | 237:f3da66175598 | 1900 | /** |
mbed_official | 237:f3da66175598 | 1901 | * @} |
mbed_official | 237:f3da66175598 | 1902 | */ |
mbed_official | 237:f3da66175598 | 1903 | |
mbed_official | 237:f3da66175598 | 1904 | |
mbed_official | 237:f3da66175598 | 1905 | /** @defgroup ADCEx_channels |
mbed_official | 237:f3da66175598 | 1906 | * @{ |
mbed_official | 237:f3da66175598 | 1907 | */ |
mbed_official | 237:f3da66175598 | 1908 | /* Note: Depending on devices, some channels may not be available on package */ |
mbed_official | 237:f3da66175598 | 1909 | /* pins. Refer to device datasheet for channels availability. */ |
mbed_official | 237:f3da66175598 | 1910 | #define ADC_CHANNEL_0 ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 1911 | #define ADC_CHANNEL_1 ((uint32_t)(ADC_SQR3_SQ1_0)) |
mbed_official | 237:f3da66175598 | 1912 | #define ADC_CHANNEL_2 ((uint32_t)(ADC_SQR3_SQ1_1)) |
mbed_official | 237:f3da66175598 | 1913 | #define ADC_CHANNEL_3 ((uint32_t)(ADC_SQR3_SQ1_1 | ADC_SQR3_SQ1_0)) |
mbed_official | 237:f3da66175598 | 1914 | #define ADC_CHANNEL_4 ((uint32_t)(ADC_SQR3_SQ1_2)) |
mbed_official | 237:f3da66175598 | 1915 | #define ADC_CHANNEL_5 ((uint32_t)(ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_0)) |
mbed_official | 237:f3da66175598 | 1916 | #define ADC_CHANNEL_6 ((uint32_t)(ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_1)) |
mbed_official | 237:f3da66175598 | 1917 | #define ADC_CHANNEL_7 ((uint32_t)(ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_1 | ADC_SQR3_SQ1_0)) |
mbed_official | 237:f3da66175598 | 1918 | #define ADC_CHANNEL_8 ((uint32_t)(ADC_SQR3_SQ1_3)) |
mbed_official | 237:f3da66175598 | 1919 | #define ADC_CHANNEL_9 ((uint32_t)(ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_0)) |
mbed_official | 237:f3da66175598 | 1920 | #define ADC_CHANNEL_10 ((uint32_t)(ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_1)) |
mbed_official | 237:f3da66175598 | 1921 | #define ADC_CHANNEL_11 ((uint32_t)(ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_1 | ADC_SQR3_SQ1_0)) |
mbed_official | 237:f3da66175598 | 1922 | #define ADC_CHANNEL_12 ((uint32_t)(ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_2)) |
mbed_official | 237:f3da66175598 | 1923 | #define ADC_CHANNEL_13 ((uint32_t)(ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_0)) |
mbed_official | 237:f3da66175598 | 1924 | #define ADC_CHANNEL_14 ((uint32_t)(ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_1)) |
mbed_official | 237:f3da66175598 | 1925 | #define ADC_CHANNEL_15 ((uint32_t)(ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_1 | ADC_SQR3_SQ1_0)) |
mbed_official | 237:f3da66175598 | 1926 | #define ADC_CHANNEL_16 ((uint32_t)(ADC_SQR3_SQ1_4)) |
mbed_official | 237:f3da66175598 | 1927 | #define ADC_CHANNEL_17 ((uint32_t)(ADC_SQR3_SQ1_4 | ADC_SQR3_SQ1_0)) |
mbed_official | 237:f3da66175598 | 1928 | #define ADC_CHANNEL_18 ((uint32_t)(ADC_SQR3_SQ1_4 | ADC_SQR3_SQ1_1)) |
mbed_official | 237:f3da66175598 | 1929 | |
mbed_official | 237:f3da66175598 | 1930 | #define ADC_CHANNEL_TEMPSENSOR ADC_CHANNEL_16 |
mbed_official | 237:f3da66175598 | 1931 | #define ADC_CHANNEL_VREFINT ADC_CHANNEL_17 |
mbed_official | 237:f3da66175598 | 1932 | #define ADC_CHANNEL_VBAT ADC_CHANNEL_18 |
mbed_official | 237:f3da66175598 | 1933 | |
mbed_official | 237:f3da66175598 | 1934 | #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) == ADC_CHANNEL_0) || \ |
mbed_official | 237:f3da66175598 | 1935 | ((CHANNEL) == ADC_CHANNEL_1) || \ |
mbed_official | 237:f3da66175598 | 1936 | ((CHANNEL) == ADC_CHANNEL_2) || \ |
mbed_official | 237:f3da66175598 | 1937 | ((CHANNEL) == ADC_CHANNEL_3) || \ |
mbed_official | 237:f3da66175598 | 1938 | ((CHANNEL) == ADC_CHANNEL_4) || \ |
mbed_official | 237:f3da66175598 | 1939 | ((CHANNEL) == ADC_CHANNEL_5) || \ |
mbed_official | 237:f3da66175598 | 1940 | ((CHANNEL) == ADC_CHANNEL_6) || \ |
mbed_official | 237:f3da66175598 | 1941 | ((CHANNEL) == ADC_CHANNEL_7) || \ |
mbed_official | 237:f3da66175598 | 1942 | ((CHANNEL) == ADC_CHANNEL_8) || \ |
mbed_official | 237:f3da66175598 | 1943 | ((CHANNEL) == ADC_CHANNEL_9) || \ |
mbed_official | 237:f3da66175598 | 1944 | ((CHANNEL) == ADC_CHANNEL_10) || \ |
mbed_official | 237:f3da66175598 | 1945 | ((CHANNEL) == ADC_CHANNEL_11) || \ |
mbed_official | 237:f3da66175598 | 1946 | ((CHANNEL) == ADC_CHANNEL_12) || \ |
mbed_official | 237:f3da66175598 | 1947 | ((CHANNEL) == ADC_CHANNEL_13) || \ |
mbed_official | 237:f3da66175598 | 1948 | ((CHANNEL) == ADC_CHANNEL_14) || \ |
mbed_official | 237:f3da66175598 | 1949 | ((CHANNEL) == ADC_CHANNEL_15) || \ |
mbed_official | 237:f3da66175598 | 1950 | ((CHANNEL) == ADC_CHANNEL_TEMPSENSOR) || \ |
mbed_official | 237:f3da66175598 | 1951 | ((CHANNEL) == ADC_CHANNEL_VREFINT) || \ |
mbed_official | 237:f3da66175598 | 1952 | ((CHANNEL) == ADC_CHANNEL_VBAT) ) |
mbed_official | 237:f3da66175598 | 1953 | /** |
mbed_official | 237:f3da66175598 | 1954 | * @} |
mbed_official | 237:f3da66175598 | 1955 | */ |
mbed_official | 237:f3da66175598 | 1956 | |
mbed_official | 237:f3da66175598 | 1957 | /** @defgroup ADCEx_sampling_times |
mbed_official | 237:f3da66175598 | 1958 | * @{ |
mbed_official | 237:f3da66175598 | 1959 | */ |
mbed_official | 237:f3da66175598 | 1960 | #define ADC_SAMPLETIME_1CYCLE_5 ((uint32_t)0x00000000) /*!< Sampling time 1.5 ADC clock cycle */ |
mbed_official | 237:f3da66175598 | 1961 | #define ADC_SAMPLETIME_7CYCLES_5 ((uint32_t) ADC_SMPR2_SMP0_0) /*!< Sampling time 7.5 ADC clock cycles */ |
mbed_official | 237:f3da66175598 | 1962 | #define ADC_SAMPLETIME_13CYCLES_5 ((uint32_t) ADC_SMPR2_SMP0_1) /*!< Sampling time 13.5 ADC clock cycles */ |
mbed_official | 237:f3da66175598 | 1963 | #define ADC_SAMPLETIME_28CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP0_1 | ADC_SMPR2_SMP0_0)) /*!< Sampling time 28.5 ADC clock cycles */ |
mbed_official | 237:f3da66175598 | 1964 | #define ADC_SAMPLETIME_41CYCLES_5 ((uint32_t) ADC_SMPR2_SMP0_2) /*!< Sampling time 41.5 ADC clock cycles */ |
mbed_official | 237:f3da66175598 | 1965 | #define ADC_SAMPLETIME_55CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP0_2 | ADC_SMPR2_SMP0_0)) /*!< Sampling time 55.5 ADC clock cycles */ |
mbed_official | 237:f3da66175598 | 1966 | #define ADC_SAMPLETIME_71CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP0_2 | ADC_SMPR2_SMP0_1)) /*!< Sampling time 71.5 ADC clock cycles */ |
mbed_official | 237:f3da66175598 | 1967 | #define ADC_SAMPLETIME_239CYCLES_5 ((uint32_t) ADC_SMPR2_SMP0) /*!< Sampling time 239.5 ADC clock cycles */ |
mbed_official | 237:f3da66175598 | 1968 | |
mbed_official | 237:f3da66175598 | 1969 | #define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SAMPLETIME_1CYCLE_5) || \ |
mbed_official | 237:f3da66175598 | 1970 | ((TIME) == ADC_SAMPLETIME_7CYCLES_5) || \ |
mbed_official | 237:f3da66175598 | 1971 | ((TIME) == ADC_SAMPLETIME_13CYCLES_5) || \ |
mbed_official | 237:f3da66175598 | 1972 | ((TIME) == ADC_SAMPLETIME_28CYCLES_5) || \ |
mbed_official | 237:f3da66175598 | 1973 | ((TIME) == ADC_SAMPLETIME_41CYCLES_5) || \ |
mbed_official | 237:f3da66175598 | 1974 | ((TIME) == ADC_SAMPLETIME_55CYCLES_5) || \ |
mbed_official | 237:f3da66175598 | 1975 | ((TIME) == ADC_SAMPLETIME_71CYCLES_5) || \ |
mbed_official | 237:f3da66175598 | 1976 | ((TIME) == ADC_SAMPLETIME_239CYCLES_5) ) |
mbed_official | 237:f3da66175598 | 1977 | /** |
mbed_official | 237:f3da66175598 | 1978 | * @} |
mbed_official | 237:f3da66175598 | 1979 | */ |
mbed_official | 237:f3da66175598 | 1980 | |
mbed_official | 237:f3da66175598 | 1981 | /** @defgroup ADCEx_sampling_times_all_channels |
mbed_official | 237:f3da66175598 | 1982 | * @{ |
mbed_official | 237:f3da66175598 | 1983 | */ |
mbed_official | 237:f3da66175598 | 1984 | #define ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2 \ |
mbed_official | 237:f3da66175598 | 1985 | (ADC_SMPR2_SMP9_2 | ADC_SMPR2_SMP8_2 | ADC_SMPR2_SMP7_2 | ADC_SMPR2_SMP6_2 | \ |
mbed_official | 237:f3da66175598 | 1986 | ADC_SMPR2_SMP5_2 | ADC_SMPR2_SMP4_2 | ADC_SMPR2_SMP3_2 | ADC_SMPR2_SMP2_2 | \ |
mbed_official | 237:f3da66175598 | 1987 | ADC_SMPR2_SMP1_2 | ADC_SMPR2_SMP0_2) |
mbed_official | 237:f3da66175598 | 1988 | #define ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2 \ |
mbed_official | 237:f3da66175598 | 1989 | (ADC_SMPR1_SMP17_2 | ADC_SMPR1_SMP16_2 | ADC_SMPR1_SMP15_2 | ADC_SMPR1_SMP14_2 | \ |
mbed_official | 237:f3da66175598 | 1990 | ADC_SMPR1_SMP13_2 | ADC_SMPR1_SMP12_2 | ADC_SMPR1_SMP11_2 | ADC_SMPR1_SMP10_2 ) |
mbed_official | 237:f3da66175598 | 1991 | |
mbed_official | 237:f3da66175598 | 1992 | #define ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1 \ |
mbed_official | 237:f3da66175598 | 1993 | (ADC_SMPR2_SMP9_1 | ADC_SMPR2_SMP8_1 | ADC_SMPR2_SMP7_1 | ADC_SMPR2_SMP6_1 | \ |
mbed_official | 237:f3da66175598 | 1994 | ADC_SMPR2_SMP5_1 | ADC_SMPR2_SMP4_1 | ADC_SMPR2_SMP3_1 | ADC_SMPR2_SMP2_1 | \ |
mbed_official | 237:f3da66175598 | 1995 | ADC_SMPR2_SMP1_1 | ADC_SMPR2_SMP0_1) |
mbed_official | 237:f3da66175598 | 1996 | #define ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1 \ |
mbed_official | 237:f3da66175598 | 1997 | (ADC_SMPR1_SMP17_1 | ADC_SMPR1_SMP16_1 | ADC_SMPR1_SMP15_1 | ADC_SMPR1_SMP14_1 | \ |
mbed_official | 237:f3da66175598 | 1998 | ADC_SMPR1_SMP13_1 | ADC_SMPR1_SMP12_1 | ADC_SMPR1_SMP11_1 | ADC_SMPR1_SMP10_1 ) |
mbed_official | 237:f3da66175598 | 1999 | |
mbed_official | 237:f3da66175598 | 2000 | #define ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0 \ |
mbed_official | 237:f3da66175598 | 2001 | (ADC_SMPR2_SMP9_0 | ADC_SMPR2_SMP8_0 | ADC_SMPR2_SMP7_0 | ADC_SMPR2_SMP6_0 | \ |
mbed_official | 237:f3da66175598 | 2002 | ADC_SMPR2_SMP5_0 | ADC_SMPR2_SMP4_0 | ADC_SMPR2_SMP3_0 | ADC_SMPR2_SMP2_0 | \ |
mbed_official | 237:f3da66175598 | 2003 | ADC_SMPR2_SMP1_0 | ADC_SMPR2_SMP0_0) |
mbed_official | 237:f3da66175598 | 2004 | #define ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0 \ |
mbed_official | 237:f3da66175598 | 2005 | (ADC_SMPR1_SMP17_0 | ADC_SMPR1_SMP16_0 | ADC_SMPR1_SMP15_0 | ADC_SMPR1_SMP14_0 | \ |
mbed_official | 237:f3da66175598 | 2006 | ADC_SMPR1_SMP13_0 | ADC_SMPR1_SMP12_0 | ADC_SMPR1_SMP11_0 | ADC_SMPR1_SMP10_0 ) |
mbed_official | 237:f3da66175598 | 2007 | |
mbed_official | 237:f3da66175598 | 2008 | #define ADC_SAMPLETIME_1CYCLE5_SMPR2ALLCHANNELS ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 2009 | #define ADC_SAMPLETIME_7CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0) |
mbed_official | 237:f3da66175598 | 2010 | #define ADC_SAMPLETIME_13CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1) |
mbed_official | 237:f3da66175598 | 2011 | #define ADC_SAMPLETIME_28CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1 | ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0) |
mbed_official | 237:f3da66175598 | 2012 | #define ADC_SAMPLETIME_41CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2) |
mbed_official | 237:f3da66175598 | 2013 | #define ADC_SAMPLETIME_55CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0) |
mbed_official | 237:f3da66175598 | 2014 | #define ADC_SAMPLETIME_71CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1) |
mbed_official | 237:f3da66175598 | 2015 | #define ADC_SAMPLETIME_239CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1 | ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0) |
mbed_official | 237:f3da66175598 | 2016 | |
mbed_official | 237:f3da66175598 | 2017 | #define ADC_SAMPLETIME_1CYCLE5_SMPR1ALLCHANNELS ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 2018 | #define ADC_SAMPLETIME_7CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0) |
mbed_official | 237:f3da66175598 | 2019 | #define ADC_SAMPLETIME_13CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1) |
mbed_official | 237:f3da66175598 | 2020 | #define ADC_SAMPLETIME_28CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1 | ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0) |
mbed_official | 237:f3da66175598 | 2021 | #define ADC_SAMPLETIME_41CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2) |
mbed_official | 237:f3da66175598 | 2022 | #define ADC_SAMPLETIME_55CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0) |
mbed_official | 237:f3da66175598 | 2023 | #define ADC_SAMPLETIME_71CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1) |
mbed_official | 237:f3da66175598 | 2024 | #define ADC_SAMPLETIME_239CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1 | ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0) |
mbed_official | 237:f3da66175598 | 2025 | |
mbed_official | 237:f3da66175598 | 2026 | /** |
mbed_official | 237:f3da66175598 | 2027 | * @} |
mbed_official | 237:f3da66175598 | 2028 | */ |
mbed_official | 237:f3da66175598 | 2029 | |
mbed_official | 237:f3da66175598 | 2030 | /** @defgroup ADCEx_regular_rank |
mbed_official | 237:f3da66175598 | 2031 | * @{ |
mbed_official | 237:f3da66175598 | 2032 | */ |
mbed_official | 237:f3da66175598 | 2033 | #define ADC_REGULAR_RANK_1 ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 2034 | #define ADC_REGULAR_RANK_2 ((uint32_t)0x00000002) |
mbed_official | 237:f3da66175598 | 2035 | #define ADC_REGULAR_RANK_3 ((uint32_t)0x00000003) |
mbed_official | 237:f3da66175598 | 2036 | #define ADC_REGULAR_RANK_4 ((uint32_t)0x00000004) |
mbed_official | 237:f3da66175598 | 2037 | #define ADC_REGULAR_RANK_5 ((uint32_t)0x00000005) |
mbed_official | 237:f3da66175598 | 2038 | #define ADC_REGULAR_RANK_6 ((uint32_t)0x00000006) |
mbed_official | 237:f3da66175598 | 2039 | #define ADC_REGULAR_RANK_7 ((uint32_t)0x00000007) |
mbed_official | 237:f3da66175598 | 2040 | #define ADC_REGULAR_RANK_8 ((uint32_t)0x00000008) |
mbed_official | 237:f3da66175598 | 2041 | #define ADC_REGULAR_RANK_9 ((uint32_t)0x00000009) |
mbed_official | 237:f3da66175598 | 2042 | #define ADC_REGULAR_RANK_10 ((uint32_t)0x0000000A) |
mbed_official | 237:f3da66175598 | 2043 | #define ADC_REGULAR_RANK_11 ((uint32_t)0x0000000B) |
mbed_official | 237:f3da66175598 | 2044 | #define ADC_REGULAR_RANK_12 ((uint32_t)0x0000000C) |
mbed_official | 237:f3da66175598 | 2045 | #define ADC_REGULAR_RANK_13 ((uint32_t)0x0000000D) |
mbed_official | 237:f3da66175598 | 2046 | #define ADC_REGULAR_RANK_14 ((uint32_t)0x0000000E) |
mbed_official | 237:f3da66175598 | 2047 | #define ADC_REGULAR_RANK_15 ((uint32_t)0x0000000F) |
mbed_official | 237:f3da66175598 | 2048 | #define ADC_REGULAR_RANK_16 ((uint32_t)0x00000010) |
mbed_official | 237:f3da66175598 | 2049 | |
mbed_official | 237:f3da66175598 | 2050 | #define IS_ADC_REGULAR_RANK(CHANNEL) (((CHANNEL) == ADC_REGULAR_RANK_1 ) || \ |
mbed_official | 237:f3da66175598 | 2051 | ((CHANNEL) == ADC_REGULAR_RANK_2 ) || \ |
mbed_official | 237:f3da66175598 | 2052 | ((CHANNEL) == ADC_REGULAR_RANK_3 ) || \ |
mbed_official | 237:f3da66175598 | 2053 | ((CHANNEL) == ADC_REGULAR_RANK_4 ) || \ |
mbed_official | 237:f3da66175598 | 2054 | ((CHANNEL) == ADC_REGULAR_RANK_5 ) || \ |
mbed_official | 237:f3da66175598 | 2055 | ((CHANNEL) == ADC_REGULAR_RANK_6 ) || \ |
mbed_official | 237:f3da66175598 | 2056 | ((CHANNEL) == ADC_REGULAR_RANK_7 ) || \ |
mbed_official | 237:f3da66175598 | 2057 | ((CHANNEL) == ADC_REGULAR_RANK_8 ) || \ |
mbed_official | 237:f3da66175598 | 2058 | ((CHANNEL) == ADC_REGULAR_RANK_9 ) || \ |
mbed_official | 237:f3da66175598 | 2059 | ((CHANNEL) == ADC_REGULAR_RANK_10) || \ |
mbed_official | 237:f3da66175598 | 2060 | ((CHANNEL) == ADC_REGULAR_RANK_11) || \ |
mbed_official | 237:f3da66175598 | 2061 | ((CHANNEL) == ADC_REGULAR_RANK_12) || \ |
mbed_official | 237:f3da66175598 | 2062 | ((CHANNEL) == ADC_REGULAR_RANK_13) || \ |
mbed_official | 237:f3da66175598 | 2063 | ((CHANNEL) == ADC_REGULAR_RANK_14) || \ |
mbed_official | 237:f3da66175598 | 2064 | ((CHANNEL) == ADC_REGULAR_RANK_15) || \ |
mbed_official | 237:f3da66175598 | 2065 | ((CHANNEL) == ADC_REGULAR_RANK_16) ) |
mbed_official | 237:f3da66175598 | 2066 | /** |
mbed_official | 237:f3da66175598 | 2067 | * @} |
mbed_official | 237:f3da66175598 | 2068 | */ |
mbed_official | 237:f3da66175598 | 2069 | |
mbed_official | 237:f3da66175598 | 2070 | /** @defgroup ADCEx_injected_rank |
mbed_official | 237:f3da66175598 | 2071 | * @{ |
mbed_official | 237:f3da66175598 | 2072 | */ |
mbed_official | 237:f3da66175598 | 2073 | #define ADC_INJECTED_RANK_1 ((uint32_t)0x00000001) |
mbed_official | 237:f3da66175598 | 2074 | #define ADC_INJECTED_RANK_2 ((uint32_t)0x00000002) |
mbed_official | 237:f3da66175598 | 2075 | #define ADC_INJECTED_RANK_3 ((uint32_t)0x00000003) |
mbed_official | 237:f3da66175598 | 2076 | #define ADC_INJECTED_RANK_4 ((uint32_t)0x00000004) |
mbed_official | 237:f3da66175598 | 2077 | |
mbed_official | 237:f3da66175598 | 2078 | #define IS_ADC_INJECTED_RANK(CHANNEL) (((CHANNEL) == ADC_INJECTED_RANK_1) || \ |
mbed_official | 237:f3da66175598 | 2079 | ((CHANNEL) == ADC_INJECTED_RANK_2) || \ |
mbed_official | 237:f3da66175598 | 2080 | ((CHANNEL) == ADC_INJECTED_RANK_3) || \ |
mbed_official | 237:f3da66175598 | 2081 | ((CHANNEL) == ADC_INJECTED_RANK_4) ) |
mbed_official | 237:f3da66175598 | 2082 | /** |
mbed_official | 237:f3da66175598 | 2083 | * @} |
mbed_official | 237:f3da66175598 | 2084 | */ |
mbed_official | 237:f3da66175598 | 2085 | |
mbed_official | 237:f3da66175598 | 2086 | /** @defgroup ADCEx_External_trigger_edge_Injected |
mbed_official | 237:f3da66175598 | 2087 | * @{ |
mbed_official | 237:f3da66175598 | 2088 | */ |
mbed_official | 237:f3da66175598 | 2089 | #define ADC_EXTERNALTRIGINJECCONV_EDGE_NONE ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 2090 | #define ADC_EXTERNALTRIGINJECCONV_EDGE_RISING ((uint32_t)ADC_CR2_JEXTTRIG) |
mbed_official | 237:f3da66175598 | 2091 | |
mbed_official | 237:f3da66175598 | 2092 | #define IS_ADC_EXTTRIGINJEC_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_NONE) || \ |
mbed_official | 237:f3da66175598 | 2093 | ((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_RISING) ) |
mbed_official | 237:f3da66175598 | 2094 | /** |
mbed_official | 237:f3da66175598 | 2095 | * @} |
mbed_official | 237:f3da66175598 | 2096 | */ |
mbed_official | 237:f3da66175598 | 2097 | |
mbed_official | 237:f3da66175598 | 2098 | /** @defgroup ADCEx_External_trigger_source_Injected |
mbed_official | 237:f3da66175598 | 2099 | * @{ |
mbed_official | 237:f3da66175598 | 2100 | */ |
mbed_official | 237:f3da66175598 | 2101 | /* External triggers for injected groups of ADC1 */ |
mbed_official | 237:f3da66175598 | 2102 | #define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ADC_EXTERNALTRIGINJEC_T2_CC1 |
mbed_official | 237:f3da66175598 | 2103 | #define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ADC_EXTERNALTRIGINJEC_T2_TRGO |
mbed_official | 237:f3da66175598 | 2104 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ADC_EXTERNALTRIGINJEC_T3_CC4 |
mbed_official | 237:f3da66175598 | 2105 | #define ADC_EXTERNALTRIGINJECCONV_T4_TRGO ADC_EXTERNALTRIGINJEC_T4_TRGO |
mbed_official | 237:f3da66175598 | 2106 | #define ADC_EXTERNALTRIGINJECCONV_T19_CC1 ADC_EXTERNALTRIGINJEC_T19_CC1 |
mbed_official | 237:f3da66175598 | 2107 | #define ADC_EXTERNALTRIGINJECCONV_T19_CC2 ADC_EXTERNALTRIGINJEC_T19_CC2 |
mbed_official | 237:f3da66175598 | 2108 | #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC_EXTERNALTRIGINJEC_EXT_IT15 |
mbed_official | 237:f3da66175598 | 2109 | #define ADC_INJECTED_SOFTWARE_START ADC_JSWSTART |
mbed_official | 237:f3da66175598 | 2110 | |
mbed_official | 237:f3da66175598 | 2111 | #define IS_ADC_EXTTRIGINJEC(INJTRIG) (((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \ |
mbed_official | 237:f3da66175598 | 2112 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \ |
mbed_official | 237:f3da66175598 | 2113 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \ |
mbed_official | 237:f3da66175598 | 2114 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \ |
mbed_official | 237:f3da66175598 | 2115 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T19_CC1) || \ |
mbed_official | 237:f3da66175598 | 2116 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T19_CC2) || \ |
mbed_official | 237:f3da66175598 | 2117 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \ |
mbed_official | 237:f3da66175598 | 2118 | ((INJTRIG) == ADC_INJECTED_SOFTWARE_START) ) |
mbed_official | 237:f3da66175598 | 2119 | /** |
mbed_official | 237:f3da66175598 | 2120 | * @} |
mbed_official | 237:f3da66175598 | 2121 | */ |
mbed_official | 237:f3da66175598 | 2122 | |
mbed_official | 237:f3da66175598 | 2123 | |
mbed_official | 237:f3da66175598 | 2124 | /** @defgroup ADCEx_Internal_HAL_driver_Ext_trig_src_Injected |
mbed_official | 237:f3da66175598 | 2125 | * @{ |
mbed_official | 237:f3da66175598 | 2126 | */ |
mbed_official | 237:f3da66175598 | 2127 | |
mbed_official | 237:f3da66175598 | 2128 | /* List of external triggers of injected group for ADC1: */ |
mbed_official | 237:f3da66175598 | 2129 | /* (used internally by HAL driver. To not use into HAL structure parameters) */ |
mbed_official | 237:f3da66175598 | 2130 | #define ADC_EXTERNALTRIGINJEC_T19_CC1 ((uint32_t) 0x00000000) |
mbed_official | 237:f3da66175598 | 2131 | #define ADC_EXTERNALTRIGINJEC_T19_CC2 ((uint32_t) ADC_CR2_JEXTSEL_0) |
mbed_official | 237:f3da66175598 | 2132 | #define ADC_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t) ADC_CR2_JEXTSEL_1) |
mbed_official | 237:f3da66175598 | 2133 | #define ADC_EXTERNALTRIGINJEC_T2_CC1 ((uint32_t)(ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 2134 | #define ADC_EXTERNALTRIGINJEC_T3_CC4 ((uint32_t) ADC_CR2_JEXTSEL_2) |
mbed_official | 237:f3da66175598 | 2135 | #define ADC_EXTERNALTRIGINJEC_T4_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 2136 | #define ADC_EXTERNALTRIGINJEC_EXT_IT15 ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1)) |
mbed_official | 237:f3da66175598 | 2137 | #define ADC_JSWSTART ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0)) |
mbed_official | 237:f3da66175598 | 2138 | |
mbed_official | 237:f3da66175598 | 2139 | /** |
mbed_official | 237:f3da66175598 | 2140 | * @} |
mbed_official | 237:f3da66175598 | 2141 | */ |
mbed_official | 237:f3da66175598 | 2142 | |
mbed_official | 237:f3da66175598 | 2143 | |
mbed_official | 237:f3da66175598 | 2144 | /** @defgroup ADCEx_analog_watchdog_mode |
mbed_official | 237:f3da66175598 | 2145 | * @{ |
mbed_official | 237:f3da66175598 | 2146 | */ |
mbed_official | 237:f3da66175598 | 2147 | #define ADC_ANALOGWATCHDOG_NONE ((uint32_t)0x00000000) |
mbed_official | 237:f3da66175598 | 2148 | #define ADC_ANALOGWATCHDOG_SINGLE_REG ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN)) |
mbed_official | 237:f3da66175598 | 2149 | #define ADC_ANALOGWATCHDOG_SINGLE_INJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_JAWDEN)) |
mbed_official | 237:f3da66175598 | 2150 | #define ADC_ANALOGWATCHDOG_SINGLE_REGINJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN | ADC_CR1_JAWDEN)) |
mbed_official | 237:f3da66175598 | 2151 | #define ADC_ANALOGWATCHDOG_ALL_REG ((uint32_t) ADC_CR1_AWDEN) |
mbed_official | 237:f3da66175598 | 2152 | #define ADC_ANALOGWATCHDOG_ALL_INJEC ((uint32_t) ADC_CR1_JAWDEN) |
mbed_official | 237:f3da66175598 | 2153 | #define ADC_ANALOGWATCHDOG_ALL_REGINJEC ((uint32_t)(ADC_CR1_AWDEN | ADC_CR1_JAWDEN)) |
mbed_official | 237:f3da66175598 | 2154 | |
mbed_official | 237:f3da66175598 | 2155 | #define IS_ADC_ANALOG_WATCHDOG_MODE(WATCHDOG) (((WATCHDOG) == ADC_ANALOGWATCHDOG_NONE) || \ |
mbed_official | 237:f3da66175598 | 2156 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REG) || \ |
mbed_official | 237:f3da66175598 | 2157 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_INJEC) || \ |
mbed_official | 237:f3da66175598 | 2158 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REGINJEC) || \ |
mbed_official | 237:f3da66175598 | 2159 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REG) || \ |
mbed_official | 237:f3da66175598 | 2160 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_INJEC) || \ |
mbed_official | 237:f3da66175598 | 2161 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REGINJEC) ) |
mbed_official | 237:f3da66175598 | 2162 | /** |
mbed_official | 237:f3da66175598 | 2163 | * @} |
mbed_official | 237:f3da66175598 | 2164 | */ |
mbed_official | 237:f3da66175598 | 2165 | |
mbed_official | 237:f3da66175598 | 2166 | /** @defgroup ADC_conversion_group |
mbed_official | 237:f3da66175598 | 2167 | * @{ |
mbed_official | 237:f3da66175598 | 2168 | */ |
mbed_official | 237:f3da66175598 | 2169 | #define REGULAR_GROUP ((uint32_t)(ADC_FLAG_EOC)) |
mbed_official | 237:f3da66175598 | 2170 | #define INJECTED_GROUP ((uint32_t)(ADC_FLAG_JEOC)) |
mbed_official | 237:f3da66175598 | 2171 | #define REGULAR_INJECTED_GROUP ((uint32_t)(ADC_FLAG_EOC | ADC_FLAG_JEOC)) |
mbed_official | 237:f3da66175598 | 2172 | |
mbed_official | 237:f3da66175598 | 2173 | #define IS_ADC_CONVERSION_GROUP(CONVERSION) (((CONVERSION) == REGULAR_GROUP) || \ |
mbed_official | 237:f3da66175598 | 2174 | ((CONVERSION) == INJECTED_GROUP) || \ |
mbed_official | 237:f3da66175598 | 2175 | ((CONVERSION) == REGULAR_INJECTED_GROUP) ) |
mbed_official | 237:f3da66175598 | 2176 | /** |
mbed_official | 237:f3da66175598 | 2177 | * @} |
mbed_official | 237:f3da66175598 | 2178 | */ |
mbed_official | 237:f3da66175598 | 2179 | |
mbed_official | 237:f3da66175598 | 2180 | /** @defgroup ADCEx_Event_type |
mbed_official | 237:f3da66175598 | 2181 | * @{ |
mbed_official | 237:f3da66175598 | 2182 | */ |
mbed_official | 237:f3da66175598 | 2183 | #define AWD_EVENT ((uint32_t)ADC_FLAG_AWD) /*!< ADC Analog watchdog event */ |
mbed_official | 237:f3da66175598 | 2184 | |
mbed_official | 237:f3da66175598 | 2185 | #define IS_ADC_EVENT_TYPE(EVENT) ((EVENT) == AWD_EVENT) |
mbed_official | 237:f3da66175598 | 2186 | /** |
mbed_official | 237:f3da66175598 | 2187 | * @} |
mbed_official | 237:f3da66175598 | 2188 | */ |
mbed_official | 237:f3da66175598 | 2189 | |
mbed_official | 237:f3da66175598 | 2190 | /** @defgroup ADCEx_interrupts_definition |
mbed_official | 237:f3da66175598 | 2191 | * @{ |
mbed_official | 237:f3da66175598 | 2192 | */ |
mbed_official | 237:f3da66175598 | 2193 | #define ADC_IT_EOC ADC_CR1_EOCIE /*!< ADC End of Regular Conversion interrupt source */ |
mbed_official | 237:f3da66175598 | 2194 | #define ADC_IT_JEOC ADC_CR1_JEOCIE /*!< ADC End of Injected Conversion interrupt source */ |
mbed_official | 237:f3da66175598 | 2195 | #define ADC_IT_AWD ADC_CR1_AWDIE /*!< ADC Analog watchdog interrupt source */ |
mbed_official | 237:f3da66175598 | 2196 | |
mbed_official | 237:f3da66175598 | 2197 | /* Check of single flag */ |
mbed_official | 237:f3da66175598 | 2198 | #define IS_ADC_IT(IT) (((IT) == ADC_IT_EOC ) || \ |
mbed_official | 237:f3da66175598 | 2199 | ((IT) == ADC_IT_JEOC) || \ |
mbed_official | 237:f3da66175598 | 2200 | ((IT) == ADC_IT_AWD ) ) |
mbed_official | 237:f3da66175598 | 2201 | /** |
mbed_official | 237:f3da66175598 | 2202 | * @} |
mbed_official | 237:f3da66175598 | 2203 | */ |
mbed_official | 237:f3da66175598 | 2204 | |
mbed_official | 237:f3da66175598 | 2205 | /** @defgroup ADCEx_flags_definition |
mbed_official | 237:f3da66175598 | 2206 | * @{ |
mbed_official | 237:f3da66175598 | 2207 | */ |
mbed_official | 237:f3da66175598 | 2208 | #define ADC_FLAG_AWD ADC_SR_AWD /*!< ADC Analog watchdog flag */ |
mbed_official | 237:f3da66175598 | 2209 | #define ADC_FLAG_EOC ADC_SR_EOC /*!< ADC End of Regular conversion flag */ |
mbed_official | 237:f3da66175598 | 2210 | #define ADC_FLAG_JEOC ADC_SR_JEOC /*!< ADC End of Injected conversion flag */ |
mbed_official | 237:f3da66175598 | 2211 | #define ADC_FLAG_JSTRT ADC_SR_JSTRT /*!< ADC Injected group start flag */ |
mbed_official | 237:f3da66175598 | 2212 | #define ADC_FLAG_STRT ADC_SR_STRT /*!< ADC Regular group start flag */ |
mbed_official | 237:f3da66175598 | 2213 | |
mbed_official | 237:f3da66175598 | 2214 | /* Combination of all post-conversion flags bits: EOC/EOS, JEOC/JEOS, OVR, AWDx */ |
mbed_official | 237:f3da66175598 | 2215 | #define ADC_FLAG_POSTCONV_ALL (ADC_FLAG_EOC | ADC_FLAG_JEOC | ADC_FLAG_AWD ) |
mbed_official | 237:f3da66175598 | 2216 | |
mbed_official | 237:f3da66175598 | 2217 | /* Check of single flag */ |
mbed_official | 237:f3da66175598 | 2218 | #define IS_ADC_FLAG(FLAG) (((FLAG) == ADC_FLAG_AWD) || \ |
mbed_official | 237:f3da66175598 | 2219 | ((FLAG) == ADC_FLAG_EOC) || \ |
mbed_official | 237:f3da66175598 | 2220 | ((FLAG) == ADC_FLAG_JEOC) || \ |
mbed_official | 237:f3da66175598 | 2221 | ((FLAG) == ADC_FLAG_JSTRT) || \ |
mbed_official | 237:f3da66175598 | 2222 | ((FLAG) == ADC_FLAG_STRT) ) |
mbed_official | 237:f3da66175598 | 2223 | /** |
mbed_official | 237:f3da66175598 | 2224 | * @} |
mbed_official | 237:f3da66175598 | 2225 | */ |
mbed_official | 237:f3da66175598 | 2226 | |
mbed_official | 237:f3da66175598 | 2227 | /** @defgroup ADCEx_range_verification |
mbed_official | 237:f3da66175598 | 2228 | * For a unique ADC resolution: 12 bits |
mbed_official | 237:f3da66175598 | 2229 | * @{ |
mbed_official | 237:f3da66175598 | 2230 | */ |
mbed_official | 237:f3da66175598 | 2231 | #define IS_ADC_RANGE(ADC_VALUE) ((ADC_VALUE) <= ((uint32_t)0x0FFF)) |
mbed_official | 237:f3da66175598 | 2232 | /** |
mbed_official | 237:f3da66175598 | 2233 | * @} |
mbed_official | 237:f3da66175598 | 2234 | */ |
mbed_official | 237:f3da66175598 | 2235 | |
mbed_official | 237:f3da66175598 | 2236 | /** @defgroup ADC_injected_nb_conv_verification |
mbed_official | 237:f3da66175598 | 2237 | * @{ |
mbed_official | 237:f3da66175598 | 2238 | */ |
mbed_official | 237:f3da66175598 | 2239 | #define IS_ADC_INJECTED_NB_CONV(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)4))) |
mbed_official | 237:f3da66175598 | 2240 | /** |
mbed_official | 237:f3da66175598 | 2241 | * @} |
mbed_official | 237:f3da66175598 | 2242 | */ |
mbed_official | 237:f3da66175598 | 2243 | |
mbed_official | 237:f3da66175598 | 2244 | /** @defgroup ADC_regular_nb_conv_verification |
mbed_official | 237:f3da66175598 | 2245 | * @{ |
mbed_official | 237:f3da66175598 | 2246 | */ |
mbed_official | 237:f3da66175598 | 2247 | #define IS_ADC_REGULAR_NB_CONV(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)16))) |
mbed_official | 237:f3da66175598 | 2248 | /** |
mbed_official | 237:f3da66175598 | 2249 | * @} |
mbed_official | 237:f3da66175598 | 2250 | */ |
mbed_official | 237:f3da66175598 | 2251 | |
mbed_official | 237:f3da66175598 | 2252 | /** @defgroup ADC_regular_discontinuous_mode_number_verification |
mbed_official | 237:f3da66175598 | 2253 | * @{ |
mbed_official | 237:f3da66175598 | 2254 | */ |
mbed_official | 237:f3da66175598 | 2255 | #define IS_ADC_REGULAR_DISCONT_NUMBER(NUMBER) (((NUMBER) >= ((uint32_t)1)) && ((NUMBER) <= ((uint32_t)8))) |
mbed_official | 237:f3da66175598 | 2256 | /** |
mbed_official | 237:f3da66175598 | 2257 | * @} |
mbed_official | 237:f3da66175598 | 2258 | */ |
mbed_official | 237:f3da66175598 | 2259 | #endif /* STM32F373xC || STM32F378xx */ |
mbed_official | 237:f3da66175598 | 2260 | |
mbed_official | 237:f3da66175598 | 2261 | /** |
mbed_official | 237:f3da66175598 | 2262 | * @} |
mbed_official | 237:f3da66175598 | 2263 | */ |
mbed_official | 237:f3da66175598 | 2264 | |
mbed_official | 237:f3da66175598 | 2265 | /* Exported macros -----------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 2266 | |
mbed_official | 237:f3da66175598 | 2267 | /** @addtogroup ADC_Exported_Macro |
mbed_official | 237:f3da66175598 | 2268 | * @{ |
mbed_official | 237:f3da66175598 | 2269 | */ |
mbed_official | 237:f3da66175598 | 2270 | /* Macro for internal HAL driver usage, and possibly can be used into code of */ |
mbed_official | 237:f3da66175598 | 2271 | /* final user. */ |
mbed_official | 237:f3da66175598 | 2272 | |
mbed_official | 237:f3da66175598 | 2273 | #if defined(STM32F303xC) || defined(STM32F358xx) || defined(STM32F302xC) || defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8) || defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 2274 | /** |
mbed_official | 237:f3da66175598 | 2275 | * @brief Verification of ADC state: enabled or disabled |
mbed_official | 237:f3da66175598 | 2276 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2277 | * @retval SET (ADC enabled) or RESET (ADC disabled) |
mbed_official | 237:f3da66175598 | 2278 | */ |
mbed_official | 237:f3da66175598 | 2279 | #define __HAL_ADC_IS_ENABLED(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2280 | (( ((((__HANDLE__)->Instance->CR) & (ADC_CR_ADEN | ADC_CR_ADDIS)) == ADC_CR_ADEN) && \ |
mbed_official | 237:f3da66175598 | 2281 | ((((__HANDLE__)->Instance->ISR) & ADC_FLAG_RDY) == ADC_FLAG_RDY) \ |
mbed_official | 237:f3da66175598 | 2282 | ) ? SET : RESET) |
mbed_official | 237:f3da66175598 | 2283 | |
mbed_official | 237:f3da66175598 | 2284 | /** |
mbed_official | 237:f3da66175598 | 2285 | * @brief Test if conversion trigger of regular group is software start |
mbed_official | 237:f3da66175598 | 2286 | * or external trigger. |
mbed_official | 237:f3da66175598 | 2287 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2288 | * @retval SET (software start) or RESET (external trigger) |
mbed_official | 237:f3da66175598 | 2289 | */ |
mbed_official | 237:f3da66175598 | 2290 | #define __HAL_ADC_IS_SOFTWARE_START_REGULAR(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2291 | (((__HANDLE__)->Instance->CFGR & ADC_CFGR_EXTEN) == RESET) |
mbed_official | 237:f3da66175598 | 2292 | |
mbed_official | 237:f3da66175598 | 2293 | /** |
mbed_official | 237:f3da66175598 | 2294 | * @brief Test if conversion trigger of injected group is software start |
mbed_official | 237:f3da66175598 | 2295 | * or external trigger. |
mbed_official | 237:f3da66175598 | 2296 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2297 | * @retval SET (software start) or RESET (external trigger) |
mbed_official | 237:f3da66175598 | 2298 | */ |
mbed_official | 237:f3da66175598 | 2299 | #define __HAL_ADC_IS_SOFTWARE_START_INJECTED(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2300 | (((__HANDLE__)->Instance->JSQR & ADC_JSQR_JEXTEN) == RESET) |
mbed_official | 237:f3da66175598 | 2301 | |
mbed_official | 237:f3da66175598 | 2302 | /** |
mbed_official | 237:f3da66175598 | 2303 | * @brief Check if no conversion on going on regular and/or injected groups |
mbed_official | 237:f3da66175598 | 2304 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2305 | * @retval SET (conversion is on going) or RESET (no conversion is on going) |
mbed_official | 237:f3da66175598 | 2306 | */ |
mbed_official | 237:f3da66175598 | 2307 | #define __HAL_ADC_IS_CONVERSION_ONGOING_REGULAR_INJECTED(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2308 | (( (((__HANDLE__)->Instance->CR) & (ADC_CR_ADSTART | ADC_CR_JADSTART)) == RESET \ |
mbed_official | 237:f3da66175598 | 2309 | ) ? RESET : SET) |
mbed_official | 237:f3da66175598 | 2310 | |
mbed_official | 237:f3da66175598 | 2311 | /** |
mbed_official | 237:f3da66175598 | 2312 | * @brief Check if no conversion on going on regular group |
mbed_official | 237:f3da66175598 | 2313 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2314 | * @retval SET (conversion is on going) or RESET (no conversion is on going) |
mbed_official | 237:f3da66175598 | 2315 | */ |
mbed_official | 237:f3da66175598 | 2316 | #define __HAL_ADC_IS_CONVERSION_ONGOING_REGULAR(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2317 | (( (((__HANDLE__)->Instance->CR) & ADC_CR_ADSTART) == RESET \ |
mbed_official | 237:f3da66175598 | 2318 | ) ? RESET : SET) |
mbed_official | 237:f3da66175598 | 2319 | |
mbed_official | 237:f3da66175598 | 2320 | /** |
mbed_official | 237:f3da66175598 | 2321 | * @brief Check if no conversion on going on injected group |
mbed_official | 237:f3da66175598 | 2322 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2323 | * @retval SET (conversion is on going) or RESET (no conversion is on going) |
mbed_official | 237:f3da66175598 | 2324 | */ |
mbed_official | 237:f3da66175598 | 2325 | #define __HAL_ADC_IS_CONVERSION_ONGOING_INJECTED(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2326 | (( (((__HANDLE__)->Instance->CR) & ADC_CR_JADSTART) == RESET \ |
mbed_official | 237:f3da66175598 | 2327 | ) ? RESET : SET) |
mbed_official | 237:f3da66175598 | 2328 | |
mbed_official | 237:f3da66175598 | 2329 | /** |
mbed_official | 237:f3da66175598 | 2330 | * @brief Returns resolution bits in CFGR1 register: RES[1:0]. |
mbed_official | 237:f3da66175598 | 2331 | * Returned value is among parameters to @ref ADCEx_Resolution. |
mbed_official | 237:f3da66175598 | 2332 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2333 | * @retval None |
mbed_official | 237:f3da66175598 | 2334 | */ |
mbed_official | 237:f3da66175598 | 2335 | #define __HAL_ADC_GET_RESOLUTION(__HANDLE__) (((__HANDLE__)->Instance->CFGR) & ADC_CFGR_RES) |
mbed_official | 237:f3da66175598 | 2336 | |
mbed_official | 237:f3da66175598 | 2337 | /** @brief Checks if the specified ADC interrupt source is enabled or disabled. |
mbed_official | 237:f3da66175598 | 2338 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2339 | * @param __INTERRUPT__: ADC interrupt source to check |
mbed_official | 237:f3da66175598 | 2340 | * @retval State of interruption (SET or RESET) |
mbed_official | 237:f3da66175598 | 2341 | */ |
mbed_official | 237:f3da66175598 | 2342 | #define __HAL_ADC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) \ |
mbed_official | 237:f3da66175598 | 2343 | (( ((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__) \ |
mbed_official | 237:f3da66175598 | 2344 | )? SET : RESET \ |
mbed_official | 237:f3da66175598 | 2345 | ) |
mbed_official | 237:f3da66175598 | 2346 | |
mbed_official | 237:f3da66175598 | 2347 | /** |
mbed_official | 237:f3da66175598 | 2348 | * @brief Enable the ADC end of conversion interrupt. |
mbed_official | 237:f3da66175598 | 2349 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2350 | * @param __INTERRUPT__: ADC Interrupt |
mbed_official | 237:f3da66175598 | 2351 | * @retval None |
mbed_official | 237:f3da66175598 | 2352 | */ |
mbed_official | 237:f3da66175598 | 2353 | #define __HAL_ADC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) |= (__INTERRUPT__)) |
mbed_official | 237:f3da66175598 | 2354 | |
mbed_official | 237:f3da66175598 | 2355 | /** |
mbed_official | 237:f3da66175598 | 2356 | * @brief Disable the ADC end of conversion interrupt. |
mbed_official | 237:f3da66175598 | 2357 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2358 | * @param __INTERRUPT__: ADC Interrupt |
mbed_official | 237:f3da66175598 | 2359 | * @retval None |
mbed_official | 237:f3da66175598 | 2360 | */ |
mbed_official | 237:f3da66175598 | 2361 | #define __HAL_ADC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) &= ~(__INTERRUPT__)) |
mbed_official | 237:f3da66175598 | 2362 | |
mbed_official | 237:f3da66175598 | 2363 | /** |
mbed_official | 237:f3da66175598 | 2364 | * @brief Get the selected ADC's flag status. |
mbed_official | 237:f3da66175598 | 2365 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2366 | * @param __FLAG__: ADC flag |
mbed_official | 237:f3da66175598 | 2367 | * @retval None |
mbed_official | 237:f3da66175598 | 2368 | */ |
mbed_official | 237:f3da66175598 | 2369 | #define __HAL_ADC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->ISR) & (__FLAG__)) == (__FLAG__)) |
mbed_official | 237:f3da66175598 | 2370 | |
mbed_official | 237:f3da66175598 | 2371 | /** |
mbed_official | 237:f3da66175598 | 2372 | * @brief Clear the ADC's pending flags |
mbed_official | 237:f3da66175598 | 2373 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2374 | * @param __FLAG__: ADC flag |
mbed_official | 237:f3da66175598 | 2375 | * @retval None |
mbed_official | 237:f3da66175598 | 2376 | */ |
mbed_official | 237:f3da66175598 | 2377 | /* Note: bit cleared bit by writing 1 (writing 0 has no effect on any bit of register ISR) */ |
mbed_official | 237:f3da66175598 | 2378 | #define __HAL_ADC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR) = (__FLAG__)) |
mbed_official | 237:f3da66175598 | 2379 | |
mbed_official | 237:f3da66175598 | 2380 | /** |
mbed_official | 237:f3da66175598 | 2381 | * @brief Clear ADC error code (set it to error code: "no error") |
mbed_official | 237:f3da66175598 | 2382 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2383 | * @retval None |
mbed_official | 237:f3da66175598 | 2384 | */ |
mbed_official | 237:f3da66175598 | 2385 | #define __HAL_ADC_CLEAR_ERRORCODE(__HANDLE__) ((__HANDLE__)->ErrorCode = HAL_ADC_ERROR_NONE) |
mbed_official | 237:f3da66175598 | 2386 | #endif /* STM32F303xC || STM32F358xC || STM32F302xC || STM32F303x8 || STM32F328xx || STM32F334x8 || STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 2387 | |
mbed_official | 237:f3da66175598 | 2388 | |
mbed_official | 237:f3da66175598 | 2389 | #if defined(STM32F373xC) || defined(STM32F378xx) |
mbed_official | 237:f3da66175598 | 2390 | /** |
mbed_official | 237:f3da66175598 | 2391 | * @brief Verification of ADC state: enabled or disabled |
mbed_official | 237:f3da66175598 | 2392 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2393 | * @retval SET (ADC enabled) or RESET (ADC disabled) |
mbed_official | 237:f3da66175598 | 2394 | */ |
mbed_official | 237:f3da66175598 | 2395 | #define __HAL_ADC_IS_ENABLED(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2396 | ((( ((__HANDLE__)->Instance->CR2 & ADC_CR2_ADON) == ADC_CR2_ADON ) \ |
mbed_official | 237:f3da66175598 | 2397 | ) ? SET : RESET) |
mbed_official | 237:f3da66175598 | 2398 | |
mbed_official | 237:f3da66175598 | 2399 | /** |
mbed_official | 237:f3da66175598 | 2400 | * @brief Test if conversion trigger of regular group is software start |
mbed_official | 237:f3da66175598 | 2401 | * or external trigger. |
mbed_official | 237:f3da66175598 | 2402 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2403 | * @retval SET (software start) or RESET (external trigger) |
mbed_official | 237:f3da66175598 | 2404 | */ |
mbed_official | 237:f3da66175598 | 2405 | #define __HAL_ADC_IS_SOFTWARE_START_REGULAR(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2406 | (((__HANDLE__)->Instance->CR2 & ADC_CR2_EXTSEL) == ADC_SOFTWARE_START) |
mbed_official | 237:f3da66175598 | 2407 | |
mbed_official | 237:f3da66175598 | 2408 | /** |
mbed_official | 237:f3da66175598 | 2409 | * @brief Test if conversion trigger of injected group is software start |
mbed_official | 237:f3da66175598 | 2410 | * or external trigger. |
mbed_official | 237:f3da66175598 | 2411 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2412 | * @retval SET (software start) or RESET (external trigger) |
mbed_official | 237:f3da66175598 | 2413 | */ |
mbed_official | 237:f3da66175598 | 2414 | #define __HAL_ADC_IS_SOFTWARE_START_INJECTED(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2415 | (((__HANDLE__)->Instance->CR2 & ADC_CR2_JEXTSEL) == ADC_INJECTED_SOFTWARE_START) |
mbed_official | 237:f3da66175598 | 2416 | |
mbed_official | 237:f3da66175598 | 2417 | /** @brief Checks if the specified ADC interrupt source is enabled or disabled. |
mbed_official | 237:f3da66175598 | 2418 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2419 | * @param __INTERRUPT__: ADC interrupt source to check |
mbed_official | 237:f3da66175598 | 2420 | * @retval State of interruption (SET or RESET) |
mbed_official | 237:f3da66175598 | 2421 | */ |
mbed_official | 237:f3da66175598 | 2422 | #define __HAL_ADC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) \ |
mbed_official | 237:f3da66175598 | 2423 | (( ((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__) \ |
mbed_official | 237:f3da66175598 | 2424 | )? SET : RESET \ |
mbed_official | 237:f3da66175598 | 2425 | ) |
mbed_official | 237:f3da66175598 | 2426 | |
mbed_official | 237:f3da66175598 | 2427 | |
mbed_official | 237:f3da66175598 | 2428 | /** |
mbed_official | 237:f3da66175598 | 2429 | * @brief Enable the ADC end of conversion interrupt. |
mbed_official | 237:f3da66175598 | 2430 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2431 | * @param __INTERRUPT__: ADC Interrupt |
mbed_official | 237:f3da66175598 | 2432 | * @retval None |
mbed_official | 237:f3da66175598 | 2433 | */ |
mbed_official | 237:f3da66175598 | 2434 | #define __HAL_ADC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR1) |= (__INTERRUPT__)) |
mbed_official | 237:f3da66175598 | 2435 | |
mbed_official | 237:f3da66175598 | 2436 | /** |
mbed_official | 237:f3da66175598 | 2437 | * @brief Disable the ADC end of conversion interrupt. |
mbed_official | 237:f3da66175598 | 2438 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2439 | * @param __INTERRUPT__: ADC Interrupt |
mbed_official | 237:f3da66175598 | 2440 | * @retval None |
mbed_official | 237:f3da66175598 | 2441 | */ |
mbed_official | 237:f3da66175598 | 2442 | #define __HAL_ADC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR1) &= ~(__INTERRUPT__)) |
mbed_official | 237:f3da66175598 | 2443 | |
mbed_official | 237:f3da66175598 | 2444 | /** |
mbed_official | 237:f3da66175598 | 2445 | * @brief Get the selected ADC's flag status. |
mbed_official | 237:f3da66175598 | 2446 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2447 | * @param __FLAG__: ADC flag |
mbed_official | 237:f3da66175598 | 2448 | * @retval None |
mbed_official | 237:f3da66175598 | 2449 | */ |
mbed_official | 237:f3da66175598 | 2450 | #define __HAL_ADC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__)) |
mbed_official | 237:f3da66175598 | 2451 | |
mbed_official | 237:f3da66175598 | 2452 | /** |
mbed_official | 237:f3da66175598 | 2453 | * @brief Clear the ADC's pending flags |
mbed_official | 237:f3da66175598 | 2454 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2455 | * @param __FLAG__: ADC flag |
mbed_official | 237:f3da66175598 | 2456 | * @retval None |
mbed_official | 237:f3da66175598 | 2457 | */ |
mbed_official | 237:f3da66175598 | 2458 | #define __HAL_ADC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__)) |
mbed_official | 237:f3da66175598 | 2459 | |
mbed_official | 237:f3da66175598 | 2460 | /** |
mbed_official | 237:f3da66175598 | 2461 | * @brief Clear ADC error code (set it to error code: "no error") |
mbed_official | 237:f3da66175598 | 2462 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2463 | * @retval None |
mbed_official | 237:f3da66175598 | 2464 | */ |
mbed_official | 237:f3da66175598 | 2465 | #define __HAL_ADC_CLEAR_ERRORCODE(__HANDLE__) ((__HANDLE__)->ErrorCode = HAL_ADC_ERROR_NONE) |
mbed_official | 237:f3da66175598 | 2466 | |
mbed_official | 237:f3da66175598 | 2467 | #endif /* STM32F373xC || STM32F378xx */ |
mbed_official | 237:f3da66175598 | 2468 | /** |
mbed_official | 237:f3da66175598 | 2469 | * @} |
mbed_official | 237:f3da66175598 | 2470 | */ |
mbed_official | 237:f3da66175598 | 2471 | |
mbed_official | 237:f3da66175598 | 2472 | |
mbed_official | 237:f3da66175598 | 2473 | /* Macro reserved for internal HAL driver usage, not intended to be used in */ |
mbed_official | 237:f3da66175598 | 2474 | /* code of final user. */ |
mbed_official | 237:f3da66175598 | 2475 | |
mbed_official | 237:f3da66175598 | 2476 | /** @defgroup ADCEx_Exported_Macro_internal_HAL_driver |
mbed_official | 237:f3da66175598 | 2477 | * @{ |
mbed_official | 237:f3da66175598 | 2478 | */ |
mbed_official | 237:f3da66175598 | 2479 | #if defined(STM32F303xC) || defined(STM32F358xx) || defined(STM32F302xC) || defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8) || defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 2480 | |
mbed_official | 237:f3da66175598 | 2481 | /** |
mbed_official | 237:f3da66175598 | 2482 | * @brief Set the ADC's sample time for Channels numbers between 0 and 9. |
mbed_official | 237:f3da66175598 | 2483 | * @param _SAMPLETIME_: Sample time parameter. |
mbed_official | 237:f3da66175598 | 2484 | * @param _CHANNELNB_: Channel number. |
mbed_official | 237:f3da66175598 | 2485 | * @retval None |
mbed_official | 237:f3da66175598 | 2486 | */ |
mbed_official | 237:f3da66175598 | 2487 | #define __HAL_ADC_SMPR1(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3 * (_CHANNELNB_))) |
mbed_official | 237:f3da66175598 | 2488 | |
mbed_official | 237:f3da66175598 | 2489 | /** |
mbed_official | 237:f3da66175598 | 2490 | * @brief Set the ADC's sample time for Channels numbers between 10 and 18. |
mbed_official | 237:f3da66175598 | 2491 | * @param _SAMPLETIME_: Sample time parameter. |
mbed_official | 237:f3da66175598 | 2492 | * @param _CHANNELNB_: Channel number. |
mbed_official | 237:f3da66175598 | 2493 | * @retval None |
mbed_official | 237:f3da66175598 | 2494 | */ |
mbed_official | 237:f3da66175598 | 2495 | #define __HAL_ADC_SMPR2(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3 * ((_CHANNELNB_) - 10))) |
mbed_official | 237:f3da66175598 | 2496 | |
mbed_official | 237:f3da66175598 | 2497 | /** |
mbed_official | 237:f3da66175598 | 2498 | * @brief Set the selected regular Channel rank for rank between 1 and 4. |
mbed_official | 237:f3da66175598 | 2499 | * @param _CHANNELNB_: Channel number. |
mbed_official | 237:f3da66175598 | 2500 | * @param _RANKNB_: Rank number. |
mbed_official | 237:f3da66175598 | 2501 | * @retval None |
mbed_official | 237:f3da66175598 | 2502 | */ |
mbed_official | 237:f3da66175598 | 2503 | #define __HAL_ADC_SQR1_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (6 * (_RANKNB_))) |
mbed_official | 237:f3da66175598 | 2504 | |
mbed_official | 237:f3da66175598 | 2505 | /** |
mbed_official | 237:f3da66175598 | 2506 | * @brief Set the selected regular Channel rank for rank between 5 and 9. |
mbed_official | 237:f3da66175598 | 2507 | * @param _CHANNELNB_: Channel number. |
mbed_official | 237:f3da66175598 | 2508 | * @param _RANKNB_: Rank number. |
mbed_official | 237:f3da66175598 | 2509 | * @retval None |
mbed_official | 237:f3da66175598 | 2510 | */ |
mbed_official | 237:f3da66175598 | 2511 | #define __HAL_ADC_SQR2_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (6 * ((_RANKNB_) - 5))) |
mbed_official | 237:f3da66175598 | 2512 | |
mbed_official | 237:f3da66175598 | 2513 | /** |
mbed_official | 237:f3da66175598 | 2514 | * @brief Set the selected regular Channel rank for rank between 10 and 14. |
mbed_official | 237:f3da66175598 | 2515 | * @param _CHANNELNB_: Channel number. |
mbed_official | 237:f3da66175598 | 2516 | * @param _RANKNB_: Rank number. |
mbed_official | 237:f3da66175598 | 2517 | * @retval None |
mbed_official | 237:f3da66175598 | 2518 | */ |
mbed_official | 237:f3da66175598 | 2519 | #define __HAL_ADC_SQR3_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (6 * ((_RANKNB_) - 10))) |
mbed_official | 237:f3da66175598 | 2520 | |
mbed_official | 237:f3da66175598 | 2521 | /** |
mbed_official | 237:f3da66175598 | 2522 | * @brief Set the selected regular Channel rank for rank between 15 and 16. |
mbed_official | 237:f3da66175598 | 2523 | * @param _CHANNELNB_: Channel number. |
mbed_official | 237:f3da66175598 | 2524 | * @param _RANKNB_: Rank number. |
mbed_official | 237:f3da66175598 | 2525 | * @retval None |
mbed_official | 237:f3da66175598 | 2526 | */ |
mbed_official | 237:f3da66175598 | 2527 | #define __HAL_ADC_SQR4_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (6 * ((_RANKNB_) - 15))) |
mbed_official | 237:f3da66175598 | 2528 | |
mbed_official | 237:f3da66175598 | 2529 | /** |
mbed_official | 237:f3da66175598 | 2530 | * @brief Set the selected injected Channel rank. |
mbed_official | 237:f3da66175598 | 2531 | * @param _CHANNELNB_: Channel number. |
mbed_official | 237:f3da66175598 | 2532 | * @param _RANKNB_: Rank number. |
mbed_official | 237:f3da66175598 | 2533 | * @retval None |
mbed_official | 237:f3da66175598 | 2534 | */ |
mbed_official | 237:f3da66175598 | 2535 | #define __HAL_ADC_JSQR_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (6 * (_RANKNB_) +2)) |
mbed_official | 237:f3da66175598 | 2536 | |
mbed_official | 237:f3da66175598 | 2537 | |
mbed_official | 237:f3da66175598 | 2538 | /** |
mbed_official | 237:f3da66175598 | 2539 | * @brief Set the Analog Watchdog 1 channel. |
mbed_official | 237:f3da66175598 | 2540 | * @param _CHANNEL_: channel to be monitored by Analog Watchdog 1. |
mbed_official | 237:f3da66175598 | 2541 | * @retval None |
mbed_official | 237:f3da66175598 | 2542 | */ |
mbed_official | 237:f3da66175598 | 2543 | #define __HAL_ADC_CFGR_AWD1CH(_CHANNEL_) ((_CHANNEL_) << 26) |
mbed_official | 237:f3da66175598 | 2544 | |
mbed_official | 237:f3da66175598 | 2545 | /** |
mbed_official | 237:f3da66175598 | 2546 | * @brief Configure the channel number into Analog Watchdog 2 or 3. |
mbed_official | 237:f3da66175598 | 2547 | * @param _CHANNEL_: ADC Channel |
mbed_official | 237:f3da66175598 | 2548 | * @retval None |
mbed_official | 237:f3da66175598 | 2549 | */ |
mbed_official | 237:f3da66175598 | 2550 | #define __HAL_ADC_CFGR_AWD23CR(_CHANNEL_) (1U << (_CHANNEL_)) |
mbed_official | 237:f3da66175598 | 2551 | |
mbed_official | 237:f3da66175598 | 2552 | /** |
mbed_official | 237:f3da66175598 | 2553 | * @brief Enable automatic conversion of injected group |
mbed_official | 237:f3da66175598 | 2554 | * @param _INJECT_AUTO_CONVERSION_: Injected automatic conversion. |
mbed_official | 237:f3da66175598 | 2555 | * @retval None |
mbed_official | 237:f3da66175598 | 2556 | */ |
mbed_official | 237:f3da66175598 | 2557 | #define __HAL_ADC_CFGR_INJECT_AUTO_CONVERSION(_INJECT_AUTO_CONVERSION_) ((_INJECT_AUTO_CONVERSION_) << 25) |
mbed_official | 237:f3da66175598 | 2558 | |
mbed_official | 237:f3da66175598 | 2559 | /** |
mbed_official | 237:f3da66175598 | 2560 | * @brief Enable ADC injected context queue |
mbed_official | 237:f3da66175598 | 2561 | * @param _INJECT_CONTEXT_QUEUE_MODE_: Injected context queue mode. |
mbed_official | 237:f3da66175598 | 2562 | * @retval None |
mbed_official | 237:f3da66175598 | 2563 | */ |
mbed_official | 237:f3da66175598 | 2564 | #define __HAL_ADC_CFGR_INJECT_CONTEXT_QUEUE(_INJECT_CONTEXT_QUEUE_MODE_) ((_INJECT_CONTEXT_QUEUE_MODE_) << 21) |
mbed_official | 237:f3da66175598 | 2565 | |
mbed_official | 237:f3da66175598 | 2566 | /** |
mbed_official | 237:f3da66175598 | 2567 | * @brief Enable ADC discontinuous conversion mode for injected group |
mbed_official | 237:f3da66175598 | 2568 | * @param _INJECT_DISCONTINUOUS_MODE_: Injected discontinuous mode. |
mbed_official | 237:f3da66175598 | 2569 | * @retval None |
mbed_official | 237:f3da66175598 | 2570 | */ |
mbed_official | 237:f3da66175598 | 2571 | #define __HAL_ADC_CFGR_INJECT_DISCCONTINUOUS(_INJECT_DISCONTINUOUS_MODE_) ((_INJECT_DISCONTINUOUS_MODE_) << 20) |
mbed_official | 237:f3da66175598 | 2572 | |
mbed_official | 237:f3da66175598 | 2573 | /** |
mbed_official | 237:f3da66175598 | 2574 | * @brief Enable ADC discontinuous conversion mode for regular group |
mbed_official | 237:f3da66175598 | 2575 | * @param _REG_DISCONTINUOUS_MODE_: Regular discontinuous mode. |
mbed_official | 237:f3da66175598 | 2576 | * @retval None |
mbed_official | 237:f3da66175598 | 2577 | */ |
mbed_official | 237:f3da66175598 | 2578 | #define __HAL_ADC_CFGR_REG_DISCCONTINUOUS(_REG_DISCONTINUOUS_MODE_) ((_REG_DISCONTINUOUS_MODE_) << 16) |
mbed_official | 237:f3da66175598 | 2579 | |
mbed_official | 237:f3da66175598 | 2580 | /** |
mbed_official | 237:f3da66175598 | 2581 | * @brief Configures the number of discontinuous conversions for regular group. |
mbed_official | 237:f3da66175598 | 2582 | * @param _NBR_DISCONTINUOUS_CONV_: Number of discontinuous conversions. |
mbed_official | 237:f3da66175598 | 2583 | * @retval None |
mbed_official | 237:f3da66175598 | 2584 | */ |
mbed_official | 237:f3da66175598 | 2585 | #define __HAL_ADC_CFGR_DISCONTINUOUS_NUM(_NBR_DISCONTINUOUS_CONV_) (((_NBR_DISCONTINUOUS_CONV_) - 1) << 17) |
mbed_official | 237:f3da66175598 | 2586 | |
mbed_official | 237:f3da66175598 | 2587 | /** |
mbed_official | 237:f3da66175598 | 2588 | * @brief Enable the ADC auto delay mode. |
mbed_official | 237:f3da66175598 | 2589 | * @param _AUTOWAIT_: Auto delay bit enable or disable. |
mbed_official | 237:f3da66175598 | 2590 | * @retval None |
mbed_official | 237:f3da66175598 | 2591 | */ |
mbed_official | 237:f3da66175598 | 2592 | #define __HAL_ADC_CFGR_AUTOWAIT(_AUTOWAIT_) ((_AUTOWAIT_) << 14) |
mbed_official | 237:f3da66175598 | 2593 | |
mbed_official | 237:f3da66175598 | 2594 | /** |
mbed_official | 237:f3da66175598 | 2595 | * @brief Enable ADC continuous conversion mode. |
mbed_official | 237:f3da66175598 | 2596 | * @param _CONTINUOUS_MODE_: Continuous mode. |
mbed_official | 237:f3da66175598 | 2597 | * @retval None |
mbed_official | 237:f3da66175598 | 2598 | */ |
mbed_official | 237:f3da66175598 | 2599 | #define __HAL_ADC_CFGR_CONTINUOUS(_CONTINUOUS_MODE_) ((_CONTINUOUS_MODE_) << 13) |
mbed_official | 237:f3da66175598 | 2600 | |
mbed_official | 237:f3da66175598 | 2601 | /** |
mbed_official | 237:f3da66175598 | 2602 | * @brief Enable ADC overrun mode. |
mbed_official | 237:f3da66175598 | 2603 | * @param _OVERRUN_MODE_: Overrun mode. |
mbed_official | 237:f3da66175598 | 2604 | * @retval Overrun bit setting to be programmed into CFGR register |
mbed_official | 237:f3da66175598 | 2605 | */ |
mbed_official | 237:f3da66175598 | 2606 | /* Note: Bit ADC_CFGR_OVRMOD not used directly in constant */ |
mbed_official | 237:f3da66175598 | 2607 | /* "OVR_DATA_OVERWRITTEN" to have this case defined to 0x00, to set it as the */ |
mbed_official | 237:f3da66175598 | 2608 | /* default case to be compliant with other STM32 devices. */ |
mbed_official | 237:f3da66175598 | 2609 | #define __HAL_ADC_CFGR_OVERRUN(_OVERRUN_MODE_) \ |
mbed_official | 237:f3da66175598 | 2610 | ( ( (_OVERRUN_MODE_) != (OVR_DATA_PRESERVED) \ |
mbed_official | 237:f3da66175598 | 2611 | )? (ADC_CFGR_OVRMOD) : (0x00000000) \ |
mbed_official | 237:f3da66175598 | 2612 | ) |
mbed_official | 237:f3da66175598 | 2613 | |
mbed_official | 237:f3da66175598 | 2614 | /** |
mbed_official | 237:f3da66175598 | 2615 | * @brief Enable the ADC DMA continuous request. |
mbed_official | 237:f3da66175598 | 2616 | * @param _DMACONTREQ_MODE_: DMA continuous request mode. |
mbed_official | 237:f3da66175598 | 2617 | * @retval None |
mbed_official | 237:f3da66175598 | 2618 | */ |
mbed_official | 237:f3da66175598 | 2619 | #define __HAL_ADC_CFGR_DMACONTREQ(_DMACONTREQ_MODE_) ((_DMACONTREQ_MODE_) << 1) |
mbed_official | 237:f3da66175598 | 2620 | |
mbed_official | 237:f3da66175598 | 2621 | /** |
mbed_official | 237:f3da66175598 | 2622 | * @brief For devices with 3 ADCs or more: Defines the external trigger source |
mbed_official | 237:f3da66175598 | 2623 | * for regular group according to ADC into common group ADC1&ADC2 or |
mbed_official | 237:f3da66175598 | 2624 | * ADC3&ADC4 (some triggers with same source have different value to |
mbed_official | 237:f3da66175598 | 2625 | * be programmed into ADC EXTSEL bits of CFGR register). |
mbed_official | 237:f3da66175598 | 2626 | * Note: No risk of trigger bits value of common group ADC1&ADC2 |
mbed_official | 237:f3da66175598 | 2627 | * misleading to another trigger at same bits value, because the 3 |
mbed_official | 237:f3da66175598 | 2628 | * exceptions below are circular and do not point to any other trigger |
mbed_official | 237:f3da66175598 | 2629 | * with direct treatment. |
mbed_official | 237:f3da66175598 | 2630 | * For devices with 2 ADCs or less: this macro makes no change. |
mbed_official | 237:f3da66175598 | 2631 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2632 | * @param __EXT_TRIG_CONV__: External trigger selected for regular group. |
mbed_official | 237:f3da66175598 | 2633 | * @retval External trigger to be programmed into EXTSEL bits of CFGR register |
mbed_official | 237:f3da66175598 | 2634 | */ |
mbed_official | 237:f3da66175598 | 2635 | #if defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 2636 | #define __HAL_ADC_CFGR_EXTSEL(__HANDLE__, __EXT_TRIG_CONV__) \ |
mbed_official | 237:f3da66175598 | 2637 | (( ((((__HANDLE__)->Instance) == ADC3) || (((__HANDLE__)->Instance) == ADC4)) \ |
mbed_official | 237:f3da66175598 | 2638 | )? \ |
mbed_official | 237:f3da66175598 | 2639 | ( ( (__EXT_TRIG_CONV__) == ADC_EXTERNALTRIGCONV_T2_TRGO \ |
mbed_official | 237:f3da66175598 | 2640 | )? \ |
mbed_official | 237:f3da66175598 | 2641 | (ADC3_4_EXTERNALTRIG_T2_TRGO) \ |
mbed_official | 237:f3da66175598 | 2642 | : \ |
mbed_official | 237:f3da66175598 | 2643 | ( ( (__EXT_TRIG_CONV__) == ADC_EXTERNALTRIGCONV_T3_TRGO \ |
mbed_official | 237:f3da66175598 | 2644 | )? \ |
mbed_official | 237:f3da66175598 | 2645 | (ADC3_4_EXTERNALTRIG_T3_TRGO) \ |
mbed_official | 237:f3da66175598 | 2646 | : \ |
mbed_official | 237:f3da66175598 | 2647 | ( ( (__EXT_TRIG_CONV__) == ADC_EXTERNALTRIGCONV_T8_TRGO \ |
mbed_official | 237:f3da66175598 | 2648 | )? \ |
mbed_official | 237:f3da66175598 | 2649 | (ADC3_4_EXTERNALTRIG_T8_TRGO) \ |
mbed_official | 237:f3da66175598 | 2650 | : \ |
mbed_official | 237:f3da66175598 | 2651 | (__EXT_TRIG_CONV__) \ |
mbed_official | 237:f3da66175598 | 2652 | ) \ |
mbed_official | 237:f3da66175598 | 2653 | ) \ |
mbed_official | 237:f3da66175598 | 2654 | ) \ |
mbed_official | 237:f3da66175598 | 2655 | : \ |
mbed_official | 237:f3da66175598 | 2656 | (__EXT_TRIG_CONV__) \ |
mbed_official | 237:f3da66175598 | 2657 | ) |
mbed_official | 237:f3da66175598 | 2658 | #else |
mbed_official | 237:f3da66175598 | 2659 | #define __HAL_ADC_CFGR_EXTSEL(__HANDLE__, __EXT_TRIG_CONV__) \ |
mbed_official | 237:f3da66175598 | 2660 | (__EXT_TRIG_CONV__) |
mbed_official | 237:f3da66175598 | 2661 | #endif /* STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 2662 | |
mbed_official | 237:f3da66175598 | 2663 | /** |
mbed_official | 237:f3da66175598 | 2664 | * @brief For devices with 3 ADCs or more: Defines the external trigger source |
mbed_official | 237:f3da66175598 | 2665 | * for injected group according to ADC into common group ADC1&ADC2 or |
mbed_official | 237:f3da66175598 | 2666 | * ADC3&ADC4 (some triggers with same source have different value to |
mbed_official | 237:f3da66175598 | 2667 | * be programmed into ADC JEXTSEL bits of JSQR register). |
mbed_official | 237:f3da66175598 | 2668 | * Note: No risk of trigger bits value of common group ADC1&ADC2 |
mbed_official | 237:f3da66175598 | 2669 | * misleading to another trigger at same bits value, because the 3 |
mbed_official | 237:f3da66175598 | 2670 | * exceptions below are circular and do not point to any other trigger |
mbed_official | 237:f3da66175598 | 2671 | * with direct treatment, except trigger |
mbed_official | 237:f3da66175598 | 2672 | * ADC_EXTERNALTRIGINJECCONV_T4_CC3 differentiated with SW offset. |
mbed_official | 237:f3da66175598 | 2673 | * For devices with 2 ADCs or less: this macro makes no change. |
mbed_official | 237:f3da66175598 | 2674 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2675 | * @param __EXT_TRIG_INJECTCONV__: External trigger selected for injected group |
mbed_official | 237:f3da66175598 | 2676 | * @retval External trigger to be programmed into JEXTSEL bits of JSQR register |
mbed_official | 237:f3da66175598 | 2677 | */ |
mbed_official | 237:f3da66175598 | 2678 | #if defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 2679 | #define __HAL_ADC_JSQR_JEXTSEL(__HANDLE__, __EXT_TRIG_INJECTCONV__) \ |
mbed_official | 237:f3da66175598 | 2680 | (( ((((__HANDLE__)->Instance) == ADC3) || (((__HANDLE__)->Instance) == ADC4)) \ |
mbed_official | 237:f3da66175598 | 2681 | )? \ |
mbed_official | 237:f3da66175598 | 2682 | ( ( (__EXT_TRIG_INJECTCONV__) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO \ |
mbed_official | 237:f3da66175598 | 2683 | )? \ |
mbed_official | 237:f3da66175598 | 2684 | (ADC3_4_EXTERNALTRIGINJEC_T2_TRGO) \ |
mbed_official | 237:f3da66175598 | 2685 | : \ |
mbed_official | 237:f3da66175598 | 2686 | ( ( (__EXT_TRIG_INJECTCONV__) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO \ |
mbed_official | 237:f3da66175598 | 2687 | )? \ |
mbed_official | 237:f3da66175598 | 2688 | (ADC3_4_EXTERNALTRIGINJEC_T4_TRGO) \ |
mbed_official | 237:f3da66175598 | 2689 | : \ |
mbed_official | 237:f3da66175598 | 2690 | ( ( (__EXT_TRIG_INJECTCONV__) == ADC_EXTERNALTRIGINJECCONV_T8_CC4 \ |
mbed_official | 237:f3da66175598 | 2691 | )? \ |
mbed_official | 237:f3da66175598 | 2692 | (ADC3_4_EXTERNALTRIGINJEC_T8_CC4) \ |
mbed_official | 237:f3da66175598 | 2693 | : \ |
mbed_official | 237:f3da66175598 | 2694 | ( ( (__EXT_TRIG_INJECTCONV__) == ADC_EXTERNALTRIGINJECCONV_T4_CC3 \ |
mbed_official | 237:f3da66175598 | 2695 | )? \ |
mbed_official | 237:f3da66175598 | 2696 | (ADC3_4_EXTERNALTRIGINJEC_T4_CC3) \ |
mbed_official | 237:f3da66175598 | 2697 | : \ |
mbed_official | 237:f3da66175598 | 2698 | (__EXT_TRIG_INJECTCONV__) \ |
mbed_official | 237:f3da66175598 | 2699 | ) \ |
mbed_official | 237:f3da66175598 | 2700 | ) \ |
mbed_official | 237:f3da66175598 | 2701 | ) \ |
mbed_official | 237:f3da66175598 | 2702 | ) \ |
mbed_official | 237:f3da66175598 | 2703 | : \ |
mbed_official | 237:f3da66175598 | 2704 | (__EXT_TRIG_INJECTCONV__) \ |
mbed_official | 237:f3da66175598 | 2705 | ) |
mbed_official | 237:f3da66175598 | 2706 | #else |
mbed_official | 237:f3da66175598 | 2707 | #define __HAL_ADC_JSQR_JEXTSEL(__HANDLE__, __EXT_TRIG_INJECTCONV__) \ |
mbed_official | 237:f3da66175598 | 2708 | (__EXT_TRIG_INJECTCONV__) |
mbed_official | 237:f3da66175598 | 2709 | #endif /* STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 2710 | |
mbed_official | 237:f3da66175598 | 2711 | /** |
mbed_official | 237:f3da66175598 | 2712 | * @brief Configure the channel number into offset OFRx register |
mbed_official | 237:f3da66175598 | 2713 | * @param _CHANNEL_: ADC Channel |
mbed_official | 237:f3da66175598 | 2714 | * @retval None |
mbed_official | 237:f3da66175598 | 2715 | */ |
mbed_official | 237:f3da66175598 | 2716 | #define __HAL_ADC_OFR_CHANNEL(_CHANNEL_) ((_CHANNEL_) << 26) |
mbed_official | 237:f3da66175598 | 2717 | |
mbed_official | 237:f3da66175598 | 2718 | /** |
mbed_official | 237:f3da66175598 | 2719 | * @brief Configure the channel number into differential mode selection register |
mbed_official | 237:f3da66175598 | 2720 | * @param _CHANNEL_: ADC Channel |
mbed_official | 237:f3da66175598 | 2721 | * @retval None |
mbed_official | 237:f3da66175598 | 2722 | */ |
mbed_official | 237:f3da66175598 | 2723 | #define __HAL_ADC_DIFSEL_CHANNEL(_CHANNEL_) (1U << (_CHANNEL_)) |
mbed_official | 237:f3da66175598 | 2724 | |
mbed_official | 237:f3da66175598 | 2725 | /** |
mbed_official | 237:f3da66175598 | 2726 | * @brief Calibration factor in differential mode to be set into calibration register |
mbed_official | 237:f3da66175598 | 2727 | * @param _Calibration_Factor_: Calibration factor value |
mbed_official | 237:f3da66175598 | 2728 | * @retval None |
mbed_official | 237:f3da66175598 | 2729 | */ |
mbed_official | 237:f3da66175598 | 2730 | #define __HAL_ADC_CALFACT_DIFF_SET(_Calibration_Factor_) ((_Calibration_Factor_) << 16) |
mbed_official | 237:f3da66175598 | 2731 | |
mbed_official | 237:f3da66175598 | 2732 | /** |
mbed_official | 237:f3da66175598 | 2733 | * @brief Calibration factor in differential mode to be retrieved from calibration register |
mbed_official | 237:f3da66175598 | 2734 | * @param _Calibration_Factor_: Calibration factor value |
mbed_official | 237:f3da66175598 | 2735 | * @retval None |
mbed_official | 237:f3da66175598 | 2736 | */ |
mbed_official | 237:f3da66175598 | 2737 | #define __HAL_ADC_CALFACT_DIFF_GET(_Calibration_Factor_) ((_Calibration_Factor_) >> 16) |
mbed_official | 237:f3da66175598 | 2738 | |
mbed_official | 237:f3da66175598 | 2739 | /** |
mbed_official | 237:f3da66175598 | 2740 | * @brief Configure the analog watchdog high threshold into registers TR1, TR2 or TR3. |
mbed_official | 237:f3da66175598 | 2741 | * @param _Threshold_: Threshold value |
mbed_official | 237:f3da66175598 | 2742 | * @retval None |
mbed_official | 237:f3da66175598 | 2743 | */ |
mbed_official | 237:f3da66175598 | 2744 | #define __HAL_ADC_TRX_HIGHTHRESHOLD(_Threshold_) ((_Threshold_) << 16) |
mbed_official | 237:f3da66175598 | 2745 | |
mbed_official | 237:f3da66175598 | 2746 | /** |
mbed_official | 237:f3da66175598 | 2747 | * @brief Enable the ADC DMA continuous request for ADC multimode. |
mbed_official | 237:f3da66175598 | 2748 | * @param _DMAContReq_MODE_: DMA continuous request mode. |
mbed_official | 237:f3da66175598 | 2749 | * @retval None |
mbed_official | 237:f3da66175598 | 2750 | */ |
mbed_official | 237:f3da66175598 | 2751 | #define __HAL_ADC_CCR_MULTI_DMACONTREQ(_DMAContReq_MODE_) ((_DMAContReq_MODE_) << 13) |
mbed_official | 237:f3da66175598 | 2752 | |
mbed_official | 237:f3da66175598 | 2753 | |
mbed_official | 237:f3da66175598 | 2754 | /** |
mbed_official | 237:f3da66175598 | 2755 | * @brief Enable the ADC peripheral |
mbed_official | 237:f3da66175598 | 2756 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2757 | * @retval None |
mbed_official | 237:f3da66175598 | 2758 | */ |
mbed_official | 237:f3da66175598 | 2759 | #define __HAL_ADC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= ADC_CR_ADEN) |
mbed_official | 237:f3da66175598 | 2760 | |
mbed_official | 237:f3da66175598 | 2761 | /** |
mbed_official | 237:f3da66175598 | 2762 | * @brief Verification of hardware constraints before ADC can be enabled |
mbed_official | 237:f3da66175598 | 2763 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2764 | * @retval SET (ADC can be enabled) or RESET (ADC cannot be enabled) |
mbed_official | 237:f3da66175598 | 2765 | */ |
mbed_official | 237:f3da66175598 | 2766 | #define __HAL_ADC_ENABLING_CONDITIONS(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2767 | (( ( ((__HANDLE__)->Instance->CR) & \ |
mbed_official | 237:f3da66175598 | 2768 | (ADC_CR_ADCAL | ADC_CR_JADSTP | ADC_CR_ADSTP | ADC_CR_JADSTART | \ |
mbed_official | 237:f3da66175598 | 2769 | ADC_CR_ADSTART | ADC_CR_ADDIS | ADC_CR_ADEN ) \ |
mbed_official | 237:f3da66175598 | 2770 | ) == RESET \ |
mbed_official | 237:f3da66175598 | 2771 | ) ? SET : RESET) |
mbed_official | 237:f3da66175598 | 2772 | |
mbed_official | 237:f3da66175598 | 2773 | /** |
mbed_official | 237:f3da66175598 | 2774 | * @brief Disable the ADC peripheral |
mbed_official | 237:f3da66175598 | 2775 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2776 | * @retval None |
mbed_official | 237:f3da66175598 | 2777 | */ |
mbed_official | 237:f3da66175598 | 2778 | #define __HAL_ADC_DISABLE(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2779 | do{ \ |
mbed_official | 237:f3da66175598 | 2780 | (__HANDLE__)->Instance->CR |= ADC_CR_ADDIS; \ |
mbed_official | 237:f3da66175598 | 2781 | __HAL_ADC_CLEAR_FLAG((__HANDLE__), (ADC_FLAG_EOSMP | ADC_FLAG_RDY)); \ |
mbed_official | 237:f3da66175598 | 2782 | } while(0) |
mbed_official | 237:f3da66175598 | 2783 | |
mbed_official | 237:f3da66175598 | 2784 | /** |
mbed_official | 237:f3da66175598 | 2785 | * @brief Verification of hardware constraints before ADC can be disabled |
mbed_official | 237:f3da66175598 | 2786 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2787 | * @retval SET (ADC can be disabled) or RESET (ADC cannot be disabled) |
mbed_official | 237:f3da66175598 | 2788 | */ |
mbed_official | 237:f3da66175598 | 2789 | #define __HAL_ADC_DISABLING_CONDITIONS(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2790 | (( ( ((__HANDLE__)->Instance->CR) & \ |
mbed_official | 237:f3da66175598 | 2791 | (ADC_CR_JADSTART | ADC_CR_ADSTART | ADC_CR_ADEN)) == ADC_CR_ADEN \ |
mbed_official | 237:f3da66175598 | 2792 | ) ? SET : RESET) |
mbed_official | 237:f3da66175598 | 2793 | |
mbed_official | 237:f3da66175598 | 2794 | |
mbed_official | 237:f3da66175598 | 2795 | /** |
mbed_official | 237:f3da66175598 | 2796 | * @brief Shift the offset in function of the selected ADC resolution. |
mbed_official | 237:f3da66175598 | 2797 | * Offset has to be left-aligned on bit 11, the LSB (right bits) are set to 0 |
mbed_official | 237:f3da66175598 | 2798 | * If resolution 12 bits, no shift. |
mbed_official | 237:f3da66175598 | 2799 | * If resolution 10 bits, shift of 2 ranks on the left. |
mbed_official | 237:f3da66175598 | 2800 | * If resolution 8 bits, shift of 4 ranks on the left. |
mbed_official | 237:f3da66175598 | 2801 | * If resolution 6 bits, shift of 6 ranks on the left. |
mbed_official | 237:f3da66175598 | 2802 | * therefore, shift = (12 - resolution) = 12 - (12- (((RES[1:0]) >> 3)*2)) |
mbed_official | 237:f3da66175598 | 2803 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2804 | * @param _Offset_: Value to be shifted |
mbed_official | 237:f3da66175598 | 2805 | * @retval None |
mbed_official | 237:f3da66175598 | 2806 | */ |
mbed_official | 237:f3da66175598 | 2807 | #define __HAL_ADC_OFFSET_SHIFT_RESOLUTION(__HANDLE__, _Offset_) \ |
mbed_official | 237:f3da66175598 | 2808 | ((_Offset_) << ((((__HANDLE__)->Instance->CFGR & ADC_CFGR_RES) >> 3)*2)) |
mbed_official | 237:f3da66175598 | 2809 | |
mbed_official | 237:f3da66175598 | 2810 | /** |
mbed_official | 237:f3da66175598 | 2811 | * @brief Shift the AWD1 threshold in function of the selected ADC resolution. |
mbed_official | 237:f3da66175598 | 2812 | * Thresholds have to be left-aligned on bit 11, the LSB (right bits) are set to 0. |
mbed_official | 237:f3da66175598 | 2813 | * If resolution 12 bits, no shift. |
mbed_official | 237:f3da66175598 | 2814 | * If resolution 10 bits, shift of 2 ranks on the left. |
mbed_official | 237:f3da66175598 | 2815 | * If resolution 8 bits, shift of 4 ranks on the left. |
mbed_official | 237:f3da66175598 | 2816 | * If resolution 6 bits, shift of 6 ranks on the left. |
mbed_official | 237:f3da66175598 | 2817 | * therefore, shift = (12 - resolution) = 12 - (12- (((RES[1:0]) >> 3)*2)) |
mbed_official | 237:f3da66175598 | 2818 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2819 | * @param _Threshold_: Value to be shifted |
mbed_official | 237:f3da66175598 | 2820 | * @retval None |
mbed_official | 237:f3da66175598 | 2821 | */ |
mbed_official | 237:f3da66175598 | 2822 | #define __HAL_ADC_AWD1THRESHOLD_SHIFT_RESOLUTION(__HANDLE__, _Threshold_) \ |
mbed_official | 237:f3da66175598 | 2823 | ((_Threshold_) << ((((__HANDLE__)->Instance->CFGR & ADC_CFGR_RES) >> 3)*2)) |
mbed_official | 237:f3da66175598 | 2824 | |
mbed_official | 237:f3da66175598 | 2825 | /** |
mbed_official | 237:f3da66175598 | 2826 | * @brief Shift the AWD2 and AWD3 threshold in function of the selected ADC resolution. |
mbed_official | 237:f3da66175598 | 2827 | * Thresholds have to be left-aligned on bit 7. |
mbed_official | 237:f3da66175598 | 2828 | * If resolution 12 bits, shift of 4 ranks on the right (the 4 LSB are discarded) |
mbed_official | 237:f3da66175598 | 2829 | * If resolution 10 bits, shift of 2 ranks on the right (the 2 LSB are discarded) |
mbed_official | 237:f3da66175598 | 2830 | * If resolution 8 bits, no shift. |
mbed_official | 237:f3da66175598 | 2831 | * If resolution 6 bits, shift of 2 ranks on the left (the 2 LSB are set to 0) |
mbed_official | 237:f3da66175598 | 2832 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2833 | * @param _Threshold_: Value to be shifted |
mbed_official | 237:f3da66175598 | 2834 | * @retval None |
mbed_official | 237:f3da66175598 | 2835 | */ |
mbed_official | 237:f3da66175598 | 2836 | #define __HAL_ADC_AWD23THRESHOLD_SHIFT_RESOLUTION(__HANDLE__, _Threshold_) \ |
mbed_official | 237:f3da66175598 | 2837 | ( ((__HANDLE__)->Instance->CFGR & ADC_CFGR_RES) != (ADC_CFGR_RES_1 | ADC_CFGR_RES_0) ? \ |
mbed_official | 237:f3da66175598 | 2838 | ((_Threshold_) >> (4- ((((__HANDLE__)->Instance->CFGR & ADC_CFGR_RES) >> 3)*2))) : \ |
mbed_official | 237:f3da66175598 | 2839 | (_Threshold_) << 2 ) |
mbed_official | 237:f3da66175598 | 2840 | |
mbed_official | 237:f3da66175598 | 2841 | /** |
mbed_official | 237:f3da66175598 | 2842 | * @brief Defines if the selected ADC is within ADC common register ADC1_2 or ADC3_4 |
mbed_official | 237:f3da66175598 | 2843 | * if available (ADC2, ADC3, ADC4 availability depends on STM32 product) |
mbed_official | 237:f3da66175598 | 2844 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2845 | * @retval Common control register ADC1_2 or ADC3_4 |
mbed_official | 237:f3da66175598 | 2846 | */ |
mbed_official | 237:f3da66175598 | 2847 | #if defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 2848 | #define __HAL_ADC_COMMON_REGISTER(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2849 | ( ( ((((__HANDLE__)->Instance) == ADC1) || (((__HANDLE__)->Instance) == ADC2)) \ |
mbed_official | 237:f3da66175598 | 2850 | )? (ADC1_2_COMMON) : (ADC3_4_COMMON) \ |
mbed_official | 237:f3da66175598 | 2851 | ) |
mbed_official | 237:f3da66175598 | 2852 | #endif /* STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 2853 | #if defined(STM32F302xC) || defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8) |
mbed_official | 237:f3da66175598 | 2854 | #define __HAL_ADC_COMMON_REGISTER(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2855 | (ADC1_2_COMMON) |
mbed_official | 237:f3da66175598 | 2856 | #endif /* STM32F302xC || STM32F303x8 || STM32F328xx || STM32F334x8 */ |
mbed_official | 237:f3da66175598 | 2857 | #if defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 2858 | #define __HAL_ADC_COMMON_REGISTER(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2859 | (ADC1_COMMON) |
mbed_official | 237:f3da66175598 | 2860 | #endif /* STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 2861 | |
mbed_official | 237:f3da66175598 | 2862 | /** |
mbed_official | 237:f3da66175598 | 2863 | * @brief Selection of ADC common register CCR bits MULTI[4:0]corresponding to the selected ADC (applicable for devices with several ADCs) |
mbed_official | 237:f3da66175598 | 2864 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2865 | * @retval None |
mbed_official | 237:f3da66175598 | 2866 | */ |
mbed_official | 237:f3da66175598 | 2867 | #if defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 2868 | #define __HAL_ADC_COMMON_CCR_MULTI(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2869 | ( ( ((((__HANDLE__)->Instance) == ADC1) || (((__HANDLE__)->Instance) == ADC2)) \ |
mbed_official | 237:f3da66175598 | 2870 | )? \ |
mbed_official | 237:f3da66175598 | 2871 | (ADC1_2_COMMON->CCR & ADC12_CCR_MULTI) \ |
mbed_official | 237:f3da66175598 | 2872 | : \ |
mbed_official | 237:f3da66175598 | 2873 | (ADC3_4_COMMON->CCR & ADC34_CCR_MULTI) \ |
mbed_official | 237:f3da66175598 | 2874 | ) |
mbed_official | 237:f3da66175598 | 2875 | #endif /* STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 2876 | #if defined(STM32F302xC) || defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8) |
mbed_official | 237:f3da66175598 | 2877 | #define __HAL_ADC_COMMON_CCR_MULTI(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2878 | (ADC1_2_COMMON->CCR & ADC12_CCR_MULTI) |
mbed_official | 237:f3da66175598 | 2879 | #endif /* STM32F302xC || STM32F303x8 || STM32F328xx || STM32F334x8 */ |
mbed_official | 237:f3da66175598 | 2880 | #if defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 2881 | #define __HAL_ADC_COMMON_CCR_MULTI(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2882 | (RESET) |
mbed_official | 237:f3da66175598 | 2883 | #endif /* STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 2884 | |
mbed_official | 237:f3da66175598 | 2885 | /** |
mbed_official | 237:f3da66175598 | 2886 | * @brief Verification of condition for ADC start conversion: ADC must be in non-multimode, or multimode with handle of ADC master (applicable for devices with several ADCs) |
mbed_official | 237:f3da66175598 | 2887 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2888 | * @retval None |
mbed_official | 237:f3da66175598 | 2889 | */ |
mbed_official | 237:f3da66175598 | 2890 | #if defined(STM32F303xC) || defined(STM32F358xx) || defined(STM32F302xC) || defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8) |
mbed_official | 237:f3da66175598 | 2891 | #define __HAL_ADC_NONMULTIMODE_OR_MULTIMODEMASTER(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2892 | ((__HAL_ADC_COMMON_CCR_MULTI(__HANDLE__) == RESET) || (IS_ADC_MULTIMODE_MASTER_INSTANCE((__HANDLE__)->Instance))) |
mbed_official | 237:f3da66175598 | 2893 | #endif /* STM32F303xC || STM32F358xC || STM32F302xC || STM32F303x8 || STM32F328xx || STM32F334x8 */ |
mbed_official | 237:f3da66175598 | 2894 | #if defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 2895 | #define __HAL_ADC_NONMULTIMODE_OR_MULTIMODEMASTER(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 2896 | (!RESET) |
mbed_official | 237:f3da66175598 | 2897 | #endif /* STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 2898 | |
mbed_official | 237:f3da66175598 | 2899 | /** |
mbed_official | 237:f3da66175598 | 2900 | * @brief Set handle of the other ADC sharing the same common register ADC1_2 or ADC3_4 |
mbed_official | 237:f3da66175598 | 2901 | * if available (ADC2, ADC3, ADC4 availability depends on STM32 product) |
mbed_official | 237:f3da66175598 | 2902 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 2903 | * @param __HANDLE_OTHER_ADC__: other ADC handle |
mbed_official | 237:f3da66175598 | 2904 | * @retval None |
mbed_official | 237:f3da66175598 | 2905 | */ |
mbed_official | 237:f3da66175598 | 2906 | #if defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 2907 | #define __HAL_ADC_COMMON_ADC_OTHER(__HANDLE__, __HANDLE_OTHER_ADC__) \ |
mbed_official | 237:f3da66175598 | 2908 | ( ( ((__HANDLE__)->Instance == ADC1) \ |
mbed_official | 237:f3da66175598 | 2909 | )? \ |
mbed_official | 237:f3da66175598 | 2910 | ((__HANDLE_OTHER_ADC__)->Instance = ADC2) \ |
mbed_official | 237:f3da66175598 | 2911 | : \ |
mbed_official | 237:f3da66175598 | 2912 | ( ( ((__HANDLE__)->Instance == ADC2) \ |
mbed_official | 237:f3da66175598 | 2913 | )? \ |
mbed_official | 237:f3da66175598 | 2914 | ((__HANDLE_OTHER_ADC__)->Instance = ADC1) \ |
mbed_official | 237:f3da66175598 | 2915 | : \ |
mbed_official | 237:f3da66175598 | 2916 | ( ( ((__HANDLE__)->Instance == ADC3) \ |
mbed_official | 237:f3da66175598 | 2917 | )? \ |
mbed_official | 237:f3da66175598 | 2918 | ((__HANDLE_OTHER_ADC__)->Instance = ADC4) \ |
mbed_official | 237:f3da66175598 | 2919 | : \ |
mbed_official | 237:f3da66175598 | 2920 | ( ( ((__HANDLE__)->Instance == ADC4) \ |
mbed_official | 237:f3da66175598 | 2921 | )? \ |
mbed_official | 237:f3da66175598 | 2922 | ((__HANDLE_OTHER_ADC__)->Instance = ADC3) \ |
mbed_official | 237:f3da66175598 | 2923 | : \ |
mbed_official | 237:f3da66175598 | 2924 | ((__HANDLE_OTHER_ADC__)->Instance = NULL) \ |
mbed_official | 237:f3da66175598 | 2925 | ) \ |
mbed_official | 237:f3da66175598 | 2926 | ) \ |
mbed_official | 237:f3da66175598 | 2927 | ) \ |
mbed_official | 237:f3da66175598 | 2928 | ) |
mbed_official | 237:f3da66175598 | 2929 | #endif /* STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 2930 | #if defined(STM32F302xC) || defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8) |
mbed_official | 237:f3da66175598 | 2931 | #define __HAL_ADC_COMMON_ADC_OTHER(__HANDLE__, __HANDLE_OTHER_ADC__) \ |
mbed_official | 237:f3da66175598 | 2932 | ( ( ((__HANDLE__)->Instance == ADC1) \ |
mbed_official | 237:f3da66175598 | 2933 | )? \ |
mbed_official | 237:f3da66175598 | 2934 | ((__HANDLE_OTHER_ADC__)->Instance = ADC2) \ |
mbed_official | 237:f3da66175598 | 2935 | : \ |
mbed_official | 237:f3da66175598 | 2936 | ((__HANDLE_OTHER_ADC__)->Instance = ADC1) \ |
mbed_official | 237:f3da66175598 | 2937 | ) |
mbed_official | 237:f3da66175598 | 2938 | #endif /* STM32F302xC || STM32F303x8 || STM32F328xx || STM32F334x8 */ |
mbed_official | 237:f3da66175598 | 2939 | #if defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 2940 | #define __HAL_ADC_COMMON_ADC_OTHER(__HANDLE__, __HANDLE_OTHER_ADC__) \ |
mbed_official | 237:f3da66175598 | 2941 | ((__HANDLE_OTHER_ADC__)->Instance = NULL) |
mbed_official | 237:f3da66175598 | 2942 | #endif /* STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 2943 | |
mbed_official | 237:f3da66175598 | 2944 | /** |
mbed_official | 237:f3da66175598 | 2945 | * @brief Set handle of the ADC slave associated to the ADC master |
mbed_official | 237:f3da66175598 | 2946 | * if available (ADC2, ADC3, ADC4 availability depends on STM32 product) |
mbed_official | 237:f3da66175598 | 2947 | * @param __HANDLE_MASTER__: ADC master handle |
mbed_official | 237:f3da66175598 | 2948 | * @param __HANDLE_SLAVE__: ADC slave handle |
mbed_official | 237:f3da66175598 | 2949 | * @retval None |
mbed_official | 237:f3da66175598 | 2950 | */ |
mbed_official | 237:f3da66175598 | 2951 | #if defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 2952 | #define __HAL_ADC_MULTI_SLAVE(__HANDLE_MASTER__, __HANDLE_SLAVE__) \ |
mbed_official | 237:f3da66175598 | 2953 | ( ( ((__HANDLE_MASTER__)->Instance == ADC1) \ |
mbed_official | 237:f3da66175598 | 2954 | )? \ |
mbed_official | 237:f3da66175598 | 2955 | ((__HANDLE_SLAVE__)->Instance = ADC2) \ |
mbed_official | 237:f3da66175598 | 2956 | : \ |
mbed_official | 237:f3da66175598 | 2957 | ( ( ((__HANDLE_MASTER__)->Instance == ADC3) \ |
mbed_official | 237:f3da66175598 | 2958 | )? \ |
mbed_official | 237:f3da66175598 | 2959 | ((__HANDLE_SLAVE__)->Instance = ADC4) \ |
mbed_official | 237:f3da66175598 | 2960 | : \ |
mbed_official | 237:f3da66175598 | 2961 | ((__HANDLE_SLAVE__)->Instance = NULL) \ |
mbed_official | 237:f3da66175598 | 2962 | ) \ |
mbed_official | 237:f3da66175598 | 2963 | ) |
mbed_official | 237:f3da66175598 | 2964 | #endif /* STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 2965 | #if defined(STM32F302xC) || defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8) |
mbed_official | 237:f3da66175598 | 2966 | #define __HAL_ADC_MULTI_SLAVE(__HANDLE_MASTER__, __HANDLE_SLAVE__) \ |
mbed_official | 237:f3da66175598 | 2967 | ( ( ((__HANDLE_MASTER__)->Instance == ADC1) \ |
mbed_official | 237:f3da66175598 | 2968 | )? \ |
mbed_official | 237:f3da66175598 | 2969 | ((__HANDLE_SLAVE__)->Instance = ADC2) \ |
mbed_official | 237:f3da66175598 | 2970 | : \ |
mbed_official | 237:f3da66175598 | 2971 | ( NULL ) \ |
mbed_official | 237:f3da66175598 | 2972 | ) |
mbed_official | 237:f3da66175598 | 2973 | #endif /* STM32F302xC || STM32F303x8 || STM32F328xx || STM32F334x8 */ |
mbed_official | 237:f3da66175598 | 2974 | #endif /* STM32F303xC || STM32F358xC || STM32F302xC || STM32F303x8 || STM32F328xx || STM32F334x8 || STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 2975 | |
mbed_official | 237:f3da66175598 | 2976 | |
mbed_official | 237:f3da66175598 | 2977 | #if defined(STM32F373xC) || defined(STM32F378xx) |
mbed_official | 237:f3da66175598 | 2978 | /** |
mbed_official | 237:f3da66175598 | 2979 | * @brief Set ADC number of conversions into regular channel sequence length. |
mbed_official | 237:f3da66175598 | 2980 | * @param _NbrOfConversion_: Regular channel sequence length |
mbed_official | 237:f3da66175598 | 2981 | * @retval None |
mbed_official | 237:f3da66175598 | 2982 | */ |
mbed_official | 237:f3da66175598 | 2983 | #define __HAL_ADC_SQR1_L(_NbrOfConversion_) (((_NbrOfConversion_) - (uint8_t)1) << 20) |
mbed_official | 237:f3da66175598 | 2984 | |
mbed_official | 237:f3da66175598 | 2985 | /** |
mbed_official | 237:f3da66175598 | 2986 | * @brief Set the ADC's sample time for channel numbers between 10 and 18. |
mbed_official | 237:f3da66175598 | 2987 | * @param _SAMPLETIME_: Sample time parameter. |
mbed_official | 237:f3da66175598 | 2988 | * @param _CHANNELNB_: Channel number. |
mbed_official | 237:f3da66175598 | 2989 | * @retval None |
mbed_official | 237:f3da66175598 | 2990 | */ |
mbed_official | 237:f3da66175598 | 2991 | #define __HAL_ADC_SMPR1(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3 * ((_CHANNELNB_) - 10))) |
mbed_official | 237:f3da66175598 | 2992 | |
mbed_official | 237:f3da66175598 | 2993 | /** |
mbed_official | 237:f3da66175598 | 2994 | * @brief Set the ADC's sample time for channel numbers between 0 and 9. |
mbed_official | 237:f3da66175598 | 2995 | * @param _SAMPLETIME_: Sample time parameter. |
mbed_official | 237:f3da66175598 | 2996 | * @param _CHANNELNB_: Channel number. |
mbed_official | 237:f3da66175598 | 2997 | * @retval None |
mbed_official | 237:f3da66175598 | 2998 | */ |
mbed_official | 237:f3da66175598 | 2999 | #define __HAL_ADC_SMPR2(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3 * (_CHANNELNB_))) |
mbed_official | 237:f3da66175598 | 3000 | |
mbed_official | 237:f3da66175598 | 3001 | /** |
mbed_official | 237:f3da66175598 | 3002 | * @brief Set the selected regular channel rank for rank between 1 and 6. |
mbed_official | 237:f3da66175598 | 3003 | * @param _CHANNELNB_: Channel number. |
mbed_official | 237:f3da66175598 | 3004 | * @param _RANKNB_: Rank number. |
mbed_official | 237:f3da66175598 | 3005 | * @retval None |
mbed_official | 237:f3da66175598 | 3006 | */ |
mbed_official | 237:f3da66175598 | 3007 | #define __HAL_ADC_SQR3_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (5 * ((_RANKNB_) - 1))) |
mbed_official | 237:f3da66175598 | 3008 | |
mbed_official | 237:f3da66175598 | 3009 | /** |
mbed_official | 237:f3da66175598 | 3010 | * @brief Set the selected regular channel rank for rank between 7 and 12. |
mbed_official | 237:f3da66175598 | 3011 | * @param _CHANNELNB_: Channel number. |
mbed_official | 237:f3da66175598 | 3012 | * @param _RANKNB_: Rank number. |
mbed_official | 237:f3da66175598 | 3013 | * @retval None |
mbed_official | 237:f3da66175598 | 3014 | */ |
mbed_official | 237:f3da66175598 | 3015 | #define __HAL_ADC_SQR2_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (5 * ((_RANKNB_) - 7))) |
mbed_official | 237:f3da66175598 | 3016 | |
mbed_official | 237:f3da66175598 | 3017 | /** |
mbed_official | 237:f3da66175598 | 3018 | * @brief Set the selected regular channel rank for rank between 13 and 16. |
mbed_official | 237:f3da66175598 | 3019 | * @param _CHANNELNB_: Channel number. |
mbed_official | 237:f3da66175598 | 3020 | * @param _RANKNB_: Rank number. |
mbed_official | 237:f3da66175598 | 3021 | * @retval None |
mbed_official | 237:f3da66175598 | 3022 | */ |
mbed_official | 237:f3da66175598 | 3023 | #define __HAL_ADC_SQR1_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (5 * ((_RANKNB_) - 13))) |
mbed_official | 237:f3da66175598 | 3024 | |
mbed_official | 237:f3da66175598 | 3025 | /** |
mbed_official | 237:f3da66175598 | 3026 | * @brief Set the injected sequence length. |
mbed_official | 237:f3da66175598 | 3027 | * @param _JSQR_JL_: Sequence length. |
mbed_official | 237:f3da66175598 | 3028 | * @retval None |
mbed_official | 237:f3da66175598 | 3029 | */ |
mbed_official | 237:f3da66175598 | 3030 | #define __HAL_ADC_JSQR_JL(_JSQR_JL_) (((_JSQR_JL_) -1) << 20) |
mbed_official | 237:f3da66175598 | 3031 | |
mbed_official | 237:f3da66175598 | 3032 | /** |
mbed_official | 237:f3da66175598 | 3033 | * @brief Set the selected injected Channel rank (channels sequence starting from 4-JL) |
mbed_official | 237:f3da66175598 | 3034 | * @param _CHANNELNB_: Channel number. |
mbed_official | 237:f3da66175598 | 3035 | * @param _RANKNB_: Rank number. |
mbed_official | 237:f3da66175598 | 3036 | * @param _JSQR_JL_: Sequence length. |
mbed_official | 237:f3da66175598 | 3037 | * @retval None |
mbed_official | 237:f3da66175598 | 3038 | */ |
mbed_official | 237:f3da66175598 | 3039 | #define __HAL_ADC_JSQR_RK(_CHANNELNB_, _RANKNB_, _JSQR_JL_) \ |
mbed_official | 237:f3da66175598 | 3040 | ((_CHANNELNB_) << (5 * ((4 - ((_JSQR_JL_) - (_RANKNB_))) - 1))) |
mbed_official | 237:f3da66175598 | 3041 | |
mbed_official | 237:f3da66175598 | 3042 | /** |
mbed_official | 237:f3da66175598 | 3043 | * @brief Enable ADC continuous conversion mode. |
mbed_official | 237:f3da66175598 | 3044 | * @param _CONTINUOUS_MODE_: Continuous mode. |
mbed_official | 237:f3da66175598 | 3045 | * @retval None |
mbed_official | 237:f3da66175598 | 3046 | */ |
mbed_official | 237:f3da66175598 | 3047 | #define __HAL_ADC_CR2_CONTINUOUS(_CONTINUOUS_MODE_) ((_CONTINUOUS_MODE_) << 1) |
mbed_official | 237:f3da66175598 | 3048 | |
mbed_official | 237:f3da66175598 | 3049 | /** |
mbed_official | 237:f3da66175598 | 3050 | * @brief Configures the number of discontinuous conversions for the regular group channels. |
mbed_official | 237:f3da66175598 | 3051 | * @param _NBR_DISCONTINUOUS_CONV_: Number of discontinuous conversions. |
mbed_official | 237:f3da66175598 | 3052 | * @retval None |
mbed_official | 237:f3da66175598 | 3053 | */ |
mbed_official | 237:f3da66175598 | 3054 | #define __HAL_ADC_CR1_DISCONTINUOUS_NUM(_NBR_DISCONTINUOUS_CONV_) (((_NBR_DISCONTINUOUS_CONV_) - 1) << 13) |
mbed_official | 237:f3da66175598 | 3055 | |
mbed_official | 237:f3da66175598 | 3056 | /** |
mbed_official | 237:f3da66175598 | 3057 | * @brief Enable ADC scan mode to convert multiple ranks with sequencer. |
mbed_official | 237:f3da66175598 | 3058 | * @param _SCAN_MODE_: Scan conversion mode. |
mbed_official | 237:f3da66175598 | 3059 | * @retval None |
mbed_official | 237:f3da66175598 | 3060 | */ |
mbed_official | 237:f3da66175598 | 3061 | #define __HAL_ADC_CR1_SCAN(_SCAN_MODE_) \ |
mbed_official | 237:f3da66175598 | 3062 | ( ( (_SCAN_MODE_) == (ADC_SCAN_ENABLE) \ |
mbed_official | 237:f3da66175598 | 3063 | )? (ADC_CR1_SCAN) : (0x00000000) \ |
mbed_official | 237:f3da66175598 | 3064 | ) |
mbed_official | 237:f3da66175598 | 3065 | |
mbed_official | 237:f3da66175598 | 3066 | /** |
mbed_official | 237:f3da66175598 | 3067 | * @brief Calibration factor in differential mode to be set into calibration register |
mbed_official | 237:f3da66175598 | 3068 | * @param _Calibration_Factor_: Calibration factor value |
mbed_official | 237:f3da66175598 | 3069 | * @retval None |
mbed_official | 237:f3da66175598 | 3070 | */ |
mbed_official | 237:f3da66175598 | 3071 | #define __HAL_ADC_CALFACT_DIFF_SET(_Calibration_Factor_) ((_Calibration_Factor_) << 16) |
mbed_official | 237:f3da66175598 | 3072 | |
mbed_official | 237:f3da66175598 | 3073 | /** |
mbed_official | 237:f3da66175598 | 3074 | * @brief Calibration factor in differential mode to be retrieved from calibration register |
mbed_official | 237:f3da66175598 | 3075 | * @param _Calibration_Factor_: Calibration factor value |
mbed_official | 237:f3da66175598 | 3076 | * @retval None |
mbed_official | 237:f3da66175598 | 3077 | */ |
mbed_official | 237:f3da66175598 | 3078 | #define __HAL_ADC_CALFACT_DIFF_GET(_Calibration_Factor_) ((_Calibration_Factor_) >> 16) |
mbed_official | 237:f3da66175598 | 3079 | |
mbed_official | 237:f3da66175598 | 3080 | |
mbed_official | 237:f3da66175598 | 3081 | /** |
mbed_official | 237:f3da66175598 | 3082 | * @brief Get the maximum ADC conversion cycles on all channels. |
mbed_official | 237:f3da66175598 | 3083 | * Returns the selected sampling time + conversion time (12.5 ADC clock cycles) |
mbed_official | 237:f3da66175598 | 3084 | * Approximation of sampling time within 4 ranges, returns the higher value: |
mbed_official | 237:f3da66175598 | 3085 | * below 7.5 cycles {1.5 cycle; 7.5 cycles}, |
mbed_official | 237:f3da66175598 | 3086 | * between 13.5 cycles and 28.5 cycles {13.5 cycles; 28.5 cycles} |
mbed_official | 237:f3da66175598 | 3087 | * between 41.5 cycles and 71.5 cycles {41.5 cycles; 55.5 cycles; 71.5cycles} |
mbed_official | 237:f3da66175598 | 3088 | * equal to 239.5 cycles |
mbed_official | 237:f3da66175598 | 3089 | * Unit: ADC clock cycles |
mbed_official | 237:f3da66175598 | 3090 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 3091 | * @retval ADC conversion cycles on all channels |
mbed_official | 237:f3da66175598 | 3092 | */ |
mbed_official | 237:f3da66175598 | 3093 | #define __HAL_ADC_CONVCYCLES_MAX_RANGE(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 3094 | (( (((__HANDLE__)->Instance->SMPR2 & ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2) == RESET) && \ |
mbed_official | 237:f3da66175598 | 3095 | (((__HANDLE__)->Instance->SMPR1 & ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2) == RESET) ) ? \ |
mbed_official | 237:f3da66175598 | 3096 | \ |
mbed_official | 237:f3da66175598 | 3097 | (( (((__HANDLE__)->Instance->SMPR2 & ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1) == RESET) && \ |
mbed_official | 237:f3da66175598 | 3098 | (((__HANDLE__)->Instance->SMPR1 & ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1) == RESET) ) ? \ |
mbed_official | 237:f3da66175598 | 3099 | ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_7CYCLES5 : ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_28CYCLES5) \ |
mbed_official | 237:f3da66175598 | 3100 | : \ |
mbed_official | 237:f3da66175598 | 3101 | ((((((__HANDLE__)->Instance->SMPR2 & ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1) == RESET) && \ |
mbed_official | 237:f3da66175598 | 3102 | (((__HANDLE__)->Instance->SMPR1 & ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1) == RESET)) || \ |
mbed_official | 237:f3da66175598 | 3103 | ((((__HANDLE__)->Instance->SMPR2 & ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0) == RESET) && \ |
mbed_official | 237:f3da66175598 | 3104 | (((__HANDLE__)->Instance->SMPR1 & ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0) == RESET))) ? \ |
mbed_official | 237:f3da66175598 | 3105 | ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_71CYCLES5 : ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_239CYCLES5) \ |
mbed_official | 237:f3da66175598 | 3106 | ) |
mbed_official | 237:f3da66175598 | 3107 | |
mbed_official | 237:f3da66175598 | 3108 | /** |
mbed_official | 237:f3da66175598 | 3109 | * @brief Get the total ADC clock prescaler (APB2 prescaler x ADC prescaler) |
mbed_official | 237:f3da66175598 | 3110 | * from system clock configuration register. |
mbed_official | 237:f3da66175598 | 3111 | * Approximation within 3 ranges, returns the higher value: |
mbed_official | 237:f3da66175598 | 3112 | * total prescaler minimum: 2 (ADC presc 2, APB2 presc 0) |
mbed_official | 237:f3da66175598 | 3113 | * total prescaler 32 (ADC presc 0 and APB2 presc all, or |
mbed_official | 237:f3da66175598 | 3114 | * ADC presc {4, 6, 8} and APB2 presc {0, 2, 4}) |
mbed_official | 237:f3da66175598 | 3115 | * total prescaler maximum: 128 (ADC presc {4, 6, 8} and APB2 presc {8, 16}) |
mbed_official | 237:f3da66175598 | 3116 | * Unit: none (prescaler factor) |
mbed_official | 237:f3da66175598 | 3117 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 3118 | * @retval ADC and APB2 prescaler factor |
mbed_official | 237:f3da66175598 | 3119 | */ |
mbed_official | 237:f3da66175598 | 3120 | #define __HAL_ADC_CLOCK_PRECSALER_RANGE(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 3121 | (( (RCC->CFGR & (RCC_CFGR_ADCPRE_1 | RCC_CFGR_ADCPRE_0)) == RESET) ? \ |
mbed_official | 237:f3da66175598 | 3122 | (( (RCC->CFGR & RCC_CFGR_PPRE2_2) == RESET) ? 2 : 32 ) \ |
mbed_official | 237:f3da66175598 | 3123 | : \ |
mbed_official | 237:f3da66175598 | 3124 | (( (RCC->CFGR & RCC_CFGR_PPRE2_1) == RESET) ? 32 : 128 ) \ |
mbed_official | 237:f3da66175598 | 3125 | ) |
mbed_official | 237:f3da66175598 | 3126 | |
mbed_official | 237:f3da66175598 | 3127 | /** |
mbed_official | 237:f3da66175598 | 3128 | * @brief Get the ADC clock prescaler from system clock configuration register. |
mbed_official | 237:f3da66175598 | 3129 | * @retval None |
mbed_official | 237:f3da66175598 | 3130 | */ |
mbed_official | 237:f3da66175598 | 3131 | #define __HAL_ADC_GET_CLOCK_PRESCALER() (((RCC->CFGR & RCC_CFGR_ADCPRE) >> 14) +1) |
mbed_official | 237:f3da66175598 | 3132 | |
mbed_official | 237:f3da66175598 | 3133 | /** |
mbed_official | 237:f3da66175598 | 3134 | * @brief Enable the ADC peripheral (if not already enable to not trig a conversion) |
mbed_official | 237:f3da66175598 | 3135 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 3136 | * @retval None |
mbed_official | 237:f3da66175598 | 3137 | */ |
mbed_official | 237:f3da66175598 | 3138 | #define __HAL_ADC_ENABLE(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 3139 | (__HANDLE__)->Instance->CR2 |= ADC_CR2_ADON |
mbed_official | 237:f3da66175598 | 3140 | |
mbed_official | 237:f3da66175598 | 3141 | /** |
mbed_official | 237:f3da66175598 | 3142 | * @brief Disable the ADC peripheral |
mbed_official | 237:f3da66175598 | 3143 | * @param __HANDLE__: ADC handle |
mbed_official | 237:f3da66175598 | 3144 | * @retval None |
mbed_official | 237:f3da66175598 | 3145 | */ |
mbed_official | 237:f3da66175598 | 3146 | #define __HAL_ADC_DISABLE(__HANDLE__) \ |
mbed_official | 237:f3da66175598 | 3147 | (__HANDLE__)->Instance->CR2 &= ~ADC_CR2_ADON |
mbed_official | 237:f3da66175598 | 3148 | |
mbed_official | 237:f3da66175598 | 3149 | #endif /* STM32F373xC || STM32F378xx */ |
mbed_official | 237:f3da66175598 | 3150 | /** |
mbed_official | 237:f3da66175598 | 3151 | * @} |
mbed_official | 237:f3da66175598 | 3152 | */ |
mbed_official | 237:f3da66175598 | 3153 | |
mbed_official | 237:f3da66175598 | 3154 | |
mbed_official | 237:f3da66175598 | 3155 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 3156 | |
mbed_official | 237:f3da66175598 | 3157 | |
mbed_official | 237:f3da66175598 | 3158 | /* Initialization/de-initialization functions *********************************/ |
mbed_official | 237:f3da66175598 | 3159 | |
mbed_official | 237:f3da66175598 | 3160 | /* I/O operation functions ****************************************************/ |
mbed_official | 237:f3da66175598 | 3161 | |
mbed_official | 237:f3da66175598 | 3162 | /* ADC calibration */ |
mbed_official | 237:f3da66175598 | 3163 | #if defined(STM32F303xC) || defined(STM32F358xx) || defined(STM32F302xC) || defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8) || defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 3164 | HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(struct __ADC_HandleTypeDef* hadc, uint32_t SingleDiff); |
mbed_official | 237:f3da66175598 | 3165 | uint32_t HAL_ADCEx_Calibration_GetValue(struct __ADC_HandleTypeDef *hadc, uint32_t SingleDiff); |
mbed_official | 237:f3da66175598 | 3166 | HAL_StatusTypeDef HAL_ADCEx_Calibration_SetValue(struct __ADC_HandleTypeDef *hadc, uint32_t SingleDiff, uint32_t CalibrationFactor); |
mbed_official | 237:f3da66175598 | 3167 | #endif /* STM32F303xC || STM32F358xC || STM32F302xC || STM32F303x8 || STM32F328xx || STM32F334x8 || STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 3168 | #if defined(STM32F373xC) || defined(STM32F378xx) |
mbed_official | 237:f3da66175598 | 3169 | HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(struct __ADC_HandleTypeDef* hadc); |
mbed_official | 237:f3da66175598 | 3170 | #endif /* STM32F373xC || STM32F378xx */ |
mbed_official | 237:f3da66175598 | 3171 | |
mbed_official | 237:f3da66175598 | 3172 | /* Blocking mode: Polling */ |
mbed_official | 237:f3da66175598 | 3173 | HAL_StatusTypeDef HAL_ADCEx_InjectedStart(struct __ADC_HandleTypeDef* hadc); |
mbed_official | 237:f3da66175598 | 3174 | HAL_StatusTypeDef HAL_ADCEx_InjectedStop(struct __ADC_HandleTypeDef* hadc); |
mbed_official | 237:f3da66175598 | 3175 | HAL_StatusTypeDef HAL_ADCEx_InjectedPollForConversion(struct __ADC_HandleTypeDef* hadc, uint32_t Timeout); |
mbed_official | 237:f3da66175598 | 3176 | |
mbed_official | 237:f3da66175598 | 3177 | /* Non-blocking mode: Interruption */ |
mbed_official | 237:f3da66175598 | 3178 | HAL_StatusTypeDef HAL_ADCEx_InjectedStart_IT(struct __ADC_HandleTypeDef* hadc); |
mbed_official | 237:f3da66175598 | 3179 | HAL_StatusTypeDef HAL_ADCEx_InjectedStop_IT(struct __ADC_HandleTypeDef* hadc); |
mbed_official | 237:f3da66175598 | 3180 | |
mbed_official | 237:f3da66175598 | 3181 | #if defined(STM32F303xC) || defined(STM32F358xx) || defined(STM32F302xC) || defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8) || defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 3182 | /* ADC multimode */ |
mbed_official | 237:f3da66175598 | 3183 | HAL_StatusTypeDef HAL_ADCEx_MultiModeStart_DMA(struct __ADC_HandleTypeDef *hadc, uint32_t *pData, uint32_t Length); |
mbed_official | 237:f3da66175598 | 3184 | HAL_StatusTypeDef HAL_ADCEx_MultiModeStop_DMA(struct __ADC_HandleTypeDef *hadc); |
mbed_official | 237:f3da66175598 | 3185 | uint32_t HAL_ADCEx_MultiModeGetValue(struct __ADC_HandleTypeDef *hadc); |
mbed_official | 237:f3da66175598 | 3186 | #endif /* STM32F303xC || STM32F358xC || STM32F302xC || STM32F303x8 || STM32F328xx || STM32F334x8 || STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 3187 | |
mbed_official | 237:f3da66175598 | 3188 | /* ADC retrieve conversion value intended to be used with polling or interruption */ |
mbed_official | 237:f3da66175598 | 3189 | uint32_t HAL_ADCEx_InjectedGetValue(struct __ADC_HandleTypeDef* hadc, uint32_t InjectedRank); |
mbed_official | 237:f3da66175598 | 3190 | |
mbed_official | 237:f3da66175598 | 3191 | /* ADC IRQHandler and Callbacks used in non-blocking modes (Interruption) */ |
mbed_official | 237:f3da66175598 | 3192 | void HAL_ADCEx_InjectedConvCpltCallback(struct __ADC_HandleTypeDef* hadc); |
mbed_official | 237:f3da66175598 | 3193 | #if defined(STM32F303xC) || defined(STM32F358xx) || defined(STM32F302xC) || defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8) || defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 3194 | void HAL_ADCEx_InjectedQueueOverflowCallback(struct __ADC_HandleTypeDef* hadc); |
mbed_official | 237:f3da66175598 | 3195 | #endif /* STM32F303xC || STM32F358xC || STM32F302xC || STM32F303x8 || STM32F328xx || STM32F334x8 || STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 3196 | |
mbed_official | 237:f3da66175598 | 3197 | /* Peripheral Control functions ***********************************************/ |
mbed_official | 237:f3da66175598 | 3198 | HAL_StatusTypeDef HAL_ADCEx_InjectedConfigChannel(struct __ADC_HandleTypeDef* hadc,ADC_InjectionConfTypeDef* sConfigInjected); |
mbed_official | 237:f3da66175598 | 3199 | #if defined(STM32F303xC) || defined(STM32F358xx) || defined(STM32F302xC) || defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8) || defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) |
mbed_official | 237:f3da66175598 | 3200 | HAL_StatusTypeDef HAL_ADCEx_MultiModeConfigChannel(struct __ADC_HandleTypeDef *hadc, ADC_MultiModeTypeDef *multimode); |
mbed_official | 237:f3da66175598 | 3201 | #endif /* STM32F303xC || STM32F358xC || STM32F302xC || STM32F303x8 || STM32F328xx || STM32F334x8 || STM32F301x8 || STM32F318xx || STM32F302x8 */ |
mbed_official | 237:f3da66175598 | 3202 | |
mbed_official | 237:f3da66175598 | 3203 | /** |
mbed_official | 237:f3da66175598 | 3204 | * @} |
mbed_official | 237:f3da66175598 | 3205 | */ |
mbed_official | 237:f3da66175598 | 3206 | |
mbed_official | 237:f3da66175598 | 3207 | /** |
mbed_official | 237:f3da66175598 | 3208 | * @} |
mbed_official | 237:f3da66175598 | 3209 | */ |
mbed_official | 237:f3da66175598 | 3210 | |
mbed_official | 237:f3da66175598 | 3211 | #ifdef __cplusplus |
mbed_official | 237:f3da66175598 | 3212 | } |
mbed_official | 237:f3da66175598 | 3213 | #endif |
mbed_official | 237:f3da66175598 | 3214 | |
mbed_official | 237:f3da66175598 | 3215 | #endif /*__STM32F3xx_ADC_EX_H */ |
mbed_official | 237:f3da66175598 | 3216 | |
mbed_official | 237:f3da66175598 | 3217 | |
mbed_official | 237:f3da66175598 | 3218 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |