mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Tue Jun 24 14:45:08 2014 +0100
Revision:
237:f3da66175598
Child:
375:3d36234a1087
Synchronized with git revision 8ef659bca81f12dfc896b5a7af7c2abbd1a1b8b7

Full URL: https://github.com/mbedmicro/mbed/commit/8ef659bca81f12dfc896b5a7af7c2abbd1a1b8b7/

[NUCLEO_F334R8] Add platform files

Who changed what in which revision?

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