Martin Johnson / STM32F3-Discovery

Dependents:   Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32f30x_pwr.h Source File

stm32f30x_pwr.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32f30x_pwr.h
00004   * @author  MCD Application Team
00005   * @version V1.2.3
00006   * @date    10-July-2015
00007   * @brief   This file contains all the functions prototypes for the PWR firmware 
00008   *          library.
00009   ******************************************************************************
00010   * @attention
00011   *
00012   * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
00013   *
00014   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
00015   * You may not use this file except in compliance with the License.
00016   * You may obtain a copy of the License at:
00017   *
00018   *        http://www.st.com/software_license_agreement_liberty_v2
00019   *
00020   * Unless required by applicable law or agreed to in writing, software 
00021   * distributed under the License is distributed on an "AS IS" BASIS, 
00022   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00023   * See the License for the specific language governing permissions and
00024   * limitations under the License.
00025   *
00026   ******************************************************************************
00027   */
00028 
00029 /* Define to prevent recursive inclusion -------------------------------------*/
00030 #ifndef __STM32F30x_PWR_H
00031 #define __STM32F30x_PWR_H
00032 
00033 #ifdef __cplusplus
00034  extern "C" {
00035 #endif
00036 
00037 /* Includes ------------------------------------------------------------------*/
00038 #include "stm32f30x.h"
00039 
00040 /** @addtogroup STM32F30x_StdPeriph_Driver
00041   * @{
00042   */
00043 
00044 /** @addtogroup PWR
00045   * @{
00046   */ 
00047 
00048 /* Exported types ------------------------------------------------------------*/
00049 /* Exported constants --------------------------------------------------------*/
00050 
00051 /** @defgroup PWR_Exported_Constants
00052   * @{
00053   */ 
00054 
00055 /** @defgroup PWR_PVD_detection_level 
00056   * @{
00057   */ 
00058 
00059 #define PWR_PVDLevel_0                  PWR_CR_PLS_LEV0
00060 #define PWR_PVDLevel_1                  PWR_CR_PLS_LEV1
00061 #define PWR_PVDLevel_2                  PWR_CR_PLS_LEV2
00062 #define PWR_PVDLevel_3                  PWR_CR_PLS_LEV3
00063 #define PWR_PVDLevel_4                  PWR_CR_PLS_LEV4
00064 #define PWR_PVDLevel_5                  PWR_CR_PLS_LEV5
00065 #define PWR_PVDLevel_6                  PWR_CR_PLS_LEV6
00066 #define PWR_PVDLevel_7                  PWR_CR_PLS_LEV7
00067 
00068 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_0) || ((LEVEL) == PWR_PVDLevel_1)|| \
00069                                  ((LEVEL) == PWR_PVDLevel_2) || ((LEVEL) == PWR_PVDLevel_3)|| \
00070                                  ((LEVEL) == PWR_PVDLevel_4) || ((LEVEL) == PWR_PVDLevel_5)|| \
00071                                  ((LEVEL) == PWR_PVDLevel_6) || ((LEVEL) == PWR_PVDLevel_7))
00072 /**
00073   * @}
00074   */
00075 
00076 /** @defgroup PWR_WakeUp_Pins 
00077   * @{
00078   */
00079 
00080 #define PWR_WakeUpPin_1                 PWR_CSR_EWUP1
00081 #define PWR_WakeUpPin_2                 PWR_CSR_EWUP2
00082 #define PWR_WakeUpPin_3                 PWR_CSR_EWUP3
00083 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WakeUpPin_1) || \
00084                                 ((PIN) == PWR_WakeUpPin_2) || \
00085                                 ((PIN) == PWR_WakeUpPin_3))
00086 /**
00087   * @}
00088   */
00089 
00090  
00091 /** @defgroup PWR_Regulator_state_is_Sleep_STOP_mode 
00092   * @{
00093   */
00094 
00095 #define PWR_Regulator_ON                ((uint32_t)0x00000000)
00096 #define PWR_Regulator_LowPower          PWR_CR_LPSDSR
00097 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
00098                                      ((REGULATOR) == PWR_Regulator_LowPower))
00099 /**
00100   * @}
00101   */
00102   
00103 /** @defgroup PWR_SLEEP_mode_entry 
00104   * @{
00105   */
00106 
00107 #define PWR_SLEEPEntry_WFI              ((uint8_t)0x01)
00108 #define PWR_SLEEPEntry_WFE              ((uint8_t)0x02)
00109 #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPEntry_WFI) || ((ENTRY) == PWR_SLEEPEntry_WFE))
00110  
00111 /**
00112   * @}
00113   */
00114 
00115 /** @defgroup PWR_STOP_mode_entry 
00116   * @{
00117   */
00118 
00119 #define PWR_STOPEntry_WFI               ((uint8_t)0x01)
00120 #define PWR_STOPEntry_WFE               ((uint8_t)0x02)
00121 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
00122  
00123 /**
00124   * @}
00125   */
00126 
00127 /** @defgroup PWR_Flag 
00128   * @{
00129   */
00130 
00131 #define PWR_FLAG_WU                     PWR_CSR_WUF
00132 #define PWR_FLAG_SB                     PWR_CSR_SBF
00133 #define PWR_FLAG_PVDO                   PWR_CSR_PVDO
00134 #define PWR_FLAG_VREFINTRDY             PWR_CSR_VREFINTRDYF
00135 
00136 #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
00137                                ((FLAG) == PWR_FLAG_PVDO) || ((FLAG) == PWR_FLAG_VREFINTRDY))
00138 
00139 #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
00140 /**
00141   * @}
00142   */
00143 
00144 /**
00145   * @}
00146   */
00147 
00148 /* Exported macro ------------------------------------------------------------*/
00149 /* Exported functions ------------------------------------------------------- */
00150 
00151 /* Function used to set the PWR configuration to the default reset state ******/ 
00152 void PWR_DeInit(void);
00153 
00154 /* Backup Domain Access function **********************************************/ 
00155 void PWR_BackupAccessCmd(FunctionalState NewState);
00156 
00157 /* PVD configuration functions ************************************************/ 
00158 void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
00159 void PWR_PVDCmd(FunctionalState NewState);
00160 
00161 /* WakeUp pins configuration functions ****************************************/ 
00162 void PWR_WakeUpPinCmd(uint32_t PWR_WakeUpPin, FunctionalState NewState);
00163 
00164 /* Low Power modes configuration functions ************************************/ 
00165 void PWR_EnterSleepMode(uint8_t PWR_SLEEPEntry);
00166 void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
00167 void PWR_EnterSTANDBYMode(void);
00168 
00169 /* Flags management functions *************************************************/ 
00170 FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
00171 void PWR_ClearFlag(uint32_t PWR_FLAG);
00172 
00173 #ifdef __cplusplus
00174 }
00175 #endif
00176 
00177 #endif /* __STM32F30x_PWR_H */
00178 
00179 /**
00180   * @}
00181   */
00182 
00183 /**
00184   * @}
00185   */
00186 
00187 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/