meh

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Jul 02 13:22:23 2014 +0100
Revision:
86:04dd9b1680ae
Child:
92:4fc01daae5a5
Release 86 of the mbed library

Main changes:


- bug fixes in various backends
- mbed "error" replaced by assert logic (mbed_assert)
- new ST Nucleo targets

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 86:04dd9b1680ae 1 /**
bogdanm 86:04dd9b1680ae 2 ******************************************************************************
bogdanm 86:04dd9b1680ae 3 * @file stm32f3xx_hal_pwr_ex.h
bogdanm 86:04dd9b1680ae 4 * @author MCD Application Team
bogdanm 86:04dd9b1680ae 5 * @version V1.0.1
bogdanm 86:04dd9b1680ae 6 * @date 18-June-2014
bogdanm 86:04dd9b1680ae 7 * @brief Header file of PWR HAL Extension module.
bogdanm 86:04dd9b1680ae 8 ******************************************************************************
bogdanm 86:04dd9b1680ae 9 * @attention
bogdanm 86:04dd9b1680ae 10 *
bogdanm 86:04dd9b1680ae 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
bogdanm 86:04dd9b1680ae 12 *
bogdanm 86:04dd9b1680ae 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 86:04dd9b1680ae 14 * are permitted provided that the following conditions are met:
bogdanm 86:04dd9b1680ae 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 86:04dd9b1680ae 16 * this list of conditions and the following disclaimer.
bogdanm 86:04dd9b1680ae 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 86:04dd9b1680ae 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 86:04dd9b1680ae 19 * and/or other materials provided with the distribution.
bogdanm 86:04dd9b1680ae 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 86:04dd9b1680ae 21 * may be used to endorse or promote products derived from this software
bogdanm 86:04dd9b1680ae 22 * without specific prior written permission.
bogdanm 86:04dd9b1680ae 23 *
bogdanm 86:04dd9b1680ae 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 86:04dd9b1680ae 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 86:04dd9b1680ae 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 86:04dd9b1680ae 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 86:04dd9b1680ae 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 86:04dd9b1680ae 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 86:04dd9b1680ae 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 86:04dd9b1680ae 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 86:04dd9b1680ae 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 86:04dd9b1680ae 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 86:04dd9b1680ae 34 *
bogdanm 86:04dd9b1680ae 35 ******************************************************************************
bogdanm 86:04dd9b1680ae 36 */
bogdanm 86:04dd9b1680ae 37
bogdanm 86:04dd9b1680ae 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 86:04dd9b1680ae 39 #ifndef __STM32F3xx_HAL_PWR_EX_H
bogdanm 86:04dd9b1680ae 40 #define __STM32F3xx_HAL_PWR_EX_H
bogdanm 86:04dd9b1680ae 41
bogdanm 86:04dd9b1680ae 42 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 43 extern "C" {
bogdanm 86:04dd9b1680ae 44 #endif
bogdanm 86:04dd9b1680ae 45
bogdanm 86:04dd9b1680ae 46 /* Includes ------------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 47 #include "stm32f3xx_hal_def.h"
bogdanm 86:04dd9b1680ae 48
bogdanm 86:04dd9b1680ae 49 /** @addtogroup STM32F3xx_HAL_Driver
bogdanm 86:04dd9b1680ae 50 * @{
bogdanm 86:04dd9b1680ae 51 */
bogdanm 86:04dd9b1680ae 52
bogdanm 86:04dd9b1680ae 53 /** @addtogroup PWREx
bogdanm 86:04dd9b1680ae 54 * @{
bogdanm 86:04dd9b1680ae 55 */
bogdanm 86:04dd9b1680ae 56
bogdanm 86:04dd9b1680ae 57 /* Exported types ------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 58 #if defined(STM32F301x8) || \
bogdanm 86:04dd9b1680ae 59 defined(STM32F302x8) || defined(STM32F302xC) || \
bogdanm 86:04dd9b1680ae 60 defined(STM32F303x8) || defined(STM32F303xC) || defined(STM32F373xC) || \
bogdanm 86:04dd9b1680ae 61 defined(STM32F334x8)
bogdanm 86:04dd9b1680ae 62 /**
bogdanm 86:04dd9b1680ae 63 * @brief PWR PVD configuration structure definition
bogdanm 86:04dd9b1680ae 64 */
bogdanm 86:04dd9b1680ae 65 typedef struct
bogdanm 86:04dd9b1680ae 66 {
bogdanm 86:04dd9b1680ae 67 uint32_t PVDLevel; /*!< PVDLevel: Specifies the PVD detection level
bogdanm 86:04dd9b1680ae 68 This parameter can be a value of @ref PWREx_PVD_detection_level */
bogdanm 86:04dd9b1680ae 69
bogdanm 86:04dd9b1680ae 70 uint32_t Mode; /*!< Mode: Specifies the operating mode for the selected pins.
bogdanm 86:04dd9b1680ae 71 This parameter can be a value of @ref PWREx_PVD_Mode */
bogdanm 86:04dd9b1680ae 72 }PWR_PVDTypeDef;
bogdanm 86:04dd9b1680ae 73 #endif /* STM32F301x8 || STM32F302x8 || STM32F302xC || */
bogdanm 86:04dd9b1680ae 74 /* STM32F303x8 || STM32F303xC */
bogdanm 86:04dd9b1680ae 75 /* STM32F373xC || STM32F334x8 */
bogdanm 86:04dd9b1680ae 76
bogdanm 86:04dd9b1680ae 77 /* Exported constants --------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 78
bogdanm 86:04dd9b1680ae 79 /** @defgroup PWREx_Exported_Constants
bogdanm 86:04dd9b1680ae 80 * @{
bogdanm 86:04dd9b1680ae 81 */
bogdanm 86:04dd9b1680ae 82
bogdanm 86:04dd9b1680ae 83 #if defined(STM32F301x8) || \
bogdanm 86:04dd9b1680ae 84 defined(STM32F302x8) || defined(STM32F302xC) || \
bogdanm 86:04dd9b1680ae 85 defined(STM32F303x8) || defined(STM32F303xC) || defined(STM32F373xC) || \
bogdanm 86:04dd9b1680ae 86 defined(STM32F334x8)
bogdanm 86:04dd9b1680ae 87 /** @defgroup PWREx_PVD_detection_level
bogdanm 86:04dd9b1680ae 88 * @{
bogdanm 86:04dd9b1680ae 89 */
bogdanm 86:04dd9b1680ae 90 #define PWR_PVDLEVEL_0 PWR_CR_PLS_LEV0
bogdanm 86:04dd9b1680ae 91 #define PWR_PVDLEVEL_1 PWR_CR_PLS_LEV1
bogdanm 86:04dd9b1680ae 92 #define PWR_PVDLEVEL_2 PWR_CR_PLS_LEV2
bogdanm 86:04dd9b1680ae 93 #define PWR_PVDLEVEL_3 PWR_CR_PLS_LEV3
bogdanm 86:04dd9b1680ae 94 #define PWR_PVDLEVEL_4 PWR_CR_PLS_LEV4
bogdanm 86:04dd9b1680ae 95 #define PWR_PVDLEVEL_5 PWR_CR_PLS_LEV5
bogdanm 86:04dd9b1680ae 96 #define PWR_PVDLEVEL_6 PWR_CR_PLS_LEV6
bogdanm 86:04dd9b1680ae 97 #define PWR_PVDLEVEL_7 PWR_CR_PLS_LEV7
bogdanm 86:04dd9b1680ae 98 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLEVEL_0) || ((LEVEL) == PWR_PVDLEVEL_1)|| \
bogdanm 86:04dd9b1680ae 99 ((LEVEL) == PWR_PVDLEVEL_2) || ((LEVEL) == PWR_PVDLEVEL_3)|| \
bogdanm 86:04dd9b1680ae 100 ((LEVEL) == PWR_PVDLEVEL_4) || ((LEVEL) == PWR_PVDLEVEL_5)|| \
bogdanm 86:04dd9b1680ae 101 ((LEVEL) == PWR_PVDLEVEL_6) || ((LEVEL) == PWR_PVDLEVEL_7))
bogdanm 86:04dd9b1680ae 102 /**
bogdanm 86:04dd9b1680ae 103 * @}
bogdanm 86:04dd9b1680ae 104 */
bogdanm 86:04dd9b1680ae 105
bogdanm 86:04dd9b1680ae 106 /** @defgroup PWREx_PVD_Mode
bogdanm 86:04dd9b1680ae 107 * @{
bogdanm 86:04dd9b1680ae 108 */
bogdanm 86:04dd9b1680ae 109 #define PWR_MODE_EVT ((uint32_t)0x00000000) /*!< No Interrupt */
bogdanm 86:04dd9b1680ae 110 #define PWR_MODE_IT_RISING ((uint32_t)0x00000001) /*!< External Interrupt Mode with Rising edge trigger detection */
bogdanm 86:04dd9b1680ae 111 #define PWR_MODE_IT_FALLING ((uint32_t)0x00000002) /*!< External Interrupt Mode with Falling edge trigger detection */
bogdanm 86:04dd9b1680ae 112 #define PWR_MODE_IT_RISING_FALLING ((uint32_t)0x00000003) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
bogdanm 86:04dd9b1680ae 113 #define IS_PWR_PVD_MODE(MODE) (((MODE) == PWR_MODE_EVT) || ((MODE) == PWR_MODE_IT_RISING)|| \
bogdanm 86:04dd9b1680ae 114 ((MODE) == PWR_MODE_IT_FALLING) || ((MODE) == PWR_MODE_IT_RISING_FALLING))
bogdanm 86:04dd9b1680ae 115 /**
bogdanm 86:04dd9b1680ae 116 * @}
bogdanm 86:04dd9b1680ae 117 */
bogdanm 86:04dd9b1680ae 118
bogdanm 86:04dd9b1680ae 119 #define PWR_EXTI_LINE_PVD ((uint32_t)0x00010000) /*!< External interrupt line 16 Connected to the PVD EXTI Line */
bogdanm 86:04dd9b1680ae 120
bogdanm 86:04dd9b1680ae 121 #endif /* STM32F301x8 || STM32F302x8 || STM32F302xC || */
bogdanm 86:04dd9b1680ae 122 /* STM32F303x8 || STM32F303xC */
bogdanm 86:04dd9b1680ae 123 /* STM32F373xC || STM32F334x8 */
bogdanm 86:04dd9b1680ae 124
bogdanm 86:04dd9b1680ae 125 #if defined(STM32F373xC) || defined(STM32F378xx)
bogdanm 86:04dd9b1680ae 126 /** @defgroup PWREx_SDADC_ANALOGx
bogdanm 86:04dd9b1680ae 127 * @{
bogdanm 86:04dd9b1680ae 128 */
bogdanm 86:04dd9b1680ae 129 #define PWR_SDADC_ANALOG1 ((uint32_t)PWR_CR_SDADC1EN)
bogdanm 86:04dd9b1680ae 130 #define PWR_SDADC_ANALOG2 ((uint32_t)PWR_CR_SDADC2EN)
bogdanm 86:04dd9b1680ae 131 #define PWR_SDADC_ANALOG3 ((uint32_t)PWR_CR_SDADC3EN)
bogdanm 86:04dd9b1680ae 132 #define IS_PWR_SDADC_ANALOG(SDADC) (((SDADC) == PWR_SDADC_ANALOG1) || \
bogdanm 86:04dd9b1680ae 133 ((SDADC) == PWR_SDADC_ANALOG2) || \
bogdanm 86:04dd9b1680ae 134 ((SDADC) == PWR_SDADC_ANALOG3))
bogdanm 86:04dd9b1680ae 135 /**
bogdanm 86:04dd9b1680ae 136 * @}
bogdanm 86:04dd9b1680ae 137 */
bogdanm 86:04dd9b1680ae 138 #endif /* STM32F373xC || STM32F378xx */
bogdanm 86:04dd9b1680ae 139
bogdanm 86:04dd9b1680ae 140 /**
bogdanm 86:04dd9b1680ae 141 * @}
bogdanm 86:04dd9b1680ae 142 */
bogdanm 86:04dd9b1680ae 143
bogdanm 86:04dd9b1680ae 144 /* Exported macro ------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 145 /** @defgroup PWREx_Exported_Macros
bogdanm 86:04dd9b1680ae 146 * @{
bogdanm 86:04dd9b1680ae 147 */
bogdanm 86:04dd9b1680ae 148
bogdanm 86:04dd9b1680ae 149 #if defined(STM32F301x8) || \
bogdanm 86:04dd9b1680ae 150 defined(STM32F302x8) || defined(STM32F302xC) || \
bogdanm 86:04dd9b1680ae 151 defined(STM32F303x8) || defined(STM32F303xC) || defined(STM32F373xC) || \
bogdanm 86:04dd9b1680ae 152 defined(STM32F334x8)
bogdanm 86:04dd9b1680ae 153 /**
bogdanm 86:04dd9b1680ae 154 * @brief Enable the PVD Exti Line.
bogdanm 86:04dd9b1680ae 155 * @param __EXTILINE__: specifies the PVD EXTI sources to be enabled.
bogdanm 86:04dd9b1680ae 156 * This parameter can be:
bogdanm 86:04dd9b1680ae 157 * @arg PWR_EXTI_LINE_PVD
bogdanm 86:04dd9b1680ae 158 * @retval None.
bogdanm 86:04dd9b1680ae 159 */
bogdanm 86:04dd9b1680ae 160 #define __HAL_PVD_EXTI_ENABLE_IT(__EXTILINE__) (EXTI->IMR |= (__EXTILINE__))
bogdanm 86:04dd9b1680ae 161
bogdanm 86:04dd9b1680ae 162 /**
bogdanm 86:04dd9b1680ae 163 * @brief Disable the PVD EXTI Line.
bogdanm 86:04dd9b1680ae 164 * @param __EXTILINE__: specifies the PVD EXTI sources to be disabled.
bogdanm 86:04dd9b1680ae 165 * This parameter can be:
bogdanm 86:04dd9b1680ae 166 * @arg PWR_EXTI_LINE_PVD
bogdanm 86:04dd9b1680ae 167 * @retval None.
bogdanm 86:04dd9b1680ae 168 */
bogdanm 86:04dd9b1680ae 169 #define __HAL_PVD_EXTI_DISABLE_IT(__EXTILINE__) (EXTI->IMR &= ~(__EXTILINE__))
bogdanm 86:04dd9b1680ae 170
bogdanm 86:04dd9b1680ae 171 /**
bogdanm 86:04dd9b1680ae 172 * @brief Generate a Software interrupt on selected EXTI line.
bogdanm 86:04dd9b1680ae 173 * @param __EXTILINE__: specifies the PVD EXTI sources to be disabled.
bogdanm 86:04dd9b1680ae 174 * This parameter can be:
bogdanm 86:04dd9b1680ae 175 * @arg PWR_EXTI_LINE_PVD
bogdanm 86:04dd9b1680ae 176 * @retval None
bogdanm 86:04dd9b1680ae 177 */
bogdanm 86:04dd9b1680ae 178 #define __HAL_PVD_EXTI_GENERATE_SWIT(__EXTILINE__) (EXTI->SWIER |= (__EXTILINE__))
bogdanm 86:04dd9b1680ae 179
bogdanm 86:04dd9b1680ae 180 /**
bogdanm 86:04dd9b1680ae 181 * @brief Check whether the specified PVD EXTI interrupt flag is set or not.
bogdanm 86:04dd9b1680ae 182 * @param __EXTILINE__: specifies the PVD EXTI sources to be cleared.
bogdanm 86:04dd9b1680ae 183 * This parameter can be:
bogdanm 86:04dd9b1680ae 184 * @arg PWR_EXTI_LINE_PVD
bogdanm 86:04dd9b1680ae 185 * @retval EXTI PVD Line Status.
bogdanm 86:04dd9b1680ae 186 */
bogdanm 86:04dd9b1680ae 187 #define __HAL_PVD_EXTI_GET_FLAG(__EXTILINE__) (EXTI->PR & (__EXTILINE__))
bogdanm 86:04dd9b1680ae 188
bogdanm 86:04dd9b1680ae 189 /**
bogdanm 86:04dd9b1680ae 190 * @brief Clear the PVD EXTI flag.
bogdanm 86:04dd9b1680ae 191 * @param __EXTILINE__: specifies the PVD EXTI sources to be cleared.
bogdanm 86:04dd9b1680ae 192 * This parameter can be:
bogdanm 86:04dd9b1680ae 193 * @arg PWR_EXTI_LINE_PVD
bogdanm 86:04dd9b1680ae 194 * @retval None.
bogdanm 86:04dd9b1680ae 195 */
bogdanm 86:04dd9b1680ae 196 #define __HAL_PVD_EXTI_CLEAR_FLAG(__EXTILINE__) (EXTI->PR = (__EXTILINE__))
bogdanm 86:04dd9b1680ae 197 #endif /* STM32F301x8 || STM32F302x8 || STM32F302xC || */
bogdanm 86:04dd9b1680ae 198 /* STM32F303x8 || STM32F303xC */
bogdanm 86:04dd9b1680ae 199 /* STM32F373xC || STM32F334x8 */
bogdanm 86:04dd9b1680ae 200
bogdanm 86:04dd9b1680ae 201 /**
bogdanm 86:04dd9b1680ae 202 * @}
bogdanm 86:04dd9b1680ae 203 */
bogdanm 86:04dd9b1680ae 204
bogdanm 86:04dd9b1680ae 205 /* Exported functions --------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 206
bogdanm 86:04dd9b1680ae 207 /* Peripheral Control functions ***********************************************/
bogdanm 86:04dd9b1680ae 208 #if defined(STM32F301x8) || \
bogdanm 86:04dd9b1680ae 209 defined(STM32F302x8) || defined(STM32F302xC) || \
bogdanm 86:04dd9b1680ae 210 defined(STM32F303x8) || defined(STM32F303xC) || defined(STM32F373xC) || \
bogdanm 86:04dd9b1680ae 211 defined(STM32F334x8)
bogdanm 86:04dd9b1680ae 212 void HAL_PWR_PVDConfig(PWR_PVDTypeDef *sConfigPVD);
bogdanm 86:04dd9b1680ae 213 void HAL_PWR_EnablePVD(void);
bogdanm 86:04dd9b1680ae 214 void HAL_PWR_DisablePVD(void);
bogdanm 86:04dd9b1680ae 215 void HAL_PWR_PVD_IRQHandler(void);
bogdanm 86:04dd9b1680ae 216 void HAL_PWR_PVDCallback(void);
bogdanm 86:04dd9b1680ae 217 #endif /* STM32F301x8 || STM32F302x8 || STM32F302xC || */
bogdanm 86:04dd9b1680ae 218 /* STM32F303x8 || STM32F303xC */
bogdanm 86:04dd9b1680ae 219 /* STM32F373xC || STM32F334x8 */
bogdanm 86:04dd9b1680ae 220
bogdanm 86:04dd9b1680ae 221 #if defined(STM32F373xC) || defined(STM32F378xx)
bogdanm 86:04dd9b1680ae 222 void HAL_PWREx_EnableSDADCAnalog(uint32_t Analogx);
bogdanm 86:04dd9b1680ae 223 void HAL_PWREx_DisableSDADCAnalog(uint32_t Analogx);
bogdanm 86:04dd9b1680ae 224 #endif /* STM32F373xC || STM32F378xx */
bogdanm 86:04dd9b1680ae 225
bogdanm 86:04dd9b1680ae 226 /**
bogdanm 86:04dd9b1680ae 227 * @}
bogdanm 86:04dd9b1680ae 228 */
bogdanm 86:04dd9b1680ae 229
bogdanm 86:04dd9b1680ae 230 /**
bogdanm 86:04dd9b1680ae 231 * @}
bogdanm 86:04dd9b1680ae 232 */
bogdanm 86:04dd9b1680ae 233
bogdanm 86:04dd9b1680ae 234 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 235 }
bogdanm 86:04dd9b1680ae 236 #endif
bogdanm 86:04dd9b1680ae 237
bogdanm 86:04dd9b1680ae 238 #endif /* __STM32F3xx_HAL_PWR_EX_H */
bogdanm 86:04dd9b1680ae 239
bogdanm 86:04dd9b1680ae 240 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/