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

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
100:cbbeb26dbd92
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 100:cbbeb26dbd92 1 /**
Kojto 100:cbbeb26dbd92 2 ******************************************************************************
Kojto 100:cbbeb26dbd92 3 * @file stm32f3xx_hal_adc.h
Kojto 100:cbbeb26dbd92 4 * @author MCD Application Team
Kojto 100:cbbeb26dbd92 5 * @version V1.1.0
Kojto 100:cbbeb26dbd92 6 * @date 12-Sept-2014
Kojto 100:cbbeb26dbd92 7 * @brief Header file containing functions prototypes of ADC HAL library.
Kojto 100:cbbeb26dbd92 8 ******************************************************************************
Kojto 100:cbbeb26dbd92 9 * @attention
Kojto 100:cbbeb26dbd92 10 *
Kojto 100:cbbeb26dbd92 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Kojto 100:cbbeb26dbd92 12 *
Kojto 100:cbbeb26dbd92 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 100:cbbeb26dbd92 14 * are permitted provided that the following conditions are met:
Kojto 100:cbbeb26dbd92 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 100:cbbeb26dbd92 16 * this list of conditions and the following disclaimer.
Kojto 100:cbbeb26dbd92 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 100:cbbeb26dbd92 18 * this list of conditions and the following disclaimer in the documentation
Kojto 100:cbbeb26dbd92 19 * and/or other materials provided with the distribution.
Kojto 100:cbbeb26dbd92 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 100:cbbeb26dbd92 21 * may be used to endorse or promote products derived from this software
Kojto 100:cbbeb26dbd92 22 * without specific prior written permission.
Kojto 100:cbbeb26dbd92 23 *
Kojto 100:cbbeb26dbd92 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 100:cbbeb26dbd92 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 100:cbbeb26dbd92 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 100:cbbeb26dbd92 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 100:cbbeb26dbd92 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 100:cbbeb26dbd92 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 100:cbbeb26dbd92 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 100:cbbeb26dbd92 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 100:cbbeb26dbd92 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 100:cbbeb26dbd92 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 100:cbbeb26dbd92 34 *
Kojto 100:cbbeb26dbd92 35 ******************************************************************************
Kojto 100:cbbeb26dbd92 36 */
Kojto 100:cbbeb26dbd92 37
Kojto 100:cbbeb26dbd92 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 100:cbbeb26dbd92 39 #ifndef __STM32F3xx_ADC_H
Kojto 100:cbbeb26dbd92 40 #define __STM32F3xx_ADC_H
Kojto 100:cbbeb26dbd92 41
Kojto 100:cbbeb26dbd92 42 #ifdef __cplusplus
Kojto 100:cbbeb26dbd92 43 extern "C" {
Kojto 100:cbbeb26dbd92 44 #endif
Kojto 100:cbbeb26dbd92 45
Kojto 100:cbbeb26dbd92 46 /* Includes ------------------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 47 #include "stm32f3xx_hal_def.h"
Kojto 100:cbbeb26dbd92 48 #include "stm32f3xx_hal_adc_ex.h"
Kojto 100:cbbeb26dbd92 49
Kojto 100:cbbeb26dbd92 50 /** @addtogroup STM32F3xx_HAL_Driver
Kojto 100:cbbeb26dbd92 51 * @{
Kojto 100:cbbeb26dbd92 52 */
Kojto 100:cbbeb26dbd92 53
Kojto 100:cbbeb26dbd92 54 /** @addtogroup ADC
Kojto 100:cbbeb26dbd92 55 * @{
Kojto 100:cbbeb26dbd92 56 */
Kojto 100:cbbeb26dbd92 57
Kojto 100:cbbeb26dbd92 58 /* Exported types ------------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 59 /** @defgroup ADC_Exported_Types ADC Exported Types
Kojto 100:cbbeb26dbd92 60 * @{
Kojto 100:cbbeb26dbd92 61 */
Kojto 100:cbbeb26dbd92 62 /**
Kojto 100:cbbeb26dbd92 63 * @brief HAL ADC state machine: ADC States structure definition
Kojto 100:cbbeb26dbd92 64 */
Kojto 100:cbbeb26dbd92 65 typedef enum
Kojto 100:cbbeb26dbd92 66 {
Kojto 100:cbbeb26dbd92 67 HAL_ADC_STATE_RESET = 0x00, /*!< ADC not yet initialized or disabled */
Kojto 100:cbbeb26dbd92 68 HAL_ADC_STATE_READY = 0x01, /*!< ADC peripheral ready for use */
Kojto 100:cbbeb26dbd92 69 HAL_ADC_STATE_BUSY = 0x02, /*!< An internal process is ongoing */
Kojto 100:cbbeb26dbd92 70 HAL_ADC_STATE_BUSY_REG = 0x12, /*!< Regular conversion is ongoing */
Kojto 100:cbbeb26dbd92 71 HAL_ADC_STATE_BUSY_INJ = 0x22, /*!< Injected conversion is ongoing */
Kojto 100:cbbeb26dbd92 72 HAL_ADC_STATE_BUSY_INJ_REG = 0x32, /*!< Injected and regular conversion are ongoing */
Kojto 100:cbbeb26dbd92 73 HAL_ADC_STATE_TIMEOUT = 0x03, /*!< Timeout state */
Kojto 100:cbbeb26dbd92 74 HAL_ADC_STATE_ERROR = 0x04, /*!< ADC state error */
Kojto 100:cbbeb26dbd92 75 HAL_ADC_STATE_EOC = 0x05, /*!< Conversion is completed */
Kojto 100:cbbeb26dbd92 76 HAL_ADC_STATE_EOC_REG = 0x15, /*!< Regular conversion is completed */
Kojto 100:cbbeb26dbd92 77 HAL_ADC_STATE_EOC_INJ = 0x25, /*!< Injected conversion is completed */
Kojto 100:cbbeb26dbd92 78 HAL_ADC_STATE_EOC_INJ_REG = 0x35, /*!< Injected and regular conversion are completed */
Kojto 100:cbbeb26dbd92 79 HAL_ADC_STATE_AWD = 0x06, /*!< ADC state analog watchdog (main analog watchdog, present on all STM32 devices) */
Kojto 100:cbbeb26dbd92 80 HAL_ADC_STATE_AWD2 = 0x07, /*!< ADC state analog watchdog (additional analog watchdog, present only on STM32F3 devices) */
Kojto 100:cbbeb26dbd92 81 HAL_ADC_STATE_AWD3 = 0x08, /*!< ADC state analog watchdog (additional analog watchdog, present only on STM32F3 devices) */
Kojto 100:cbbeb26dbd92 82 }HAL_ADC_StateTypeDef;
Kojto 100:cbbeb26dbd92 83
Kojto 100:cbbeb26dbd92 84 /**
Kojto 100:cbbeb26dbd92 85 * @brief ADC handle Structure definition
Kojto 100:cbbeb26dbd92 86 */
Kojto 100:cbbeb26dbd92 87 typedef struct __ADC_HandleTypeDef
Kojto 100:cbbeb26dbd92 88 {
Kojto 100:cbbeb26dbd92 89 ADC_TypeDef *Instance; /*!< Register base address */
Kojto 100:cbbeb26dbd92 90
Kojto 100:cbbeb26dbd92 91 ADC_InitTypeDef Init; /*!< ADC required parameters */
Kojto 100:cbbeb26dbd92 92
Kojto 100:cbbeb26dbd92 93 __IO uint32_t NbrOfConversionRank ; /*!< ADC conversion rank counter */
Kojto 100:cbbeb26dbd92 94
Kojto 100:cbbeb26dbd92 95 DMA_HandleTypeDef *DMA_Handle; /*!< Pointer DMA Handler */
Kojto 100:cbbeb26dbd92 96
Kojto 100:cbbeb26dbd92 97 HAL_LockTypeDef Lock; /*!< ADC locking object */
Kojto 100:cbbeb26dbd92 98
Kojto 100:cbbeb26dbd92 99 __IO HAL_ADC_StateTypeDef State; /*!< ADC communication state */
Kojto 100:cbbeb26dbd92 100
Kojto 100:cbbeb26dbd92 101 __IO uint32_t ErrorCode; /*!< ADC Error code */
Kojto 100:cbbeb26dbd92 102 }ADC_HandleTypeDef;
Kojto 100:cbbeb26dbd92 103 /**
Kojto 100:cbbeb26dbd92 104 * @}
Kojto 100:cbbeb26dbd92 105 */
Kojto 100:cbbeb26dbd92 106
Kojto 100:cbbeb26dbd92 107 /* Exported constants --------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 108 /* Exported macros -----------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 109
Kojto 100:cbbeb26dbd92 110 /** @defgroup ADC_Exported_Macro ADC Exported Macros
Kojto 100:cbbeb26dbd92 111 * @{
Kojto 100:cbbeb26dbd92 112 */
Kojto 100:cbbeb26dbd92 113 /** @brief Reset ADC handle state
Kojto 100:cbbeb26dbd92 114 * @param __HANDLE__: ADC handle
Kojto 100:cbbeb26dbd92 115 * @retval None
Kojto 100:cbbeb26dbd92 116 */
Kojto 100:cbbeb26dbd92 117 #define __HAL_ADC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_ADC_STATE_RESET)
Kojto 100:cbbeb26dbd92 118
Kojto 100:cbbeb26dbd92 119 /**
Kojto 100:cbbeb26dbd92 120 * @}
Kojto 100:cbbeb26dbd92 121 */
Kojto 100:cbbeb26dbd92 122
Kojto 100:cbbeb26dbd92 123
Kojto 100:cbbeb26dbd92 124 /* Include ADC HAL Extended module */
Kojto 100:cbbeb26dbd92 125 #include "stm32f3xx_hal_adc_ex.h"
Kojto 100:cbbeb26dbd92 126
Kojto 100:cbbeb26dbd92 127 /* Exported functions --------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 128 /** @addtogroup ADC_Exported_Functions ADC Exported Functions
Kojto 100:cbbeb26dbd92 129 * @{
Kojto 100:cbbeb26dbd92 130 */
Kojto 100:cbbeb26dbd92 131
Kojto 100:cbbeb26dbd92 132 /** @addtogroup ADC_Exported_Functions_Group1 Initialization and de-initialization functions
Kojto 100:cbbeb26dbd92 133 * @brief Initialization and Configuration functions
Kojto 100:cbbeb26dbd92 134 * @{
Kojto 100:cbbeb26dbd92 135 */
Kojto 100:cbbeb26dbd92 136 /* Initialization and de-initialization functions **********************************/
Kojto 100:cbbeb26dbd92 137 HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef* hadc);
Kojto 100:cbbeb26dbd92 138 HAL_StatusTypeDef HAL_ADC_DeInit(ADC_HandleTypeDef *hadc);
Kojto 100:cbbeb26dbd92 139 void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc);
Kojto 100:cbbeb26dbd92 140 void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc);
Kojto 100:cbbeb26dbd92 141 /**
Kojto 100:cbbeb26dbd92 142 * @}
Kojto 100:cbbeb26dbd92 143 */
Kojto 100:cbbeb26dbd92 144
Kojto 100:cbbeb26dbd92 145 /** @addtogroup ADC_Exported_Functions_Group2 Input and Output operation functions
Kojto 100:cbbeb26dbd92 146 * @brief IO operation functions
Kojto 100:cbbeb26dbd92 147 * @{
Kojto 100:cbbeb26dbd92 148 */
Kojto 100:cbbeb26dbd92 149 /* Blocking mode: Polling */
Kojto 100:cbbeb26dbd92 150 HAL_StatusTypeDef HAL_ADC_Start(ADC_HandleTypeDef* hadc);
Kojto 100:cbbeb26dbd92 151 HAL_StatusTypeDef HAL_ADC_Stop(ADC_HandleTypeDef* hadc);
Kojto 100:cbbeb26dbd92 152 HAL_StatusTypeDef HAL_ADC_PollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout);
Kojto 100:cbbeb26dbd92 153 HAL_StatusTypeDef HAL_ADC_PollForEvent(ADC_HandleTypeDef* hadc, uint32_t EventType, uint32_t Timeout);
Kojto 100:cbbeb26dbd92 154
Kojto 100:cbbeb26dbd92 155 /* Non-blocking mode: Interruption */
Kojto 100:cbbeb26dbd92 156 HAL_StatusTypeDef HAL_ADC_Start_IT(ADC_HandleTypeDef* hadc);
Kojto 100:cbbeb26dbd92 157 HAL_StatusTypeDef HAL_ADC_Stop_IT(ADC_HandleTypeDef* hadc);
Kojto 100:cbbeb26dbd92 158
Kojto 100:cbbeb26dbd92 159 /* Non-blocking mode: DMA */
Kojto 100:cbbeb26dbd92 160 HAL_StatusTypeDef HAL_ADC_Start_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, uint32_t Length);
Kojto 100:cbbeb26dbd92 161 HAL_StatusTypeDef HAL_ADC_Stop_DMA(ADC_HandleTypeDef* hadc);
Kojto 100:cbbeb26dbd92 162
Kojto 100:cbbeb26dbd92 163 /* ADC retrieve conversion value intended to be used with polling or interruption */
Kojto 100:cbbeb26dbd92 164 uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef* hadc);
Kojto 100:cbbeb26dbd92 165
Kojto 100:cbbeb26dbd92 166 /* ADC IRQHandler and Callbacks used in non-blocking modes (Interruption and DMA) */
Kojto 100:cbbeb26dbd92 167 void HAL_ADC_IRQHandler(ADC_HandleTypeDef* hadc);
Kojto 100:cbbeb26dbd92 168 void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc);
Kojto 100:cbbeb26dbd92 169 void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc);
Kojto 100:cbbeb26dbd92 170 void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef* hadc);
Kojto 100:cbbeb26dbd92 171 void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc);
Kojto 100:cbbeb26dbd92 172 /**
Kojto 100:cbbeb26dbd92 173 * @}
Kojto 100:cbbeb26dbd92 174 */
Kojto 100:cbbeb26dbd92 175
Kojto 100:cbbeb26dbd92 176 /** @addtogroup ADC_Exported_Functions_Group3 Peripheral Control functions
Kojto 100:cbbeb26dbd92 177 * @brief Peripheral Control functions
Kojto 100:cbbeb26dbd92 178 * @{
Kojto 100:cbbeb26dbd92 179 */
Kojto 100:cbbeb26dbd92 180 /* Peripheral Control functions ***********************************************/
Kojto 100:cbbeb26dbd92 181 HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef* hadc, ADC_ChannelConfTypeDef* sConfig);
Kojto 100:cbbeb26dbd92 182 HAL_StatusTypeDef HAL_ADC_AnalogWDGConfig(ADC_HandleTypeDef* hadc, ADC_AnalogWDGConfTypeDef* AnalogWDGConfig);
Kojto 100:cbbeb26dbd92 183 /**
Kojto 100:cbbeb26dbd92 184 * @}
Kojto 100:cbbeb26dbd92 185 */
Kojto 100:cbbeb26dbd92 186
Kojto 100:cbbeb26dbd92 187 /** @defgroup ADC_Exported_Functions_Group4 Peripheral State functions
Kojto 100:cbbeb26dbd92 188 * @brief ADC Peripheral State functions
Kojto 100:cbbeb26dbd92 189 * @{
Kojto 100:cbbeb26dbd92 190 */
Kojto 100:cbbeb26dbd92 191 /* Peripheral State functions *************************************************/
Kojto 100:cbbeb26dbd92 192 HAL_ADC_StateTypeDef HAL_ADC_GetState(ADC_HandleTypeDef* hadc);
Kojto 100:cbbeb26dbd92 193 uint32_t HAL_ADC_GetError(ADC_HandleTypeDef *hadc);
Kojto 100:cbbeb26dbd92 194 /**
Kojto 100:cbbeb26dbd92 195 * @}
Kojto 100:cbbeb26dbd92 196 */
Kojto 100:cbbeb26dbd92 197
Kojto 100:cbbeb26dbd92 198 /**
Kojto 100:cbbeb26dbd92 199 * @}
Kojto 100:cbbeb26dbd92 200 */
Kojto 100:cbbeb26dbd92 201
Kojto 100:cbbeb26dbd92 202 /**
Kojto 100:cbbeb26dbd92 203 * @}
Kojto 100:cbbeb26dbd92 204 */
Kojto 100:cbbeb26dbd92 205
Kojto 100:cbbeb26dbd92 206 /**
Kojto 100:cbbeb26dbd92 207 * @}
Kojto 100:cbbeb26dbd92 208 */
Kojto 100:cbbeb26dbd92 209
Kojto 100:cbbeb26dbd92 210 #ifdef __cplusplus
Kojto 100:cbbeb26dbd92 211 }
Kojto 100:cbbeb26dbd92 212 #endif
Kojto 100:cbbeb26dbd92 213
Kojto 100:cbbeb26dbd92 214 #endif /*__STM32F3xx_ADC_H */
Kojto 100:cbbeb26dbd92 215
Kojto 100:cbbeb26dbd92 216
Kojto 100:cbbeb26dbd92 217 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/