annotate Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Inc/stm32f4xx_hal_adc.h @ 45:219943ef9dc0

Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
author Ideenmodellierer
date Sun, 29 Jul 2018 18:07:52 +0200
parents 5f11787b4f42
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @file stm32f4xx_hal_adc.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author MCD Application Team
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @version V1.2.0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 26-December-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @brief Header file of ADC HAL extension module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 * Redistribution and use in source and binary forms, with or without modification,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 * are permitted provided that the following conditions are met:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 * 1. Redistributions of source code must retain the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 * this list of conditions and the following disclaimer.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 * this list of conditions and the following disclaimer in the documentation
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 * and/or other materials provided with the distribution.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 * may be used to endorse or promote products derived from this software
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 * without specific prior written permission.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 /* Define to prevent recursive inclusion -------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 #ifndef __STM32F4xx_ADC_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 #define __STM32F4xx_ADC_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 extern "C" {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 #include "stm32f4xx_hal_def.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 /** @addtogroup STM32F4xx_HAL_Driver
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 /** @addtogroup ADC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 /* Exported types ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 /** @defgroup ADC_Exported_Types ADC Exported Types
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 * @brief HAL State structures definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 typedef enum
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 HAL_ADC_STATE_RESET = 0x00, /*!< ADC not yet initialized or disabled */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 HAL_ADC_STATE_READY = 0x01, /*!< ADC peripheral ready for use */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 HAL_ADC_STATE_BUSY = 0x02, /*!< An internal process is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 HAL_ADC_STATE_BUSY_REG = 0x12, /*!< Regular conversion is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 HAL_ADC_STATE_BUSY_INJ = 0x22, /*!< Injected conversion is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 HAL_ADC_STATE_BUSY_INJ_REG = 0x32, /*!< Injected and regular conversion are ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 HAL_ADC_STATE_TIMEOUT = 0x03, /*!< Timeout state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 HAL_ADC_STATE_ERROR = 0x04, /*!< ADC state error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 HAL_ADC_STATE_EOC = 0x05, /*!< Conversion is completed */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 HAL_ADC_STATE_EOC_REG = 0x15, /*!< Regular conversion is completed */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 HAL_ADC_STATE_EOC_INJ = 0x25, /*!< Injected conversion is completed */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 HAL_ADC_STATE_EOC_INJ_REG = 0x35, /*!< Injected and regular conversion are completed */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 HAL_ADC_STATE_AWD = 0x06 /*!< ADC state analog watchdog */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 }HAL_ADC_StateTypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 * @brief ADC Init structure definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 uint32_t ClockPrescaler; /*!< Select the frequency of the clock to the ADC. The clock is common for
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 all the ADCs.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 This parameter can be a value of @ref ADC_ClockPrescaler */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 uint32_t Resolution; /*!< Configures the ADC resolution dual mode.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 This parameter can be a value of @ref ADC_Resolution */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 uint32_t DataAlign; /*!< Specifies whether the ADC data alignment is left or right.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 This parameter can be a value of @ref ADC_data_align */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 uint32_t ScanConvMode; /*!< Specifies whether the conversion is performed in Scan (multi channels) or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 Single (one channel) mode.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 This parameter can be set to ENABLE or DISABLE */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 uint32_t EOCSelection; /*!< Specifies whether the EOC flag is set
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 at the end of single channel conversion or at the end of all conversions.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 This parameter can be a value of @ref ADC_EOCSelection */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 uint32_t ContinuousConvMode; /*!< Specifies whether the conversion is performed in Continuous or Single mode.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 This parameter can be set to ENABLE or DISABLE. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 uint32_t DMAContinuousRequests; /*!< Specifies whether the DMA requests is performed in Continuous or in Single mode.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 This parameter can be set to ENABLE or DISABLE. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 uint32_t NbrOfConversion; /*!< Specifies the number of ADC conversions that will be done using the sequencer for
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 regular channel group.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 This parameter must be a number between Min_Data = 1 and Max_Data = 16. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 uint32_t DiscontinuousConvMode; /*!< Specifies whether the conversion is performed in Discontinuous or not
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 for regular channels.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 This parameter can be set to ENABLE or DISABLE. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 uint32_t NbrOfDiscConversion; /*!< Specifies the number of ADC discontinuous conversions that will be done
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 using the sequencer for regular channel group.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 This parameter must be a number between Min_Data = 1 and Max_Data = 8. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 uint32_t ExternalTrigConvEdge; /*!< Select the external trigger edge and enable the trigger of a regular group.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 This parameter can be a value of @ref ADC_External_trigger_edge_Regular */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 uint32_t ExternalTrigConv; /*!< Select the external event used to trigger the start of conversion of a regular group.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 This parameter can be a value of @ref ADC_External_trigger_Source_Regular */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 }ADC_InitTypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 * @brief ADC handle Structure definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 ADC_TypeDef *Instance; /*!< Register base address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 ADC_InitTypeDef Init; /*!< ADC required parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 __IO uint32_t NbrOfCurrentConversionRank; /*!< ADC number of current conversion rank */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 DMA_HandleTypeDef *DMA_Handle; /*!< Pointer DMA Handler */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 HAL_LockTypeDef Lock; /*!< ADC locking object */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 __IO HAL_ADC_StateTypeDef State; /*!< ADC communication state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 __IO uint32_t ErrorCode; /*!< ADC Error code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 }ADC_HandleTypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 * @brief ADC Configuration regular Channel structure definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 uint32_t Channel; /*!< The ADC channel to configure.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 This parameter can be a value of @ref ADC_channels */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 uint32_t Rank; /*!< The rank in the regular group sequencer.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 This parameter must be a number between Min_Data = 1 and Max_Data = 16 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 uint32_t SamplingTime; /*!< The sample time value to be set for the selected channel.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 This parameter can be a value of @ref ADC_sampling_times */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 uint32_t Offset; /*!< Reserved for future use, can be set to 0 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 }ADC_ChannelConfTypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 * @brief ADC Configuration multi-mode structure definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 uint32_t WatchdogMode; /*!< Configures the ADC analog watchdog mode.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 This parameter can be a value of @ref ADC_analog_watchdog_selection */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 uint32_t HighThreshold; /*!< Configures the ADC analog watchdog High threshold value.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 This parameter must be a 12-bit value. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 uint32_t LowThreshold; /*!< Configures the ADC analog watchdog High threshold value.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 This parameter must be a 12-bit value. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 uint32_t Channel; /*!< Configures ADC channel for the analog watchdog.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 This parameter has an effect only if watchdog mode is configured on single channel
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 This parameter can be a value of @ref ADC_channels */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 uint32_t ITMode; /*!< Specifies whether the analog watchdog is configured
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 is interrupt mode or in polling mode.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 This parameter can be set to ENABLE or DISABLE */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 uint32_t WatchdogNumber; /*!< Reserved for future use, can be set to 0 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 }ADC_AnalogWDGConfTypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 /* Exported constants --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 /** @defgroup ADC_Exported_Constants ADC Exported Constants
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 /** @defgroup ADC_Error_Code ADC Error Code
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 #define HAL_ADC_ERROR_NONE ((uint32_t)0x00) /*!< No error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 #define HAL_ADC_ERROR_OVR ((uint32_t)0x01) /*!< OVR error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 #define HAL_ADC_ERROR_DMA ((uint32_t)0x02) /*!< DMA transfer error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 /** @defgroup ADC_ClockPrescaler ADC Clock Prescaler
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 #define ADC_CLOCKPRESCALER_PCLK_DIV2 ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 #define ADC_CLOCKPRESCALER_PCLK_DIV4 ((uint32_t)ADC_CCR_ADCPRE_0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 #define ADC_CLOCKPRESCALER_PCLK_DIV6 ((uint32_t)ADC_CCR_ADCPRE_1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 #define ADC_CLOCKPRESCALER_PCLK_DIV8 ((uint32_t)ADC_CCR_ADCPRE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 /** @defgroup ADC_delay_between_2_sampling_phases ADC Delay Between 2 Sampling Phases
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 #define ADC_TWOSAMPLINGDELAY_5CYCLES ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 #define ADC_TWOSAMPLINGDELAY_6CYCLES ((uint32_t)ADC_CCR_DELAY_0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 #define ADC_TWOSAMPLINGDELAY_7CYCLES ((uint32_t)ADC_CCR_DELAY_1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 #define ADC_TWOSAMPLINGDELAY_8CYCLES ((uint32_t)(ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 #define ADC_TWOSAMPLINGDELAY_9CYCLES ((uint32_t)ADC_CCR_DELAY_2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 #define ADC_TWOSAMPLINGDELAY_10CYCLES ((uint32_t)(ADC_CCR_DELAY_2 | ADC_CCR_DELAY_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 #define ADC_TWOSAMPLINGDELAY_11CYCLES ((uint32_t)(ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 #define ADC_TWOSAMPLINGDELAY_12CYCLES ((uint32_t)(ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 #define ADC_TWOSAMPLINGDELAY_13CYCLES ((uint32_t)ADC_CCR_DELAY_3)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 #define ADC_TWOSAMPLINGDELAY_14CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 #define ADC_TWOSAMPLINGDELAY_15CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 #define ADC_TWOSAMPLINGDELAY_16CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 #define ADC_TWOSAMPLINGDELAY_17CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 #define ADC_TWOSAMPLINGDELAY_18CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2 | ADC_CCR_DELAY_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 #define ADC_TWOSAMPLINGDELAY_19CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 #define ADC_TWOSAMPLINGDELAY_20CYCLES ((uint32_t)ADC_CCR_DELAY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 /** @defgroup ADC_Resolution ADC Resolution
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 #define ADC_RESOLUTION_12B ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 #define ADC_RESOLUTION_10B ((uint32_t)ADC_CR1_RES_0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 #define ADC_RESOLUTION_8B ((uint32_t)ADC_CR1_RES_1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 #define ADC_RESOLUTION_6B ((uint32_t)ADC_CR1_RES)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 /** @defgroup ADC_External_trigger_edge_Regular ADC External Trigger Edge Regular
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 #define ADC_EXTERNALTRIGCONVEDGE_NONE ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 #define ADC_EXTERNALTRIGCONVEDGE_RISING ((uint32_t)ADC_CR2_EXTEN_0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 #define ADC_EXTERNALTRIGCONVEDGE_FALLING ((uint32_t)ADC_CR2_EXTEN_1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 #define ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING ((uint32_t)ADC_CR2_EXTEN)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 /** @defgroup ADC_External_trigger_Source_Regular ADC External Trigger Source Regular
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 #define ADC_EXTERNALTRIGCONV_T1_CC1 ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 #define ADC_EXTERNALTRIGCONV_T1_CC2 ((uint32_t)ADC_CR2_EXTSEL_0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 #define ADC_EXTERNALTRIGCONV_T1_CC3 ((uint32_t)ADC_CR2_EXTSEL_1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 #define ADC_EXTERNALTRIGCONV_T2_CC2 ((uint32_t)(ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 #define ADC_EXTERNALTRIGCONV_T2_CC3 ((uint32_t)ADC_CR2_EXTSEL_2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 #define ADC_EXTERNALTRIGCONV_T2_CC4 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 #define ADC_EXTERNALTRIGCONV_T2_TRGO ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 #define ADC_EXTERNALTRIGCONV_T3_CC1 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 #define ADC_EXTERNALTRIGCONV_T3_TRGO ((uint32_t)ADC_CR2_EXTSEL_3)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 #define ADC_EXTERNALTRIGCONV_T4_CC4 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 #define ADC_EXTERNALTRIGCONV_T5_CC1 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 #define ADC_EXTERNALTRIGCONV_T5_CC2 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 #define ADC_EXTERNALTRIGCONV_T5_CC3 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 #define ADC_EXTERNALTRIGCONV_T8_CC1 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 #define ADC_EXTERNALTRIGCONV_T8_TRGO ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 #define ADC_EXTERNALTRIGCONV_Ext_IT11 ((uint32_t)ADC_CR2_EXTSEL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 /** @defgroup ADC_data_align ADC Data Align
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 #define ADC_DATAALIGN_RIGHT ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 #define ADC_DATAALIGN_LEFT ((uint32_t)ADC_CR2_ALIGN)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 /** @defgroup ADC_channels ADC Common Channels
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 #define ADC_CHANNEL_0 ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 #define ADC_CHANNEL_1 ((uint32_t)ADC_CR1_AWDCH_0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 #define ADC_CHANNEL_2 ((uint32_t)ADC_CR1_AWDCH_1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 #define ADC_CHANNEL_3 ((uint32_t)(ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 #define ADC_CHANNEL_4 ((uint32_t)ADC_CR1_AWDCH_2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 #define ADC_CHANNEL_5 ((uint32_t)(ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 #define ADC_CHANNEL_6 ((uint32_t)(ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 #define ADC_CHANNEL_7 ((uint32_t)(ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 #define ADC_CHANNEL_8 ((uint32_t)ADC_CR1_AWDCH_3)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 #define ADC_CHANNEL_9 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 #define ADC_CHANNEL_10 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 #define ADC_CHANNEL_11 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 #define ADC_CHANNEL_12 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 #define ADC_CHANNEL_13 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298 #define ADC_CHANNEL_14 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 #define ADC_CHANNEL_15 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300 #define ADC_CHANNEL_16 ((uint32_t)ADC_CR1_AWDCH_4)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 #define ADC_CHANNEL_17 ((uint32_t)(ADC_CR1_AWDCH_4 | ADC_CR1_AWDCH_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 #define ADC_CHANNEL_18 ((uint32_t)(ADC_CR1_AWDCH_4 | ADC_CR1_AWDCH_1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 #define ADC_CHANNEL_VREFINT ((uint32_t)ADC_CHANNEL_17)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 #define ADC_CHANNEL_VBAT ((uint32_t)ADC_CHANNEL_18)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 /** @defgroup ADC_sampling_times ADC Sampling Times
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 #define ADC_SAMPLETIME_3CYCLES ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 #define ADC_SAMPLETIME_15CYCLES ((uint32_t)ADC_SMPR1_SMP10_0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 #define ADC_SAMPLETIME_28CYCLES ((uint32_t)ADC_SMPR1_SMP10_1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 #define ADC_SAMPLETIME_56CYCLES ((uint32_t)(ADC_SMPR1_SMP10_1 | ADC_SMPR1_SMP10_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 #define ADC_SAMPLETIME_84CYCLES ((uint32_t)ADC_SMPR1_SMP10_2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 #define ADC_SAMPLETIME_112CYCLES ((uint32_t)(ADC_SMPR1_SMP10_2 | ADC_SMPR1_SMP10_0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 #define ADC_SAMPLETIME_144CYCLES ((uint32_t)(ADC_SMPR1_SMP10_2 | ADC_SMPR1_SMP10_1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 #define ADC_SAMPLETIME_480CYCLES ((uint32_t)ADC_SMPR1_SMP10)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 /** @defgroup ADC_EOCSelection ADC EOC Selection
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 #define ADC_EOC_SEQ_CONV ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 #define ADC_EOC_SINGLE_CONV ((uint32_t)0x00000001)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 #define ADC_EOC_SINGLE_SEQ_CONV ((uint32_t)0x00000002) /*!< reserved for future use */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 /** @defgroup ADC_Event_type ADC Event Type
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 #define ADC_AWD_EVENT ((uint32_t)ADC_FLAG_AWD)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 #define ADC_OVR_EVENT ((uint32_t)ADC_FLAG_OVR)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 /** @defgroup ADC_analog_watchdog_selection ADC Analog Watchdog Selection
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 #define ADC_ANALOGWATCHDOG_SINGLE_REG ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 #define ADC_ANALOGWATCHDOG_SINGLE_INJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_JAWDEN))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 #define ADC_ANALOGWATCHDOG_SINGLE_REGINJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN | ADC_CR1_JAWDEN))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 #define ADC_ANALOGWATCHDOG_ALL_REG ((uint32_t)ADC_CR1_AWDEN)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351 #define ADC_ANALOGWATCHDOG_ALL_INJEC ((uint32_t)ADC_CR1_JAWDEN)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 #define ADC_ANALOGWATCHDOG_ALL_REGINJEC ((uint32_t)(ADC_CR1_AWDEN | ADC_CR1_JAWDEN))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 #define ADC_ANALOGWATCHDOG_NONE ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 /** @defgroup ADC_interrupts_definition ADC Interrupts Definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 #define ADC_IT_EOC ((uint32_t)ADC_CR1_EOCIE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 #define ADC_IT_AWD ((uint32_t)ADC_CR1_AWDIE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 #define ADC_IT_JEOC ((uint32_t)ADC_CR1_JEOCIE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 #define ADC_IT_OVR ((uint32_t)ADC_CR1_OVRIE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 /** @defgroup ADC_flags_definition ADC Flags Definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 #define ADC_FLAG_AWD ((uint32_t)ADC_SR_AWD)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 #define ADC_FLAG_EOC ((uint32_t)ADC_SR_EOC)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 #define ADC_FLAG_JEOC ((uint32_t)ADC_SR_JEOC)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 #define ADC_FLAG_JSTRT ((uint32_t)ADC_SR_JSTRT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 #define ADC_FLAG_STRT ((uint32_t)ADC_SR_STRT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 #define ADC_FLAG_OVR ((uint32_t)ADC_SR_OVR)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 /** @defgroup ADC_channels_type ADC Channels Type
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 #define ADC_ALL_CHANNELS ((uint32_t)0x00000001)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 #define ADC_REGULAR_CHANNELS ((uint32_t)0x00000002) /*!< reserved for future use */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 #define ADC_INJECTED_CHANNELS ((uint32_t)0x00000003) /*!< reserved for future use */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396 /* Exported macro ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 /** @defgroup ADC_Exported_Macros ADC Exported Macros
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 /** @brief Reset ADC handle state
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402 * @param __HANDLE__: ADC handle
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405 #define __HAL_ADC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_ADC_STATE_RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408 * @brief Enable the ADC peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 * @param __HANDLE__: ADC handle
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 #define __HAL_ADC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR2 |= ADC_CR2_ADON)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 * @brief Disable the ADC peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416 * @param __HANDLE__: ADC handle
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 #define __HAL_ADC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR2 &= ~ADC_CR2_ADON)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422 * @brief Enable the ADC end of conversion interrupt.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 * @param __HANDLE__: specifies the ADC Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424 * @param __INTERRUPT__: ADC Interrupt.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427 #define __HAL_ADC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR1) |= (__INTERRUPT__))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430 * @brief Disable the ADC end of conversion interrupt.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431 * @param __HANDLE__: specifies the ADC Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432 * @param __INTERRUPT__: ADC interrupt.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 #define __HAL_ADC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR1) &= ~(__INTERRUPT__))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 /** @brief Check if the specified ADC interrupt source is enabled or disabled.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 * @param __HANDLE__: specifies the ADC Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439 * @param __INTERRUPT__: specifies the ADC interrupt source to check.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440 * @retval The new state of __IT__ (TRUE or FALSE).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442 #define __HAL_ADC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445 * @brief Clear the ADC's pending flags.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446 * @param __HANDLE__: specifies the ADC Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447 * @param __FLAG__: ADC flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450 #define __HAL_ADC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453 * @brief Get the selected ADC's flag status.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
454 * @param __HANDLE__: specifies the ADC Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455 * @param __FLAG__: ADC flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458 #define __HAL_ADC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464 /* Include ADC HAL Extension module */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465 #include "stm32f4xx_hal_adc_ex.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468 /** @addtogroup ADC_Exported_Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472 /** @addtogroup ADC_Exported_Functions_Group1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475 /* Initialization/de-initialization functions ***********************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476 HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef* hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477 HAL_StatusTypeDef HAL_ADC_DeInit(ADC_HandleTypeDef *hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478 void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479 void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484 /** @addtogroup ADC_Exported_Functions_Group2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 /* I/O operation functions ******************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488 HAL_StatusTypeDef HAL_ADC_Start(ADC_HandleTypeDef* hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489 HAL_StatusTypeDef HAL_ADC_Stop(ADC_HandleTypeDef* hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
490 HAL_StatusTypeDef HAL_ADC_PollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492 HAL_StatusTypeDef HAL_ADC_PollForEvent(ADC_HandleTypeDef* hadc, uint32_t EventType, uint32_t Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
494 HAL_StatusTypeDef HAL_ADC_Start_IT(ADC_HandleTypeDef* hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
495 HAL_StatusTypeDef HAL_ADC_Stop_IT(ADC_HandleTypeDef* hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
496
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
497 void HAL_ADC_IRQHandler(ADC_HandleTypeDef* hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
498
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
499 HAL_StatusTypeDef HAL_ADC_Start_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, uint32_t Length);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
500 HAL_StatusTypeDef HAL_ADC_Stop_DMA(ADC_HandleTypeDef* hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
501
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
502 uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef* hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
503
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
504 void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
505 void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
506 void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef* hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
507 void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
508 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
509 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
510 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
511
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
512 /** @addtogroup ADC_Exported_Functions_Group3
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
513 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
514 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
515 /* Peripheral Control functions *************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
516 HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef* hadc, ADC_ChannelConfTypeDef* sConfig);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
517 HAL_StatusTypeDef HAL_ADC_AnalogWDGConfig(ADC_HandleTypeDef* hadc, ADC_AnalogWDGConfTypeDef* AnalogWDGConfig);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
519 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
520 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
521
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
522 /** @addtogroup ADC_Exported_Functions_Group4
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
523 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525 /* Peripheral State functions ***************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
526 HAL_ADC_StateTypeDef HAL_ADC_GetState(ADC_HandleTypeDef* hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
527 uint32_t HAL_ADC_GetError(ADC_HandleTypeDef *hadc);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
528 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
529 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
530 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
531
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
532 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
533 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
534 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
536 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
537 /* Private constants ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
538 /** @defgroup ADC_Private_Constants ADC Private Constants
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
539 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
540 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
541
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
542 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
543 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
544 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
545
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
546 /* Private macros ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
547 /** @defgroup ADC_Private_Macros ADC Private Macros
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
548 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
549 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550 #define IS_ADC_CLOCKPRESCALER(ADC_CLOCK) (((ADC_CLOCK) == ADC_CLOCKPRESCALER_PCLK_DIV2) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551 ((ADC_CLOCK) == ADC_CLOCKPRESCALER_PCLK_DIV4) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552 ((ADC_CLOCK) == ADC_CLOCKPRESCALER_PCLK_DIV6) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553 ((ADC_CLOCK) == ADC_CLOCKPRESCALER_PCLK_DIV8))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554 #define IS_ADC_SAMPLING_DELAY(DELAY) (((DELAY) == ADC_TWOSAMPLINGDELAY_5CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
555 ((DELAY) == ADC_TWOSAMPLINGDELAY_6CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
556 ((DELAY) == ADC_TWOSAMPLINGDELAY_7CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
557 ((DELAY) == ADC_TWOSAMPLINGDELAY_8CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
558 ((DELAY) == ADC_TWOSAMPLINGDELAY_9CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559 ((DELAY) == ADC_TWOSAMPLINGDELAY_10CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560 ((DELAY) == ADC_TWOSAMPLINGDELAY_11CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
561 ((DELAY) == ADC_TWOSAMPLINGDELAY_12CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562 ((DELAY) == ADC_TWOSAMPLINGDELAY_13CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563 ((DELAY) == ADC_TWOSAMPLINGDELAY_14CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
564 ((DELAY) == ADC_TWOSAMPLINGDELAY_15CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565 ((DELAY) == ADC_TWOSAMPLINGDELAY_16CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
566 ((DELAY) == ADC_TWOSAMPLINGDELAY_17CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567 ((DELAY) == ADC_TWOSAMPLINGDELAY_18CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568 ((DELAY) == ADC_TWOSAMPLINGDELAY_19CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569 ((DELAY) == ADC_TWOSAMPLINGDELAY_20CYCLES))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570 #define IS_ADC_RESOLUTION(RESOLUTION) (((RESOLUTION) == ADC_RESOLUTION_12B) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
571 ((RESOLUTION) == ADC_RESOLUTION_10B) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
572 ((RESOLUTION) == ADC_RESOLUTION_8B) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
573 ((RESOLUTION) == ADC_RESOLUTION_6B))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
574 #define IS_ADC_EXT_TRIG_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGCONVEDGE_NONE) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
575 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISING) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
576 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_FALLING) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
577 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
578 #define IS_ADC_EXT_TRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
579 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
580 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
581 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
582 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC3) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
583 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC4) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
584 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
585 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC1) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
586 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
587 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
588 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC1) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
589 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC2) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
590 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC3) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
591 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_CC1) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
592 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
593 ((REGTRIG) == ADC_EXTERNALTRIGCONV_Ext_IT11))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
594 #define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DATAALIGN_RIGHT) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
595 ((ALIGN) == ADC_DATAALIGN_LEFT))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
596 #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) == ADC_CHANNEL_0) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
597 ((CHANNEL) == ADC_CHANNEL_1) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
598 ((CHANNEL) == ADC_CHANNEL_2) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
599 ((CHANNEL) == ADC_CHANNEL_3) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
600 ((CHANNEL) == ADC_CHANNEL_4) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
601 ((CHANNEL) == ADC_CHANNEL_5) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
602 ((CHANNEL) == ADC_CHANNEL_6) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
603 ((CHANNEL) == ADC_CHANNEL_7) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
604 ((CHANNEL) == ADC_CHANNEL_8) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
605 ((CHANNEL) == ADC_CHANNEL_9) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
606 ((CHANNEL) == ADC_CHANNEL_10) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
607 ((CHANNEL) == ADC_CHANNEL_11) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
608 ((CHANNEL) == ADC_CHANNEL_12) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
609 ((CHANNEL) == ADC_CHANNEL_13) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
610 ((CHANNEL) == ADC_CHANNEL_14) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
611 ((CHANNEL) == ADC_CHANNEL_15) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
612 ((CHANNEL) == ADC_CHANNEL_16) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
613 ((CHANNEL) == ADC_CHANNEL_17) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
614 ((CHANNEL) == ADC_CHANNEL_18))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
615 #define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SAMPLETIME_3CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
616 ((TIME) == ADC_SAMPLETIME_15CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
617 ((TIME) == ADC_SAMPLETIME_28CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
618 ((TIME) == ADC_SAMPLETIME_56CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
619 ((TIME) == ADC_SAMPLETIME_84CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
620 ((TIME) == ADC_SAMPLETIME_112CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
621 ((TIME) == ADC_SAMPLETIME_144CYCLES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
622 ((TIME) == ADC_SAMPLETIME_480CYCLES))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
623 #define IS_ADC_EOCSelection(EOCSelection) (((EOCSelection) == ADC_EOC_SINGLE_CONV) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
624 ((EOCSelection) == ADC_EOC_SEQ_CONV) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
625 ((EOCSelection) == ADC_EOC_SINGLE_SEQ_CONV))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
626 #define IS_ADC_EVENT_TYPE(EVENT) (((EVENT) == ADC_AWD_EVENT) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
627 ((EVENT) == ADC_OVR_EVENT))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
628 #define IS_ADC_ANALOG_WATCHDOG(WATCHDOG) (((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REG) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
629 ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_INJEC) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
630 ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REGINJEC) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
631 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REG) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
632 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_INJEC) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
633 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REGINJEC) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
634 ((WATCHDOG) == ADC_ANALOGWATCHDOG_NONE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
635 #define IS_ADC_CHANNELS_TYPE(CHANNEL_TYPE) (((CHANNEL_TYPE) == ADC_ALL_CHANNELS) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
636 ((CHANNEL_TYPE) == ADC_REGULAR_CHANNELS) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
637 ((CHANNEL_TYPE) == ADC_INJECTED_CHANNELS))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
638 #define IS_ADC_THRESHOLD(THRESHOLD) ((THRESHOLD) <= ((uint32_t)0xFFF))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
639
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
640 #define IS_ADC_REGULAR_LENGTH(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)16)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
641 #define IS_ADC_REGULAR_RANK(RANK) (((RANK) >= ((uint32_t)1)) && ((RANK) <= ((uint32_t)16)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
642 #define IS_ADC_REGULAR_DISC_NUMBER(NUMBER) (((NUMBER) >= ((uint32_t)1)) && ((NUMBER) <= ((uint32_t)8)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
643 #define IS_ADC_RANGE(RESOLUTION, ADC_VALUE) \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
644 ((((RESOLUTION) == ADC_RESOLUTION_12B) && ((ADC_VALUE) <= ((uint32_t)0x0FFF))) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
645 (((RESOLUTION) == ADC_RESOLUTION_10B) && ((ADC_VALUE) <= ((uint32_t)0x03FF))) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
646 (((RESOLUTION) == ADC_RESOLUTION_8B) && ((ADC_VALUE) <= ((uint32_t)0x00FF))) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
647 (((RESOLUTION) == ADC_RESOLUTION_6B) && ((ADC_VALUE) <= ((uint32_t)0x003F))))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
648
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
649 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
650 * @brief Set ADC Regular channel sequence length.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
651 * @param _NbrOfConversion_: Regular channel sequence length.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
652 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
653 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
654 #define ADC_SQR1(_NbrOfConversion_) (((_NbrOfConversion_) - (uint8_t)1) << 20)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
655
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
656 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
657 * @brief Set the ADC's sample time for channel numbers between 10 and 18.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
658 * @param _SAMPLETIME_: Sample time parameter.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
659 * @param _CHANNELNB_: Channel number.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
660 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
661 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
662 #define ADC_SMPR1(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3 * (((uint32_t)((uint16_t)(_CHANNELNB_))) - 10)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
663
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
664 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
665 * @brief Set the ADC's sample time for channel numbers between 0 and 9.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
666 * @param _SAMPLETIME_: Sample time parameter.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
667 * @param _CHANNELNB_: Channel number.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
668 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
669 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
670 #define ADC_SMPR2(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3 * ((uint32_t)((uint16_t)(_CHANNELNB_)))))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
671
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
672 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
673 * @brief Set the selected regular channel rank for rank between 1 and 6.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
674 * @param _CHANNELNB_: Channel number.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
675 * @param _RANKNB_: Rank number.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
676 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
677 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
678 #define ADC_SQR3_RK(_CHANNELNB_, _RANKNB_) (((uint32_t)((uint16_t)(_CHANNELNB_))) << (5 * ((_RANKNB_) - 1)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
679
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
680 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
681 * @brief Set the selected regular channel rank for rank between 7 and 12.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
682 * @param _CHANNELNB_: Channel number.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
683 * @param _RANKNB_: Rank number.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
684 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
685 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
686 #define ADC_SQR2_RK(_CHANNELNB_, _RANKNB_) (((uint32_t)((uint16_t)(_CHANNELNB_))) << (5 * ((_RANKNB_) - 7)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
687
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
688 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
689 * @brief Set the selected regular channel rank for rank between 13 and 16.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
690 * @param _CHANNELNB_: Channel number.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
691 * @param _RANKNB_: Rank number.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
692 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
693 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
694 #define ADC_SQR1_RK(_CHANNELNB_, _RANKNB_) (((uint32_t)((uint16_t)(_CHANNELNB_))) << (5 * ((_RANKNB_) - 13)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
695
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
696 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
697 * @brief Enable ADC continuous conversion mode.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
698 * @param _CONTINUOUS_MODE_: Continuous mode.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
699 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
700 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
701 #define ADC_CR2_CONTINUOUS(_CONTINUOUS_MODE_) ((_CONTINUOUS_MODE_) << 1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
702
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
703 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
704 * @brief Configures the number of discontinuous conversions for the regular group channels.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
705 * @param _NBR_DISCONTINUOUSCONV_: Number of discontinuous conversions.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
706 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
707 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
708 #define ADC_CR1_DISCONTINUOUS(_NBR_DISCONTINUOUSCONV_) (((_NBR_DISCONTINUOUSCONV_) - 1) << 13)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
709
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
710 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
711 * @brief Enable ADC scan mode.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
712 * @param _SCANCONV_MODE_: Scan conversion mode.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
713 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
714 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
715 #define ADC_CR1_SCANCONV(_SCANCONV_MODE_) ((_SCANCONV_MODE_) << 8)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
716
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
717 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
718 * @brief Enable the ADC end of conversion selection.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
719 * @param _EOCSelection_MODE_: End of conversion selection mode.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
720 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
721 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
722 #define ADC_CR2_EOCSelection(_EOCSelection_MODE_) ((_EOCSelection_MODE_) << 10)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
723
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
724 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
725 * @brief Enable the ADC DMA continuous request.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
726 * @param _DMAContReq_MODE_: DMA continuous request mode.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
727 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
728 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
729 #define ADC_CR2_DMAContReq(_DMAContReq_MODE_) ((_DMAContReq_MODE_) << 9)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
730
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
731 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
732 * @brief Return resolution bits in CR1 register.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
733 * @param __HANDLE__: ADC handle
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
734 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
735 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
736 #define ADC_GET_RESOLUTION(__HANDLE__) (((__HANDLE__)->Instance->CR1) & ADC_CR1_RES)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
737
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
738 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
739 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
740 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
741
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
742 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
743 /** @defgroup ADC_Private_Functions ADC Private Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
744 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
745 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
746
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
747 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
748 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
749 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
750
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
751 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
752 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
753 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
754
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
755 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
756 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
757 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
758
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
759 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
760 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
761 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
762
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
763 #endif /*__STM32F4xx_ADC_H */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
764
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
765
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
766 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/