You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

569 lines
18 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32f0xx_ll_pwr.h
  4. * @author MCD Application Team
  5. * @brief Header file of PWR LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. /* Define to prevent recursive inclusion -------------------------------------*/
  36. #ifndef __STM32F0xx_LL_PWR_H
  37. #define __STM32F0xx_LL_PWR_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32f0xx.h"
  43. /** @addtogroup STM32F0xx_LL_Driver
  44. * @{
  45. */
  46. #if defined(PWR)
  47. /** @defgroup PWR_LL PWR
  48. * @{
  49. */
  50. /* Private types -------------------------------------------------------------*/
  51. /* Private variables ---------------------------------------------------------*/
  52. /* Private constants ---------------------------------------------------------*/
  53. /* Private macros ------------------------------------------------------------*/
  54. /* Exported types ------------------------------------------------------------*/
  55. /* Exported constants --------------------------------------------------------*/
  56. /** @defgroup PWR_LL_Exported_Constants PWR Exported Constants
  57. * @{
  58. */
  59. /** @defgroup PWR_LL_EC_CLEAR_FLAG Clear Flags Defines
  60. * @brief Flags defines which can be used with LL_PWR_WriteReg function
  61. * @{
  62. */
  63. #define LL_PWR_CR_CSBF PWR_CR_CSBF /*!< Clear standby flag */
  64. #define LL_PWR_CR_CWUF PWR_CR_CWUF /*!< Clear wakeup flag */
  65. /**
  66. * @}
  67. */
  68. /** @defgroup PWR_LL_EC_GET_FLAG Get Flags Defines
  69. * @brief Flags defines which can be used with LL_PWR_ReadReg function
  70. * @{
  71. */
  72. #define LL_PWR_CSR_WUF PWR_CSR_WUF /*!< Wakeup flag */
  73. #define LL_PWR_CSR_SBF PWR_CSR_SBF /*!< Standby flag */
  74. #if defined(PWR_PVD_SUPPORT)
  75. #define LL_PWR_CSR_PVDO PWR_CSR_PVDO /*!< Power voltage detector output flag */
  76. #endif /* PWR_PVD_SUPPORT */
  77. #if defined(PWR_CSR_VREFINTRDYF)
  78. #define LL_PWR_CSR_VREFINTRDYF PWR_CSR_VREFINTRDYF /*!< VREFINT ready flag */
  79. #endif /* PWR_CSR_VREFINTRDYF */
  80. #define LL_PWR_CSR_EWUP1 PWR_CSR_EWUP1 /*!< Enable WKUP pin 1 */
  81. #define LL_PWR_CSR_EWUP2 PWR_CSR_EWUP2 /*!< Enable WKUP pin 2 */
  82. #if defined(PWR_CSR_EWUP3)
  83. #define LL_PWR_CSR_EWUP3 PWR_CSR_EWUP3 /*!< Enable WKUP pin 3 */
  84. #endif /* PWR_CSR_EWUP3 */
  85. #if defined(PWR_CSR_EWUP4)
  86. #define LL_PWR_CSR_EWUP4 PWR_CSR_EWUP4 /*!< Enable WKUP pin 4 */
  87. #endif /* PWR_CSR_EWUP4 */
  88. #if defined(PWR_CSR_EWUP5)
  89. #define LL_PWR_CSR_EWUP5 PWR_CSR_EWUP5 /*!< Enable WKUP pin 5 */
  90. #endif /* PWR_CSR_EWUP5 */
  91. #if defined(PWR_CSR_EWUP6)
  92. #define LL_PWR_CSR_EWUP6 PWR_CSR_EWUP6 /*!< Enable WKUP pin 6 */
  93. #endif /* PWR_CSR_EWUP6 */
  94. #if defined(PWR_CSR_EWUP7)
  95. #define LL_PWR_CSR_EWUP7 PWR_CSR_EWUP7 /*!< Enable WKUP pin 7 */
  96. #endif /* PWR_CSR_EWUP7 */
  97. #if defined(PWR_CSR_EWUP8)
  98. #define LL_PWR_CSR_EWUP8 PWR_CSR_EWUP8 /*!< Enable WKUP pin 8 */
  99. #endif /* PWR_CSR_EWUP8 */
  100. /**
  101. * @}
  102. */
  103. /** @defgroup PWR_LL_EC_MODE_PWR Mode Power
  104. * @{
  105. */
  106. #define LL_PWR_MODE_STOP_MAINREGU 0x00000000U /*!< Enter Stop mode when the CPU enters deepsleep */
  107. #define LL_PWR_MODE_STOP_LPREGU (PWR_CR_LPDS) /*!< Enter Stop mode (with low power Regulator ON) when the CPU enters deepsleep */
  108. #define LL_PWR_MODE_STANDBY (PWR_CR_PDDS) /*!< Enter Standby mode when the CPU enters deepsleep */
  109. /**
  110. * @}
  111. */
  112. #if defined(PWR_CR_LPDS)
  113. /** @defgroup PWR_LL_EC_REGU_MODE_DS_MODE Regulator Mode In Deep Sleep Mode
  114. * @{
  115. */
  116. #define LL_PWR_REGU_DSMODE_MAIN 0x00000000U /*!< Voltage Regulator in main mode during deepsleep mode */
  117. #define LL_PWR_REGU_DSMODE_LOW_POWER (PWR_CR_LPDS) /*!< Voltage Regulator in low-power mode during deepsleep mode */
  118. /**
  119. * @}
  120. */
  121. #endif /* PWR_CR_LPDS */
  122. #if defined(PWR_PVD_SUPPORT)
  123. /** @defgroup PWR_LL_EC_PVDLEVEL Power Voltage Detector Level
  124. * @{
  125. */
  126. #define LL_PWR_PVDLEVEL_0 (PWR_CR_PLS_LEV0) /*!< Voltage threshold 0 */
  127. #define LL_PWR_PVDLEVEL_1 (PWR_CR_PLS_LEV1) /*!< Voltage threshold 1 */
  128. #define LL_PWR_PVDLEVEL_2 (PWR_CR_PLS_LEV2) /*!< Voltage threshold 2 */
  129. #define LL_PWR_PVDLEVEL_3 (PWR_CR_PLS_LEV3) /*!< Voltage threshold 3 */
  130. #define LL_PWR_PVDLEVEL_4 (PWR_CR_PLS_LEV4) /*!< Voltage threshold 4 */
  131. #define LL_PWR_PVDLEVEL_5 (PWR_CR_PLS_LEV5) /*!< Voltage threshold 5 */
  132. #define LL_PWR_PVDLEVEL_6 (PWR_CR_PLS_LEV6) /*!< Voltage threshold 6 */
  133. #define LL_PWR_PVDLEVEL_7 (PWR_CR_PLS_LEV7) /*!< Voltage threshold 7 */
  134. /**
  135. * @}
  136. */
  137. #endif /* PWR_PVD_SUPPORT */
  138. /** @defgroup PWR_LL_EC_WAKEUP_PIN Wakeup Pins
  139. * @{
  140. */
  141. #define LL_PWR_WAKEUP_PIN1 (PWR_CSR_EWUP1) /*!< WKUP pin 1 : PA0 */
  142. #define LL_PWR_WAKEUP_PIN2 (PWR_CSR_EWUP2) /*!< WKUP pin 2 : PC13 */
  143. #if defined(PWR_CSR_EWUP3)
  144. #define LL_PWR_WAKEUP_PIN3 (PWR_CSR_EWUP3) /*!< WKUP pin 3 : PE6 or PA2 according to device */
  145. #endif /* PWR_CSR_EWUP3 */
  146. #if defined(PWR_CSR_EWUP4)
  147. #define LL_PWR_WAKEUP_PIN4 (PWR_CSR_EWUP4) /*!< WKUP pin 4 : LLG TBD */
  148. #endif /* PWR_CSR_EWUP4 */
  149. #if defined(PWR_CSR_EWUP5)
  150. #define LL_PWR_WAKEUP_PIN5 (PWR_CSR_EWUP5) /*!< WKUP pin 5 : LLG TBD */
  151. #endif /* PWR_CSR_EWUP5 */
  152. #if defined(PWR_CSR_EWUP6)
  153. #define LL_PWR_WAKEUP_PIN6 (PWR_CSR_EWUP6) /*!< WKUP pin 6 : LLG TBD */
  154. #endif /* PWR_CSR_EWUP6 */
  155. #if defined(PWR_CSR_EWUP7)
  156. #define LL_PWR_WAKEUP_PIN7 (PWR_CSR_EWUP7) /*!< WKUP pin 7 : LLG TBD */
  157. #endif /* PWR_CSR_EWUP7 */
  158. #if defined(PWR_CSR_EWUP8)
  159. #define LL_PWR_WAKEUP_PIN8 (PWR_CSR_EWUP8) /*!< WKUP pin 8 : LLG TBD */
  160. #endif /* PWR_CSR_EWUP8 */
  161. /**
  162. * @}
  163. */
  164. /**
  165. * @}
  166. */
  167. /* Exported macro ------------------------------------------------------------*/
  168. /** @defgroup PWR_LL_Exported_Macros PWR Exported Macros
  169. * @{
  170. */
  171. /** @defgroup PWR_LL_EM_WRITE_READ Common write and read registers Macros
  172. * @{
  173. */
  174. /**
  175. * @brief Write a value in PWR register
  176. * @param __REG__ Register to be written
  177. * @param __VALUE__ Value to be written in the register
  178. * @retval None
  179. */
  180. #define LL_PWR_WriteReg(__REG__, __VALUE__) WRITE_REG(PWR->__REG__, (__VALUE__))
  181. /**
  182. * @brief Read a value in PWR register
  183. * @param __REG__ Register to be read
  184. * @retval Register value
  185. */
  186. #define LL_PWR_ReadReg(__REG__) READ_REG(PWR->__REG__)
  187. /**
  188. * @}
  189. */
  190. /**
  191. * @}
  192. */
  193. /* Exported functions --------------------------------------------------------*/
  194. /** @defgroup PWR_LL_Exported_Functions PWR Exported Functions
  195. * @{
  196. */
  197. /** @defgroup PWR_LL_EF_Configuration Configuration
  198. * @{
  199. */
  200. /**
  201. * @brief Enable access to the backup domain
  202. * @rmtoll CR DBP LL_PWR_EnableBkUpAccess
  203. * @retval None
  204. */
  205. __STATIC_INLINE void LL_PWR_EnableBkUpAccess(void)
  206. {
  207. SET_BIT(PWR->CR, PWR_CR_DBP);
  208. }
  209. /**
  210. * @brief Disable access to the backup domain
  211. * @rmtoll CR DBP LL_PWR_DisableBkUpAccess
  212. * @retval None
  213. */
  214. __STATIC_INLINE void LL_PWR_DisableBkUpAccess(void)
  215. {
  216. CLEAR_BIT(PWR->CR, PWR_CR_DBP);
  217. }
  218. /**
  219. * @brief Check if the backup domain is enabled
  220. * @rmtoll CR DBP LL_PWR_IsEnabledBkUpAccess
  221. * @retval State of bit (1 or 0).
  222. */
  223. __STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpAccess(void)
  224. {
  225. return (READ_BIT(PWR->CR, PWR_CR_DBP) == (PWR_CR_DBP));
  226. }
  227. #if defined(PWR_CR_LPDS)
  228. /**
  229. * @brief Set voltage Regulator mode during deep sleep mode
  230. * @rmtoll CR LPDS LL_PWR_SetRegulModeDS
  231. * @param RegulMode This parameter can be one of the following values:
  232. * @arg @ref LL_PWR_REGU_DSMODE_MAIN
  233. * @arg @ref LL_PWR_REGU_DSMODE_LOW_POWER
  234. * @retval None
  235. */
  236. __STATIC_INLINE void LL_PWR_SetRegulModeDS(uint32_t RegulMode)
  237. {
  238. MODIFY_REG(PWR->CR, PWR_CR_LPDS, RegulMode);
  239. }
  240. /**
  241. * @brief Get voltage Regulator mode during deep sleep mode
  242. * @rmtoll CR LPDS LL_PWR_GetRegulModeDS
  243. * @retval Returned value can be one of the following values:
  244. * @arg @ref LL_PWR_REGU_DSMODE_MAIN
  245. * @arg @ref LL_PWR_REGU_DSMODE_LOW_POWER
  246. */
  247. __STATIC_INLINE uint32_t LL_PWR_GetRegulModeDS(void)
  248. {
  249. return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_LPDS));
  250. }
  251. #endif /* PWR_CR_LPDS */
  252. /**
  253. * @brief Set Power Down mode when CPU enters deepsleep
  254. * @rmtoll CR PDDS LL_PWR_SetPowerMode\n
  255. * @rmtoll CR LPDS LL_PWR_SetPowerMode
  256. * @param PDMode This parameter can be one of the following values:
  257. * @arg @ref LL_PWR_MODE_STOP_MAINREGU
  258. * @arg @ref LL_PWR_MODE_STOP_LPREGU
  259. * @arg @ref LL_PWR_MODE_STANDBY
  260. * @retval None
  261. */
  262. __STATIC_INLINE void LL_PWR_SetPowerMode(uint32_t PDMode)
  263. {
  264. MODIFY_REG(PWR->CR, (PWR_CR_PDDS| PWR_CR_LPDS), PDMode);
  265. }
  266. /**
  267. * @brief Get Power Down mode when CPU enters deepsleep
  268. * @rmtoll CR PDDS LL_PWR_GetPowerMode\n
  269. * @rmtoll CR LPDS LL_PWR_GetPowerMode
  270. * @retval Returned value can be one of the following values:
  271. * @arg @ref LL_PWR_MODE_STOP_MAINREGU
  272. * @arg @ref LL_PWR_MODE_STOP_LPREGU
  273. * @arg @ref LL_PWR_MODE_STANDBY
  274. */
  275. __STATIC_INLINE uint32_t LL_PWR_GetPowerMode(void)
  276. {
  277. return (uint32_t)(READ_BIT(PWR->CR, (PWR_CR_PDDS| PWR_CR_LPDS)));
  278. }
  279. #if defined(PWR_PVD_SUPPORT)
  280. /**
  281. * @brief Configure the voltage threshold detected by the Power Voltage Detector
  282. * @rmtoll CR PLS LL_PWR_SetPVDLevel
  283. * @param PVDLevel This parameter can be one of the following values:
  284. * @arg @ref LL_PWR_PVDLEVEL_0
  285. * @arg @ref LL_PWR_PVDLEVEL_1
  286. * @arg @ref LL_PWR_PVDLEVEL_2
  287. * @arg @ref LL_PWR_PVDLEVEL_3
  288. * @arg @ref LL_PWR_PVDLEVEL_4
  289. * @arg @ref LL_PWR_PVDLEVEL_5
  290. * @arg @ref LL_PWR_PVDLEVEL_6
  291. * @arg @ref LL_PWR_PVDLEVEL_7
  292. * @retval None
  293. */
  294. __STATIC_INLINE void LL_PWR_SetPVDLevel(uint32_t PVDLevel)
  295. {
  296. MODIFY_REG(PWR->CR, PWR_CR_PLS, PVDLevel);
  297. }
  298. /**
  299. * @brief Get the voltage threshold detection
  300. * @rmtoll CR PLS LL_PWR_GetPVDLevel
  301. * @retval Returned value can be one of the following values:
  302. * @arg @ref LL_PWR_PVDLEVEL_0
  303. * @arg @ref LL_PWR_PVDLEVEL_1
  304. * @arg @ref LL_PWR_PVDLEVEL_2
  305. * @arg @ref LL_PWR_PVDLEVEL_3
  306. * @arg @ref LL_PWR_PVDLEVEL_4
  307. * @arg @ref LL_PWR_PVDLEVEL_5
  308. * @arg @ref LL_PWR_PVDLEVEL_6
  309. * @arg @ref LL_PWR_PVDLEVEL_7
  310. */
  311. __STATIC_INLINE uint32_t LL_PWR_GetPVDLevel(void)
  312. {
  313. return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_PLS));
  314. }
  315. /**
  316. * @brief Enable Power Voltage Detector
  317. * @rmtoll CR PVDE LL_PWR_EnablePVD
  318. * @retval None
  319. */
  320. __STATIC_INLINE void LL_PWR_EnablePVD(void)
  321. {
  322. SET_BIT(PWR->CR, PWR_CR_PVDE);
  323. }
  324. /**
  325. * @brief Disable Power Voltage Detector
  326. * @rmtoll CR PVDE LL_PWR_DisablePVD
  327. * @retval None
  328. */
  329. __STATIC_INLINE void LL_PWR_DisablePVD(void)
  330. {
  331. CLEAR_BIT(PWR->CR, PWR_CR_PVDE);
  332. }
  333. /**
  334. * @brief Check if Power Voltage Detector is enabled
  335. * @rmtoll CR PVDE LL_PWR_IsEnabledPVD
  336. * @retval State of bit (1 or 0).
  337. */
  338. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPVD(void)
  339. {
  340. return (READ_BIT(PWR->CR, PWR_CR_PVDE) == (PWR_CR_PVDE));
  341. }
  342. #endif /* PWR_PVD_SUPPORT */
  343. /**
  344. * @brief Enable the WakeUp PINx functionality
  345. * @rmtoll CSR EWUP1 LL_PWR_EnableWakeUpPin\n
  346. * @rmtoll CSR EWUP2 LL_PWR_EnableWakeUpPin\n
  347. * @rmtoll CSR EWUP3 LL_PWR_EnableWakeUpPin\n
  348. * @rmtoll CSR EWUP4 LL_PWR_EnableWakeUpPin\n
  349. * @rmtoll CSR EWUP5 LL_PWR_EnableWakeUpPin\n
  350. * @rmtoll CSR EWUP6 LL_PWR_EnableWakeUpPin\n
  351. * @rmtoll CSR EWUP7 LL_PWR_EnableWakeUpPin\n
  352. * @rmtoll CSR EWUP8 LL_PWR_EnableWakeUpPin
  353. * @param WakeUpPin This parameter can be one of the following values:
  354. * @arg @ref LL_PWR_WAKEUP_PIN1
  355. * @arg @ref LL_PWR_WAKEUP_PIN2
  356. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  357. * @arg @ref LL_PWR_WAKEUP_PIN4 (*)
  358. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  359. * @arg @ref LL_PWR_WAKEUP_PIN6 (*)
  360. * @arg @ref LL_PWR_WAKEUP_PIN7 (*)
  361. * @arg @ref LL_PWR_WAKEUP_PIN8 (*)
  362. *
  363. * (*) not available on all devices
  364. * @retval None
  365. */
  366. __STATIC_INLINE void LL_PWR_EnableWakeUpPin(uint32_t WakeUpPin)
  367. {
  368. SET_BIT(PWR->CSR, WakeUpPin);
  369. }
  370. /**
  371. * @brief Disable the WakeUp PINx functionality
  372. * @rmtoll CSR EWUP1 LL_PWR_DisableWakeUpPin\n
  373. * @rmtoll CSR EWUP2 LL_PWR_DisableWakeUpPin\n
  374. * @rmtoll CSR EWUP3 LL_PWR_DisableWakeUpPin\n
  375. * @rmtoll CSR EWUP4 LL_PWR_DisableWakeUpPin\n
  376. * @rmtoll CSR EWUP5 LL_PWR_DisableWakeUpPin\n
  377. * @rmtoll CSR EWUP6 LL_PWR_DisableWakeUpPin\n
  378. * @rmtoll CSR EWUP7 LL_PWR_DisableWakeUpPin\n
  379. * @rmtoll CSR EWUP8 LL_PWR_DisableWakeUpPin
  380. * @param WakeUpPin This parameter can be one of the following values:
  381. * @arg @ref LL_PWR_WAKEUP_PIN1
  382. * @arg @ref LL_PWR_WAKEUP_PIN2
  383. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  384. * @arg @ref LL_PWR_WAKEUP_PIN4 (*)
  385. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  386. * @arg @ref LL_PWR_WAKEUP_PIN6 (*)
  387. * @arg @ref LL_PWR_WAKEUP_PIN7 (*)
  388. * @arg @ref LL_PWR_WAKEUP_PIN8 (*)
  389. *
  390. * (*) not available on all devices
  391. * @retval None
  392. */
  393. __STATIC_INLINE void LL_PWR_DisableWakeUpPin(uint32_t WakeUpPin)
  394. {
  395. CLEAR_BIT(PWR->CSR, WakeUpPin);
  396. }
  397. /**
  398. * @brief Check if the WakeUp PINx functionality is enabled
  399. * @rmtoll CSR EWUP1 LL_PWR_IsEnabledWakeUpPin\n
  400. * @rmtoll CSR EWUP2 LL_PWR_IsEnabledWakeUpPin\n
  401. * @rmtoll CSR EWUP3 LL_PWR_IsEnabledWakeUpPin\n
  402. * @rmtoll CSR EWUP4 LL_PWR_IsEnabledWakeUpPin\n
  403. * @rmtoll CSR EWUP5 LL_PWR_IsEnabledWakeUpPin\n
  404. * @rmtoll CSR EWUP6 LL_PWR_IsEnabledWakeUpPin\n
  405. * @rmtoll CSR EWUP7 LL_PWR_IsEnabledWakeUpPin\n
  406. * @rmtoll CSR EWUP8 LL_PWR_IsEnabledWakeUpPin
  407. * @param WakeUpPin This parameter can be one of the following values:
  408. * @arg @ref LL_PWR_WAKEUP_PIN1
  409. * @arg @ref LL_PWR_WAKEUP_PIN2
  410. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  411. * @arg @ref LL_PWR_WAKEUP_PIN4 (*)
  412. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  413. * @arg @ref LL_PWR_WAKEUP_PIN6 (*)
  414. * @arg @ref LL_PWR_WAKEUP_PIN7 (*)
  415. * @arg @ref LL_PWR_WAKEUP_PIN8 (*)
  416. *
  417. * (*) not available on all devices
  418. * @retval State of bit (1 or 0).
  419. */
  420. __STATIC_INLINE uint32_t LL_PWR_IsEnabledWakeUpPin(uint32_t WakeUpPin)
  421. {
  422. return (READ_BIT(PWR->CSR, WakeUpPin) == (WakeUpPin));
  423. }
  424. /**
  425. * @}
  426. */
  427. /** @defgroup PWR_LL_EF_FLAG_Management FLAG_Management
  428. * @{
  429. */
  430. /**
  431. * @brief Get Wake-up Flag
  432. * @rmtoll CSR WUF LL_PWR_IsActiveFlag_WU
  433. * @retval State of bit (1 or 0).
  434. */
  435. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU(void)
  436. {
  437. return (READ_BIT(PWR->CSR, PWR_CSR_WUF) == (PWR_CSR_WUF));
  438. }
  439. /**
  440. * @brief Get Standby Flag
  441. * @rmtoll CSR SBF LL_PWR_IsActiveFlag_SB
  442. * @retval State of bit (1 or 0).
  443. */
  444. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_SB(void)
  445. {
  446. return (READ_BIT(PWR->CSR, PWR_CSR_SBF) == (PWR_CSR_SBF));
  447. }
  448. #if defined(PWR_PVD_SUPPORT)
  449. /**
  450. * @brief Indicate whether VDD voltage is below the selected PVD threshold
  451. * @rmtoll CSR PVDO LL_PWR_IsActiveFlag_PVDO
  452. * @retval State of bit (1 or 0).
  453. */
  454. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVDO(void)
  455. {
  456. return (READ_BIT(PWR->CSR, PWR_CSR_PVDO) == (PWR_CSR_PVDO));
  457. }
  458. #endif /* PWR_PVD_SUPPORT */
  459. #if defined(PWR_CSR_VREFINTRDYF)
  460. /**
  461. * @brief Get Internal Reference VrefInt Flag
  462. * @rmtoll CSR VREFINTRDYF LL_PWR_IsActiveFlag_VREFINTRDY
  463. * @retval State of bit (1 or 0).
  464. */
  465. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_VREFINTRDY(void)
  466. {
  467. return (READ_BIT(PWR->CSR, PWR_CSR_VREFINTRDYF) == (PWR_CSR_VREFINTRDYF));
  468. }
  469. #endif /* PWR_CSR_VREFINTRDYF */
  470. /**
  471. * @brief Clear Standby Flag
  472. * @rmtoll CR CSBF LL_PWR_ClearFlag_SB
  473. * @retval None
  474. */
  475. __STATIC_INLINE void LL_PWR_ClearFlag_SB(void)
  476. {
  477. SET_BIT(PWR->CR, PWR_CR_CSBF);
  478. }
  479. /**
  480. * @brief Clear Wake-up Flags
  481. * @rmtoll CR CWUF LL_PWR_ClearFlag_WU
  482. * @retval None
  483. */
  484. __STATIC_INLINE void LL_PWR_ClearFlag_WU(void)
  485. {
  486. SET_BIT(PWR->CR, PWR_CR_CWUF);
  487. }
  488. /**
  489. * @}
  490. */
  491. #if defined(USE_FULL_LL_DRIVER)
  492. /** @defgroup PWR_LL_EF_Init De-initialization function
  493. * @{
  494. */
  495. ErrorStatus LL_PWR_DeInit(void);
  496. /**
  497. * @}
  498. */
  499. #endif /* USE_FULL_LL_DRIVER */
  500. /**
  501. * @}
  502. */
  503. /**
  504. * @}
  505. */
  506. #endif /* defined(PWR) */
  507. /**
  508. * @}
  509. */
  510. #ifdef __cplusplus
  511. }
  512. #endif
  513. #endif /* __STM32F0xx_LL_PWR_H */
  514. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/