mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Feb 03 15:31:20 2015 +0000
Revision:
93:e188a91d3eaa
Release 93 of the mbed library

Main changes:

- Renesas RZ_A1H bugfixes - i2c, ticker
- new targets - Nucleo F303RE, Nucleo F070RB, BLE SMURFS,
Dragonfly 411RE,
- BusXXX - is connected method, plus operators addition
- LPC8xx - I2c fixes
- timestamp_t reverted to uint32_t
- RTX - fixes regarding stack (alignment, magic word)

Who changed what in which revision?

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