1 |
608 |
jeremybenn |
/******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
|
2 |
|
|
* File Name : stm32f10x_pwr.h
|
3 |
|
|
* Author : MCD Application Team
|
4 |
|
|
* Date First Issued : 09/29/2006
|
5 |
|
|
* Description : This file contains all the functions prototypes for the
|
6 |
|
|
* PWR firmware library.
|
7 |
|
|
********************************************************************************
|
8 |
|
|
* History:
|
9 |
|
|
* 04/02/2007: V0.2
|
10 |
|
|
* 02/05/2007: V0.1
|
11 |
|
|
* 09/29/2006: V0.01
|
12 |
|
|
********************************************************************************
|
13 |
|
|
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
14 |
|
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
15 |
|
|
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
16 |
|
|
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
17 |
|
|
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
18 |
|
|
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
19 |
|
|
*******************************************************************************/
|
20 |
|
|
|
21 |
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
22 |
|
|
#ifndef __STM32F10x_PWR_H
|
23 |
|
|
#define __STM32F10x_PWR_H
|
24 |
|
|
|
25 |
|
|
/* Includes ------------------------------------------------------------------*/
|
26 |
|
|
#include "stm32f10x_map.h"
|
27 |
|
|
|
28 |
|
|
/* Exported types ------------------------------------------------------------*/
|
29 |
|
|
/* Exported constants --------------------------------------------------------*/
|
30 |
|
|
/* PVD detection level */
|
31 |
|
|
#define PWR_PVDLevel_2V2 ((u32)0x00000000)
|
32 |
|
|
#define PWR_PVDLevel_2V3 ((u32)0x00000020)
|
33 |
|
|
#define PWR_PVDLevel_2V4 ((u32)0x00000040)
|
34 |
|
|
#define PWR_PVDLevel_2V5 ((u32)0x00000060)
|
35 |
|
|
#define PWR_PVDLevel_2V6 ((u32)0x00000080)
|
36 |
|
|
#define PWR_PVDLevel_2V7 ((u32)0x000000A0)
|
37 |
|
|
#define PWR_PVDLevel_2V8 ((u32)0x000000C0)
|
38 |
|
|
#define PWR_PVDLevel_2V9 ((u32)0x000000E0)
|
39 |
|
|
|
40 |
|
|
#define IS_PWR_PVD_LEVEL(LEVEL) ((LEVEL == PWR_PVDLevel_2V2) || (LEVEL == PWR_PVDLevel_2V3)|| \
|
41 |
|
|
(LEVEL == PWR_PVDLevel_2V4) || (LEVEL == PWR_PVDLevel_2V5)|| \
|
42 |
|
|
(LEVEL == PWR_PVDLevel_2V6) || (LEVEL == PWR_PVDLevel_2V7)|| \
|
43 |
|
|
(LEVEL == PWR_PVDLevel_2V8) || (LEVEL == PWR_PVDLevel_2V9))
|
44 |
|
|
|
45 |
|
|
/* Regulator state is STOP mode */
|
46 |
|
|
#define PWR_Regulator_ON ((u32)0x00000000)
|
47 |
|
|
#define PWR_Regulator_LowPower ((u32)0x00000001)
|
48 |
|
|
|
49 |
|
|
#define IS_PWR_REGULATOR(REGULATOR) ((REGULATOR == PWR_Regulator_ON) || \
|
50 |
|
|
(REGULATOR == PWR_Regulator_LowPower))
|
51 |
|
|
|
52 |
|
|
/* STOP mode entry */
|
53 |
|
|
#define PWR_STOPEntry_WFI ((u8)0x01)
|
54 |
|
|
#define PWR_STOPEntry_WFE ((u8)0x02)
|
55 |
|
|
|
56 |
|
|
#define IS_PWR_STOP_ENTRY(ENTRY) ((ENTRY == PWR_STOPEntry_WFI) || (ENTRY == PWR_STOPEntry_WFE))
|
57 |
|
|
|
58 |
|
|
/* PWR Flag */
|
59 |
|
|
#define PWR_FLAG_WU ((u32)0x00000001)
|
60 |
|
|
#define PWR_FLAG_SB ((u32)0x00000002)
|
61 |
|
|
#define PWR_FLAG_PVDO ((u32)0x00000004)
|
62 |
|
|
|
63 |
|
|
#define IS_PWR_GET_FLAG(FLAG) ((FLAG == PWR_FLAG_WU) || (FLAG == PWR_FLAG_SB) || \
|
64 |
|
|
(FLAG == PWR_FLAG_PVDO))
|
65 |
|
|
#define IS_PWR_CLEAR_FLAG(FLAG) ((FLAG == PWR_FLAG_WU) || (FLAG == PWR_FLAG_SB))
|
66 |
|
|
|
67 |
|
|
/* Exported macro ------------------------------------------------------------*/
|
68 |
|
|
/* Exported functions ------------------------------------------------------- */
|
69 |
|
|
void PWR_DeInit(void);
|
70 |
|
|
void PWR_BackupAccessCmd(FunctionalState NewState);
|
71 |
|
|
void PWR_PVDCmd(FunctionalState NewState);
|
72 |
|
|
void PWR_PVDLevelConfig(u32 PWR_PVDLevel);
|
73 |
|
|
void PWR_WakeUpPinCmd(FunctionalState NewState);
|
74 |
|
|
void PWR_EnterSTOPMode(u32 PWR_Regulator, u8 PWR_STOPEntry);
|
75 |
|
|
void PWR_EnterSTANDBYMode(void);
|
76 |
|
|
FlagStatus PWR_GetFlagStatus(u32 PWR_FLAG);
|
77 |
|
|
void PWR_ClearFlag(u32 PWR_FLAG);
|
78 |
|
|
|
79 |
|
|
#endif /* __STM32F10x_PWR_H */
|
80 |
|
|
|
81 |
|
|
/******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
|