12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604 |
- /**
- ******************************************************************************
- * @file stm32g4xx_ll_pwr.h
- * @author MCD Application Team
- * @brief Header file of PWR LL module.
- ******************************************************************************
- * @attention
- *
- * Copyright (c) 2019 STMicroelectronics.
- * All rights reserved.
- *
- * This software is licensed under terms that can be found in the LICENSE file
- * in the root directory of this software component.
- * If no LICENSE file comes with this software, it is provided AS-IS.
- *
- ******************************************************************************
- */
- /* Define to prevent recursive inclusion -------------------------------------*/
- #ifndef STM32G4xx_LL_PWR_H
- #define STM32G4xx_LL_PWR_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- /* Includes ------------------------------------------------------------------*/
- #include "stm32g4xx.h"
- /** @addtogroup STM32G4xx_LL_Driver
- * @{
- */
- #if defined(PWR)
- /** @defgroup PWR_LL PWR
- * @{
- */
- /* Private types -------------------------------------------------------------*/
- /* Private variables ---------------------------------------------------------*/
- /* Private constants ---------------------------------------------------------*/
- /* Private macros ------------------------------------------------------------*/
- /* Exported types ------------------------------------------------------------*/
- /* Exported constants --------------------------------------------------------*/
- /** @defgroup PWR_LL_Exported_Constants PWR Exported Constants
- * @{
- */
- /** @defgroup PWR_LL_EC_CLEAR_FLAG Clear Flags Defines
- * @brief Flags defines which can be used with LL_PWR_WriteReg function
- * @{
- */
- #define LL_PWR_SCR_CSBF PWR_SCR_CSBF
- #define LL_PWR_SCR_CWUF PWR_SCR_CWUF
- #define LL_PWR_SCR_CWUF5 PWR_SCR_CWUF5
- #define LL_PWR_SCR_CWUF4 PWR_SCR_CWUF4
- #define LL_PWR_SCR_CWUF3 PWR_SCR_CWUF3
- #define LL_PWR_SCR_CWUF2 PWR_SCR_CWUF2
- #define LL_PWR_SCR_CWUF1 PWR_SCR_CWUF1
- /**
- * @}
- */
- /** @defgroup PWR_LL_EC_GET_FLAG Get Flags Defines
- * @brief Flags defines which can be used with LL_PWR_ReadReg function
- * @{
- */
- #define LL_PWR_SR1_WUFI PWR_SR1_WUFI
- #define LL_PWR_SR1_SBF PWR_SR1_SBF
- #define LL_PWR_SR1_WUF5 PWR_SR1_WUF5
- #define LL_PWR_SR1_WUF4 PWR_SR1_WUF4
- #define LL_PWR_SR1_WUF3 PWR_SR1_WUF3
- #define LL_PWR_SR1_WUF2 PWR_SR1_WUF2
- #define LL_PWR_SR1_WUF1 PWR_SR1_WUF1
- #if defined(PWR_SR2_PVMO4)
- #define LL_PWR_SR2_PVMO4 PWR_SR2_PVMO4
- #endif /* PWR_SR2_PVMO4 */
- #if defined(PWR_SR2_PVMO3)
- #define LL_PWR_SR2_PVMO3 PWR_SR2_PVMO3
- #endif /* PWR_SR2_PVMO3 */
- #if defined(PWR_SR2_PVMO2)
- #define LL_PWR_SR2_PVMO2 PWR_SR2_PVMO2
- #endif /* PWR_SR2_PVMO2 */
- #if defined(PWR_SR2_PVMO1)
- #define LL_PWR_SR2_PVMO1 PWR_SR2_PVMO1
- #endif /* PWR_SR2_PVMO1 */
- #define LL_PWR_SR2_PVDO PWR_SR2_PVDO
- #define LL_PWR_SR2_VOSF PWR_SR2_VOSF
- #define LL_PWR_SR2_REGLPF PWR_SR2_REGLPF
- #define LL_PWR_SR2_REGLPS PWR_SR2_REGLPS
- /**
- * @}
- */
- /** @defgroup PWR_LL_EC_REGU_VOLTAGE REGU VOLTAGE
- * @{
- */
- #define LL_PWR_REGU_VOLTAGE_SCALE1 (PWR_CR1_VOS_0)
- #define LL_PWR_REGU_VOLTAGE_SCALE2 (PWR_CR1_VOS_1)
- /**
- * @}
- */
- /** @defgroup PWR_LL_EC_MODE_PWR MODE PWR
- * @{
- */
- #define LL_PWR_MODE_STOP0 (PWR_CR1_LPMS_STOP0)
- #define LL_PWR_MODE_STOP1 (PWR_CR1_LPMS_STOP1)
- #define LL_PWR_MODE_STANDBY (PWR_CR1_LPMS_STANDBY)
- #define LL_PWR_MODE_SHUTDOWN (PWR_CR1_LPMS_SHUTDOWN)
- /**
- * @}
- */
- /** @defgroup PWR_LL_EC_PVM_VDDUSB_1 Peripheral voltage monitoring
- * @{
- */
- #if defined(PWR_CR2_PVME1)
- #define LL_PWR_PVM_VDDA_COMP (PWR_CR2_PVME1) /* Monitoring VDDA vs. x.xV */
- #endif
- #if defined(PWR_CR2_PVME2)
- #define LL_PWR_PVM_VDDA_FASTDAC (PWR_CR2_PVME2) /* Monitoring VDDA vs. x.xV */
- #endif
- #if defined(PWR_CR2_PVME3)
- #define LL_PWR_PVM_VDDA_ADC (PWR_CR2_PVME3) /* Monitoring VDDA vs. 1.62V */
- #endif
- #if defined(PWR_CR2_PVME4)
- #define LL_PWR_PVM_VDDA_OPAMP_DAC (PWR_CR2_PVME4) /* Monitoring VDDA vs. 1x.xV */
- #endif
- /**
- * @}
- */
- /** @defgroup PWR_LL_EC_PVDLEVEL PVDLEVEL
- * @{
- */
- #define LL_PWR_PVDLEVEL_0 (PWR_CR2_PLS_LEV0) /* VPVD0 around 2.0 V */
- #define LL_PWR_PVDLEVEL_1 (PWR_CR2_PLS_LEV1) /* VPVD1 around 2.2 V */
- #define LL_PWR_PVDLEVEL_2 (PWR_CR2_PLS_LEV2) /* VPVD2 around 2.4 V */
- #define LL_PWR_PVDLEVEL_3 (PWR_CR2_PLS_LEV3) /* VPVD3 around 2.5 V */
- #define LL_PWR_PVDLEVEL_4 (PWR_CR2_PLS_LEV4) /* VPVD4 around 2.6 V */
- #define LL_PWR_PVDLEVEL_5 (PWR_CR2_PLS_LEV5) /* VPVD5 around 2.8 V */
- #define LL_PWR_PVDLEVEL_6 (PWR_CR2_PLS_LEV6) /* VPVD6 around 2.9 V */
- #define LL_PWR_PVDLEVEL_7 (PWR_CR2_PLS_LEV7) /* External input analog voltage (Compare internally to VREFINT) */
- /**
- * @}
- */
- /** @defgroup PWR_LL_EC_WAKEUP WAKEUP
- * @{
- */
- #define LL_PWR_WAKEUP_PIN1 (PWR_CR3_EWUP1)
- #define LL_PWR_WAKEUP_PIN2 (PWR_CR3_EWUP2)
- #define LL_PWR_WAKEUP_PIN3 (PWR_CR3_EWUP3)
- #define LL_PWR_WAKEUP_PIN4 (PWR_CR3_EWUP4)
- #define LL_PWR_WAKEUP_PIN5 (PWR_CR3_EWUP5)
- /**
- * @}
- */
- /** @defgroup PWR_LL_EC_BATT_CHARG_RESISTOR BATT CHARG RESISTOR
- * @{
- */
- #define LL_PWR_BATT_CHARG_RESISTOR_5K ((uint32_t)0x00000000)
- #define LL_PWR_BATT_CHARGRESISTOR_1_5K (PWR_CR4_VBRS)
- /**
- * @}
- */
- /** @defgroup PWR_LL_EC_GPIO GPIO
- * @{
- */
- #define LL_PWR_GPIO_A ((uint32_t)(&(PWR->PUCRA)))
- #define LL_PWR_GPIO_B ((uint32_t)(&(PWR->PUCRB)))
- #define LL_PWR_GPIO_C ((uint32_t)(&(PWR->PUCRC)))
- #define LL_PWR_GPIO_D ((uint32_t)(&(PWR->PUCRD)))
- #define LL_PWR_GPIO_E ((uint32_t)(&(PWR->PUCRE)))
- #define LL_PWR_GPIO_F ((uint32_t)(&(PWR->PUCRF)))
- #define LL_PWR_GPIO_G ((uint32_t)(&(PWR->PUCRG)))
- /**
- * @}
- */
- /** @defgroup PWR_LL_EC_GPIO_BIT GPIO BIT
- * @{
- */
- #define LL_PWR_GPIO_BIT_0 ((uint32_t)0x00000001)
- #define LL_PWR_GPIO_BIT_1 ((uint32_t)0x00000002)
- #define LL_PWR_GPIO_BIT_2 ((uint32_t)0x00000004)
- #define LL_PWR_GPIO_BIT_3 ((uint32_t)0x00000008)
- #define LL_PWR_GPIO_BIT_4 ((uint32_t)0x00000010)
- #define LL_PWR_GPIO_BIT_5 ((uint32_t)0x00000020)
- #define LL_PWR_GPIO_BIT_6 ((uint32_t)0x00000040)
- #define LL_PWR_GPIO_BIT_7 ((uint32_t)0x00000080)
- #define LL_PWR_GPIO_BIT_8 ((uint32_t)0x00000100)
- #define LL_PWR_GPIO_BIT_9 ((uint32_t)0x00000200)
- #define LL_PWR_GPIO_BIT_10 ((uint32_t)0x00000400)
- #define LL_PWR_GPIO_BIT_11 ((uint32_t)0x00000800)
- #define LL_PWR_GPIO_BIT_12 ((uint32_t)0x00001000)
- #define LL_PWR_GPIO_BIT_13 ((uint32_t)0x00002000)
- #define LL_PWR_GPIO_BIT_14 ((uint32_t)0x00004000)
- #define LL_PWR_GPIO_BIT_15 ((uint32_t)0x00008000)
- /**
- * @}
- */
- /**
- * @}
- */
- /* Exported macro ------------------------------------------------------------*/
- /** @defgroup PWR_LL_Exported_Macros PWR Exported Macros
- * @{
- */
- /** @defgroup PWR_LL_EM_WRITE_READ Common Write and read registers Macros
- * @{
- */
- /**
- * @brief Write a value in PWR register
- * @param __REG__ Register to be written
- * @param __VALUE__ Value to be written in the register
- * @retval None
- */
- #define LL_PWR_WriteReg(__REG__, __VALUE__) WRITE_REG(PWR->__REG__, (__VALUE__))
- /**
- * @brief Read a value in PWR register
- * @param __REG__ Register to be read
- * @retval Register value
- */
- #define LL_PWR_ReadReg(__REG__) READ_REG(PWR->__REG__)
- /**
- * @}
- */
- /**
- * @}
- */
- /* Exported functions --------------------------------------------------------*/
- /** @defgroup PWR_LL_Exported_Functions PWR Exported Functions
- * @{
- */
- /** @defgroup PWR_LL_EF_Configuration Configuration
- * @{
- */
- /**
- * @brief Switch the regulator from main mode to low-power mode
- * @rmtoll CR1 LPR LL_PWR_EnableLowPowerRunMode
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnableLowPowerRunMode(void)
- {
- SET_BIT(PWR->CR1, PWR_CR1_LPR);
- }
- /**
- * @brief Switch the regulator from low-power mode to main mode
- * @rmtoll CR1 LPR LL_PWR_DisableLowPowerRunMode
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisableLowPowerRunMode(void)
- {
- CLEAR_BIT(PWR->CR1, PWR_CR1_LPR);
- }
- /**
- * @brief Check if the regulator is in low-power mode
- * @rmtoll CR1 LPR LL_PWR_IsEnabledLowPowerRunMode
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledLowPowerRunMode(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->CR1, PWR_CR1_LPR);
- return ((temp == (PWR_CR1_LPR))?1U:0U);
- }
- /**
- * @brief Switch from run main mode to run low-power mode.
- * @rmtoll CR1 LPR LL_PWR_EnterLowPowerRunMode
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnterLowPowerRunMode(void)
- {
- LL_PWR_EnableLowPowerRunMode();
- }
- /**
- * @brief Switch from run main mode to low-power mode.
- * @rmtoll CR1 LPR LL_PWR_ExitLowPowerRunMode
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_ExitLowPowerRunMode(void)
- {
- LL_PWR_DisableLowPowerRunMode();
- }
- /**
- * @brief Set the main internal regulator output voltage
- * @rmtoll CR1 VOS LL_PWR_SetRegulVoltageScaling
- * @param VoltageScaling This parameter can be one of the following values:
- * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE1
- * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE2
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_SetRegulVoltageScaling(uint32_t VoltageScaling)
- {
- MODIFY_REG(PWR->CR1, PWR_CR1_VOS, VoltageScaling);
- }
- /**
- * @brief Get the main internal regulator output voltage
- * @rmtoll CR1 VOS LL_PWR_GetRegulVoltageScaling
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE1
- * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE2
- */
- __STATIC_INLINE uint32_t LL_PWR_GetRegulVoltageScaling(void)
- {
- return (uint32_t)(READ_BIT(PWR->CR1, PWR_CR1_VOS));
- }
- #if defined(PWR_CR5_R1MODE)
- /**
- * @brief Enable main regulator voltage range 1 boost mode
- * @rmtoll CR5 R1MODE LL_PWR_EnableRange1BoostMode
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnableRange1BoostMode(void)
- {
- CLEAR_BIT(PWR->CR5, PWR_CR5_R1MODE);
- }
- /**
- * @brief Disable main regulator voltage range 1 boost mode
- * @rmtoll CR5 R1MODE LL_PWR_DisableRange1BoostMode
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisableRange1BoostMode(void)
- {
- SET_BIT(PWR->CR5, PWR_CR5_R1MODE);
- }
- /**
- * @brief Check if the main regulator voltage range 1 boost mode is enabled
- * @rmtoll CR5 R1MODE LL_PWR_IsEnabledRange1BoostMode
- * @retval Inverted state of bit (0 or 1).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledRange1BoostMode(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->CR5, PWR_CR5_R1MODE);
- return ((temp == (0U))?1U:0U);
- }
- #endif /* PWR_CR5_R1MODE */
- /**
- * @brief Enable access to the backup domain
- * @rmtoll CR1 DBP LL_PWR_EnableBkUpAccess
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnableBkUpAccess(void)
- {
- SET_BIT(PWR->CR1, PWR_CR1_DBP);
- }
- /**
- * @brief Disable access to the backup domain
- * @rmtoll CR1 DBP LL_PWR_DisableBkUpAccess
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisableBkUpAccess(void)
- {
- CLEAR_BIT(PWR->CR1, PWR_CR1_DBP);
- }
- /**
- * @brief Check if the backup domain is enabled
- * @rmtoll CR1 DBP LL_PWR_IsEnabledBkUpAccess
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpAccess(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->CR1, PWR_CR1_DBP);
- return ((temp == (PWR_CR1_DBP))?1U:0U);
- }
- /**
- * @brief Set Low-Power mode
- * @rmtoll CR1 LPMS LL_PWR_SetPowerMode
- * @param LowPowerMode This parameter can be one of the following values:
- * @arg @ref LL_PWR_MODE_STOP0
- * @arg @ref LL_PWR_MODE_STOP1
- * @arg @ref LL_PWR_MODE_STANDBY
- * @arg @ref LL_PWR_MODE_SHUTDOWN
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_SetPowerMode(uint32_t LowPowerMode)
- {
- MODIFY_REG(PWR->CR1, PWR_CR1_LPMS, LowPowerMode);
- }
- /**
- * @brief Get Low-Power mode
- * @rmtoll CR1 LPMS LL_PWR_GetPowerMode
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_PWR_MODE_STOP0
- * @arg @ref LL_PWR_MODE_STOP1
- * @arg @ref LL_PWR_MODE_STANDBY
- * @arg @ref LL_PWR_MODE_SHUTDOWN
- */
- __STATIC_INLINE uint32_t LL_PWR_GetPowerMode(void)
- {
- return (uint32_t)(READ_BIT(PWR->CR1, PWR_CR1_LPMS));
- }
- #if defined(PWR_CR3_UCPD_STDBY)
- /**
- * @brief Enable the USB Type-C and Power Delivery memorization in Standby mode.
- * @note This function must be called just before entering Standby mode.
- * @rmtoll CR3 UCPD_STDBY LL_PWR_EnableUCPDStandbyMode
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnableUCPDStandbyMode(void)
- {
- SET_BIT(PWR->CR3, PWR_CR3_UCPD_STDBY);
- }
- /**
- * @brief Disable the USB Type-C and Power Delivery memorization in Standby mode.
- * @note This function must be called after exiting Standby mode and before any
- * UCPD configuration update.
- * @rmtoll CR3 UCPD_STDBY LL_PWR_DisableUCPDStandbyMode
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisableUCPDStandbyMode(void)
- {
- CLEAR_BIT(PWR->CR3, PWR_CR3_UCPD_STDBY);
- }
- /**
- * @brief Check the USB Type-C and Power Delivery Standby mode memorization state.
- * @rmtoll CR3 UCPD_STDBY LL_PWR_IsEnabledUCPDStandbyMode
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledUCPDStandbyMode(void)
- {
- return ((READ_BIT(PWR->CR3, PWR_CR3_UCPD_STDBY) == (PWR_CR3_UCPD_STDBY)) ? 1UL : 0UL);
- }
- #endif /* PWR_CR3_UCPD_STDBY */
- #if defined(PWR_CR3_UCPD_DBDIS)
- /**
- * @brief Enable the USB Type-C and power delivery dead battery pull-down behavior
- * on UCPD CC1 and CC2 pins.
- * @note After exiting reset, the USB Type-C dead battery behavior is enabled,
- * which may have a pull-down effect on CC1 and CC2 pins. It is recommended
- * to disable it in all cases, either to stop this pull-down or to hand over
- * control to the UCPD (which should therefore be initialized before doing the disable).
- * @rmtoll CR3 UCPD_DBDIS LL_PWR_EnableUCPDDeadBattery
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnableUCPDDeadBattery(void)
- {
- CLEAR_BIT(PWR->CR3, PWR_CR3_UCPD_DBDIS);
- }
- /**
- * @brief Disable the USB Type-C and power delivery dead battery pull-down behavior
- * on UCPD CC1 and CC2 pins.
- * @note After exiting reset, the USB Type-C dead battery behavior is enabled,
- * which may have a pull-down effect on CC1 and CC2 pins. It is recommended
- * to disable it in all cases, either to stop this pull-down or to hand over
- * control to the UCPD (which should therefore be initialized before doing the disable).
- * @rmtoll CR3 UCPD_DBDIS LL_PWR_DisableUCPDDeadBattery
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisableUCPDDeadBattery(void)
- {
- SET_BIT(PWR->CR3, PWR_CR3_UCPD_DBDIS);
- }
- /**
- * @brief Check the USB Type-C and power delivery dead battery pull-down behavior
- * on UCPD CC1 and CC2 pins.
- * @note After exiting reset, the USB Type-C dead battery behavior is enabled,
- * which may have a pull-down effect on CC1 and CC2 pins. It is recommended
- * to disable it in all cases, either to stop this pull-down or to hand over
- * control to the UCPD (which should therefore be initialized before doing the disable).
- * @rmtoll CR3 UCPD_DBDIS LL_PWR_IsEnabledUCPDDeadBattery
- * @retval State of feature (1 : enabled; 0 : disabled).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledUCPDDeadBattery(void)
- {
- return ((READ_BIT(PWR->CR3, PWR_CR3_UCPD_DBDIS) == (PWR_CR3_UCPD_DBDIS)) ? 0UL : 1UL);
- }
- #endif /* PWR_CR3_UCPD_DBDIS */
- #if defined(PWR_CR2_USV)
- /**
- * @brief Enable VDDUSB supply
- * @rmtoll CR2 USV LL_PWR_EnableVddUSB
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnableVddUSB(void)
- {
- SET_BIT(PWR->CR2, PWR_CR2_USV);
- }
- /**
- * @brief Disable VDDUSB supply
- * @rmtoll CR2 USV LL_PWR_DisableVddUSB
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisableVddUSB(void)
- {
- CLEAR_BIT(PWR->CR2, PWR_CR2_USV);
- }
- /**
- * @brief Check if VDDUSB supply is enabled
- * @rmtoll CR2 USV LL_PWR_IsEnabledVddUSB
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledVddUSB(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->CR2, PWR_CR2_USV);
- return ((temp == (PWR_CR2_USV))?1U:0U);
- }
- #endif
- #if defined(PWR_CR2_IOSV)
- /**
- * @brief Enable VDDIO2 supply
- * @rmtoll CR2 IOSV LL_PWR_EnableVddIO2
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnableVddIO2(void)
- {
- SET_BIT(PWR->CR2, PWR_CR2_IOSV);
- }
- /**
- * @brief Disable VDDIO2 supply
- * @rmtoll CR2 IOSV LL_PWR_DisableVddIO2
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisableVddIO2(void)
- {
- CLEAR_BIT(PWR->CR2, PWR_CR2_IOSV);
- }
- /**
- * @brief Check if VDDIO2 supply is enabled
- * @rmtoll CR2 IOSV LL_PWR_IsEnabledVddIO2
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledVddIO2(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->CR2, PWR_CR2_IOSV);
- return ((temp == (PWR_CR2_IOSV))?1U:0U);
- }
- #endif
- /**
- * @brief Enable the Power Voltage Monitoring on a peripheral
- * @rmtoll CR2 PVME1 LL_PWR_EnablePVM\n
- * CR2 PVME2 LL_PWR_EnablePVM\n
- * CR2 PVME3 LL_PWR_EnablePVM\n
- * CR2 PVME4 LL_PWR_EnablePVM
- * @param PeriphVoltage This parameter can be one of the following values:
- * @arg @ref LL_PWR_PVM_VDDA_COMP (*)
- * @arg @ref LL_PWR_PVM_VDDA_FASTDAC (*)
- * @arg @ref LL_PWR_PVM_VDDA_ADC
- * @arg @ref LL_PWR_PVM_VDDA_OPAMP_DAC
- *
- * (*) value not defined in all devices
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnablePVM(uint32_t PeriphVoltage)
- {
- SET_BIT(PWR->CR2, PeriphVoltage);
- }
- /**
- * @brief Disable the Power Voltage Monitoring on a peripheral
- * @rmtoll CR2 PVME1 LL_PWR_DisablePVM\n
- * CR2 PVME2 LL_PWR_DisablePVM\n
- * CR2 PVME3 LL_PWR_DisablePVM\n
- * CR2 PVME4 LL_PWR_DisablePVM
- * @param PeriphVoltage This parameter can be one of the following values:
- * @arg @ref LL_PWR_PVM_VDDA_COMP (*)
- * @arg @ref LL_PWR_PVM_VDDA_FASTDAC (*)
- * @arg @ref LL_PWR_PVM_VDDA_ADC
- * @arg @ref LL_PWR_PVM_VDDA_OPAMP_DAC
- *
- * (*) value not defined in all devices
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisablePVM(uint32_t PeriphVoltage)
- {
- CLEAR_BIT(PWR->CR2, PeriphVoltage);
- }
- /**
- * @brief Check if Power Voltage Monitoring is enabled on a peripheral
- * @rmtoll CR2 PVME1 LL_PWR_IsEnabledPVM\n
- * CR2 PVME2 LL_PWR_IsEnabledPVM\n
- * CR2 PVME3 LL_PWR_IsEnabledPVM\n
- * CR2 PVME4 LL_PWR_IsEnabledPVM
- * @param PeriphVoltage This parameter can be one of the following values:
- * @arg @ref LL_PWR_PVM_VDDA_COMP (*)
- * @arg @ref LL_PWR_PVM_VDDA_FASTDAC (*)
- * @arg @ref LL_PWR_PVM_VDDA_ADC
- * @arg @ref LL_PWR_PVM_VDDA_OPAMP_DAC
- *
- * (*) value not defined in all devices
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledPVM(uint32_t PeriphVoltage)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->CR2, PeriphVoltage);
- return ((temp == (PeriphVoltage))?1U:0U);
- }
- /**
- * @brief Configure the voltage threshold detected by the Power Voltage Detector
- * @rmtoll CR2 PLS LL_PWR_SetPVDLevel
- * @param PVDLevel This parameter can be one of the following values:
- * @arg @ref LL_PWR_PVDLEVEL_0
- * @arg @ref LL_PWR_PVDLEVEL_1
- * @arg @ref LL_PWR_PVDLEVEL_2
- * @arg @ref LL_PWR_PVDLEVEL_3
- * @arg @ref LL_PWR_PVDLEVEL_4
- * @arg @ref LL_PWR_PVDLEVEL_5
- * @arg @ref LL_PWR_PVDLEVEL_6
- * @arg @ref LL_PWR_PVDLEVEL_7
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_SetPVDLevel(uint32_t PVDLevel)
- {
- MODIFY_REG(PWR->CR2, PWR_CR2_PLS, PVDLevel);
- }
- /**
- * @brief Get the voltage threshold detection
- * @rmtoll CR2 PLS LL_PWR_GetPVDLevel
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_PWR_PVDLEVEL_0
- * @arg @ref LL_PWR_PVDLEVEL_1
- * @arg @ref LL_PWR_PVDLEVEL_2
- * @arg @ref LL_PWR_PVDLEVEL_3
- * @arg @ref LL_PWR_PVDLEVEL_4
- * @arg @ref LL_PWR_PVDLEVEL_5
- * @arg @ref LL_PWR_PVDLEVEL_6
- * @arg @ref LL_PWR_PVDLEVEL_7
- */
- __STATIC_INLINE uint32_t LL_PWR_GetPVDLevel(void)
- {
- return (uint32_t)(READ_BIT(PWR->CR2, PWR_CR2_PLS));
- }
- /**
- * @brief Enable Power Voltage Detector
- * @rmtoll CR2 PVDE LL_PWR_EnablePVD
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnablePVD(void)
- {
- SET_BIT(PWR->CR2, PWR_CR2_PVDE);
- }
- /**
- * @brief Disable Power Voltage Detector
- * @rmtoll CR2 PVDE LL_PWR_DisablePVD
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisablePVD(void)
- {
- CLEAR_BIT(PWR->CR2, PWR_CR2_PVDE);
- }
- /**
- * @brief Check if Power Voltage Detector is enabled
- * @rmtoll CR2 PVDE LL_PWR_IsEnabledPVD
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledPVD(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->CR2, PWR_CR2_PVDE);
- return ((temp == (PWR_CR2_PVDE))?1U:0U);
- }
- /**
- * @brief Enable Internal Wake-up line
- * @rmtoll CR3 EIWF LL_PWR_EnableInternWU
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnableInternWU(void)
- {
- SET_BIT(PWR->CR3, PWR_CR3_EIWF);
- }
- /**
- * @brief Disable Internal Wake-up line
- * @rmtoll CR3 EIWF LL_PWR_DisableInternWU
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisableInternWU(void)
- {
- CLEAR_BIT(PWR->CR3, PWR_CR3_EIWF);
- }
- /**
- * @brief Check if Internal Wake-up line is enabled
- * @rmtoll CR3 EIWF LL_PWR_IsEnabledInternWU
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledInternWU(void)
- {
- return ((READ_BIT(PWR->CR3, PWR_CR3_EIWF) == (PWR_CR3_EIWF))?1UL:0UL);
- }
- /**
- * @brief Enable pull-up and pull-down configuration
- * @rmtoll CR3 APC LL_PWR_EnablePUPDCfg
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnablePUPDCfg(void)
- {
- SET_BIT(PWR->CR3, PWR_CR3_APC);
- }
- /**
- * @brief Disable pull-up and pull-down configuration
- * @rmtoll CR3 APC LL_PWR_DisablePUPDCfg
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisablePUPDCfg(void)
- {
- CLEAR_BIT(PWR->CR3, PWR_CR3_APC);
- }
- /**
- * @brief Check if pull-up and pull-down configuration is enabled
- * @rmtoll CR3 APC LL_PWR_IsEnabledPUPDCfg
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledPUPDCfg(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->CR3, PWR_CR3_APC);
- return ((temp == (PWR_CR3_APC))?1U:0U);
- }
- #if defined(SRAM2_BASE)
- /**
- * @brief Enable SRAM2 content retention in Standby mode
- * @rmtoll CR3 RRS LL_PWR_EnableSRAM2Retention
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnableSRAM2Retention(void)
- {
- SET_BIT(PWR->CR3, PWR_CR3_RRS);
- }
- /**
- * @brief Disable SRAM2 content retention in Standby mode
- * @rmtoll CR3 RRS LL_PWR_DisableSRAM2Retention
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisableSRAM2Retention(void)
- {
- CLEAR_BIT(PWR->CR3, PWR_CR3_RRS);
- }
- /**
- * @brief Check if SRAM2 content retention in Standby mode is enabled
- * @rmtoll CR3 RRS LL_PWR_IsEnabledSRAM2Retention
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledSRAM2Retention(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->CR3, PWR_CR3_RRS);
- return ((temp == (PWR_CR3_RRS))?1U:0U);
- }
- #endif /* SRAM2_BASE */
- /**
- * @brief Enable the WakeUp PINx functionality
- * @rmtoll CR3 EWUP1 LL_PWR_EnableWakeUpPin\n
- * CR3 EWUP2 LL_PWR_EnableWakeUpPin\n
- * CR3 EWUP3 LL_PWR_EnableWakeUpPin\n
- * CR3 EWUP4 LL_PWR_EnableWakeUpPin\n
- * CR3 EWUP5 LL_PWR_EnableWakeUpPin\n
- * @param WakeUpPin This parameter can be one of the following values:
- * @arg @ref LL_PWR_WAKEUP_PIN1
- * @arg @ref LL_PWR_WAKEUP_PIN2
- * @arg @ref LL_PWR_WAKEUP_PIN3
- * @arg @ref LL_PWR_WAKEUP_PIN4
- * @arg @ref LL_PWR_WAKEUP_PIN5
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnableWakeUpPin(uint32_t WakeUpPin)
- {
- SET_BIT(PWR->CR3, WakeUpPin);
- }
- /**
- * @brief Disable the WakeUp PINx functionality
- * @rmtoll CR3 EWUP1 LL_PWR_DisableWakeUpPin\n
- * CR3 EWUP2 LL_PWR_DisableWakeUpPin\n
- * CR3 EWUP3 LL_PWR_DisableWakeUpPin\n
- * CR3 EWUP4 LL_PWR_DisableWakeUpPin\n
- * CR3 EWUP5 LL_PWR_DisableWakeUpPin\n
- * @param WakeUpPin This parameter can be one of the following values:
- * @arg @ref LL_PWR_WAKEUP_PIN1
- * @arg @ref LL_PWR_WAKEUP_PIN2
- * @arg @ref LL_PWR_WAKEUP_PIN3
- * @arg @ref LL_PWR_WAKEUP_PIN4
- * @arg @ref LL_PWR_WAKEUP_PIN5
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisableWakeUpPin(uint32_t WakeUpPin)
- {
- CLEAR_BIT(PWR->CR3, WakeUpPin);
- }
- /**
- * @brief Check if the WakeUp PINx functionality is enabled
- * @rmtoll CR3 EWUP1 LL_PWR_IsEnabledWakeUpPin\n
- * CR3 EWUP2 LL_PWR_IsEnabledWakeUpPin\n
- * CR3 EWUP3 LL_PWR_IsEnabledWakeUpPin\n
- * CR3 EWUP4 LL_PWR_IsEnabledWakeUpPin\n
- * CR3 EWUP5 LL_PWR_IsEnabledWakeUpPin\n
- * @param WakeUpPin This parameter can be one of the following values:
- * @arg @ref LL_PWR_WAKEUP_PIN1
- * @arg @ref LL_PWR_WAKEUP_PIN2
- * @arg @ref LL_PWR_WAKEUP_PIN3
- * @arg @ref LL_PWR_WAKEUP_PIN4
- * @arg @ref LL_PWR_WAKEUP_PIN5
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledWakeUpPin(uint32_t WakeUpPin)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->CR3, WakeUpPin);
- return ((temp == (WakeUpPin))?1U:0U);
- }
- /**
- * @brief Set the resistor impedance
- * @rmtoll CR4 VBRS LL_PWR_SetBattChargResistor
- * @param Resistor This parameter can be one of the following values:
- * @arg @ref LL_PWR_BATT_CHARG_RESISTOR_5K
- * @arg @ref LL_PWR_BATT_CHARGRESISTOR_1_5K
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_SetBattChargResistor(uint32_t Resistor)
- {
- MODIFY_REG(PWR->CR4, PWR_CR4_VBRS, Resistor);
- }
- /**
- * @brief Get the resistor impedance
- * @rmtoll CR4 VBRS LL_PWR_GetBattChargResistor
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_PWR_BATT_CHARG_RESISTOR_5K
- * @arg @ref LL_PWR_BATT_CHARGRESISTOR_1_5K
- */
- __STATIC_INLINE uint32_t LL_PWR_GetBattChargResistor(void)
- {
- return (uint32_t)(READ_BIT(PWR->CR4, PWR_CR4_VBRS));
- }
- /**
- * @brief Enable battery charging
- * @rmtoll CR4 VBE LL_PWR_EnableBatteryCharging
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnableBatteryCharging(void)
- {
- SET_BIT(PWR->CR4, PWR_CR4_VBE);
- }
- /**
- * @brief Disable battery charging
- * @rmtoll CR4 VBE LL_PWR_DisableBatteryCharging
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisableBatteryCharging(void)
- {
- CLEAR_BIT(PWR->CR4, PWR_CR4_VBE);
- }
- /**
- * @brief Check if battery charging is enabled
- * @rmtoll CR4 VBE LL_PWR_IsEnabledBatteryCharging
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledBatteryCharging(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->CR4, PWR_CR4_VBE);
- return ((temp == (PWR_CR4_VBE))?1U:0U);
- }
- /**
- * @brief Set the Wake-Up pin polarity low for the event detection
- * @rmtoll CR4 WP1 LL_PWR_SetWakeUpPinPolarityLow\n
- * CR4 WP2 LL_PWR_SetWakeUpPinPolarityLow\n
- * CR4 WP3 LL_PWR_SetWakeUpPinPolarityLow\n
- * CR4 WP4 LL_PWR_SetWakeUpPinPolarityLow\n
- * CR4 WP5 LL_PWR_SetWakeUpPinPolarityLow
- * @param WakeUpPin This parameter can be one of the following values:
- * @arg @ref LL_PWR_WAKEUP_PIN1
- * @arg @ref LL_PWR_WAKEUP_PIN2
- * @arg @ref LL_PWR_WAKEUP_PIN3
- * @arg @ref LL_PWR_WAKEUP_PIN4
- * @arg @ref LL_PWR_WAKEUP_PIN5
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_SetWakeUpPinPolarityLow(uint32_t WakeUpPin)
- {
- SET_BIT(PWR->CR4, WakeUpPin);
- }
- /**
- * @brief Set the Wake-Up pin polarity high for the event detection
- * @rmtoll CR4 WP1 LL_PWR_SetWakeUpPinPolarityHigh\n
- * CR4 WP2 LL_PWR_SetWakeUpPinPolarityHigh\n
- * CR4 WP3 LL_PWR_SetWakeUpPinPolarityHigh\n
- * CR4 WP4 LL_PWR_SetWakeUpPinPolarityHigh\n
- * CR4 WP5 LL_PWR_SetWakeUpPinPolarityHigh
- * @param WakeUpPin This parameter can be one of the following values:
- * @arg @ref LL_PWR_WAKEUP_PIN1
- * @arg @ref LL_PWR_WAKEUP_PIN2
- * @arg @ref LL_PWR_WAKEUP_PIN3
- * @arg @ref LL_PWR_WAKEUP_PIN4
- * @arg @ref LL_PWR_WAKEUP_PIN5
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_SetWakeUpPinPolarityHigh(uint32_t WakeUpPin)
- {
- CLEAR_BIT(PWR->CR4, WakeUpPin);
- }
- /**
- * @brief Get the Wake-Up pin polarity for the event detection
- * @rmtoll CR4 WP1 LL_PWR_IsWakeUpPinPolarityLow\n
- * CR4 WP2 LL_PWR_IsWakeUpPinPolarityLow\n
- * CR4 WP3 LL_PWR_IsWakeUpPinPolarityLow\n
- * CR4 WP4 LL_PWR_IsWakeUpPinPolarityLow\n
- * CR4 WP5 LL_PWR_IsWakeUpPinPolarityLow
- * @param WakeUpPin This parameter can be one of the following values:
- * @arg @ref LL_PWR_WAKEUP_PIN1
- * @arg @ref LL_PWR_WAKEUP_PIN2
- * @arg @ref LL_PWR_WAKEUP_PIN3
- * @arg @ref LL_PWR_WAKEUP_PIN4
- * @arg @ref LL_PWR_WAKEUP_PIN5
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsWakeUpPinPolarityLow(uint32_t WakeUpPin)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->CR4, WakeUpPin);
- return ((temp == (WakeUpPin))?1U:0U);
- }
- /**
- * @brief Enable GPIO pull-up state in Standby and Shutdown modes
- * @rmtoll PUCRA PU0-15 LL_PWR_EnableGPIOPullUp\n
- * PUCRB PU0-15 LL_PWR_EnableGPIOPullUp\n
- * PUCRC PU0-15 LL_PWR_EnableGPIOPullUp\n
- * PUCRD PU0-15 LL_PWR_EnableGPIOPullUp\n
- * PUCRE PU0-15 LL_PWR_EnableGPIOPullUp\n
- * PUCRF PU0-15 LL_PWR_EnableGPIOPullUp\n
- * PUCRG PU0-15 LL_PWR_EnableGPIOPullUp\n
- * @param GPIO This parameter can be one of the following values:
- * @arg @ref LL_PWR_GPIO_A
- * @arg @ref LL_PWR_GPIO_B
- * @arg @ref LL_PWR_GPIO_C
- * @arg @ref LL_PWR_GPIO_D
- * @arg @ref LL_PWR_GPIO_E
- * @arg @ref LL_PWR_GPIO_F
- * @arg @ref LL_PWR_GPIO_G
- *
- * (*) value not defined in all devices
- * @param GPIONumber This parameter can be one of the following values:
- * @arg @ref LL_PWR_GPIO_BIT_0
- * @arg @ref LL_PWR_GPIO_BIT_1
- * @arg @ref LL_PWR_GPIO_BIT_2
- * @arg @ref LL_PWR_GPIO_BIT_3
- * @arg @ref LL_PWR_GPIO_BIT_4
- * @arg @ref LL_PWR_GPIO_BIT_5
- * @arg @ref LL_PWR_GPIO_BIT_6
- * @arg @ref LL_PWR_GPIO_BIT_7
- * @arg @ref LL_PWR_GPIO_BIT_8
- * @arg @ref LL_PWR_GPIO_BIT_9
- * @arg @ref LL_PWR_GPIO_BIT_10
- * @arg @ref LL_PWR_GPIO_BIT_11
- * @arg @ref LL_PWR_GPIO_BIT_12
- * @arg @ref LL_PWR_GPIO_BIT_13
- * @arg @ref LL_PWR_GPIO_BIT_14
- * @arg @ref LL_PWR_GPIO_BIT_15
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnableGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
- {
- SET_BIT(*((__IO uint32_t *)GPIO), GPIONumber);
- }
- /**
- * @brief Disable GPIO pull-up state in Standby and Shutdown modes
- * @rmtoll PUCRA PU0-15 LL_PWR_DisableGPIOPullUp\n
- * PUCRB PU0-15 LL_PWR_DisableGPIOPullUp\n
- * PUCRC PU0-15 LL_PWR_DisableGPIOPullUp\n
- * PUCRD PU0-15 LL_PWR_DisableGPIOPullUp\n
- * PUCRE PU0-15 LL_PWR_DisableGPIOPullUp\n
- * PUCRF PU0-15 LL_PWR_DisableGPIOPullUp\n
- * PUCRG PU0-15 LL_PWR_DisableGPIOPullUp\n
- * @param GPIO This parameter can be one of the following values:
- * @arg @ref LL_PWR_GPIO_A
- * @arg @ref LL_PWR_GPIO_B
- * @arg @ref LL_PWR_GPIO_C
- * @arg @ref LL_PWR_GPIO_D
- * @arg @ref LL_PWR_GPIO_E
- * @arg @ref LL_PWR_GPIO_F
- * @arg @ref LL_PWR_GPIO_G
- *
- * (*) value not defined in all devices
- * @param GPIONumber This parameter can be one of the following values:
- * @arg @ref LL_PWR_GPIO_BIT_0
- * @arg @ref LL_PWR_GPIO_BIT_1
- * @arg @ref LL_PWR_GPIO_BIT_2
- * @arg @ref LL_PWR_GPIO_BIT_3
- * @arg @ref LL_PWR_GPIO_BIT_4
- * @arg @ref LL_PWR_GPIO_BIT_5
- * @arg @ref LL_PWR_GPIO_BIT_6
- * @arg @ref LL_PWR_GPIO_BIT_7
- * @arg @ref LL_PWR_GPIO_BIT_8
- * @arg @ref LL_PWR_GPIO_BIT_9
- * @arg @ref LL_PWR_GPIO_BIT_10
- * @arg @ref LL_PWR_GPIO_BIT_11
- * @arg @ref LL_PWR_GPIO_BIT_12
- * @arg @ref LL_PWR_GPIO_BIT_13
- * @arg @ref LL_PWR_GPIO_BIT_14
- * @arg @ref LL_PWR_GPIO_BIT_15
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisableGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
- {
- CLEAR_BIT(*((__IO uint32_t *)GPIO), GPIONumber);
- }
- /**
- * @brief Check if GPIO pull-up state is enabled
- * @rmtoll PUCRA PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
- * PUCRB PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
- * PUCRC PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
- * PUCRD PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
- * PUCRE PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
- * PUCRF PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
- * PUCRG PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
- * @param GPIO This parameter can be one of the following values:
- * @arg @ref LL_PWR_GPIO_A
- * @arg @ref LL_PWR_GPIO_B
- * @arg @ref LL_PWR_GPIO_C
- * @arg @ref LL_PWR_GPIO_D
- * @arg @ref LL_PWR_GPIO_E
- * @arg @ref LL_PWR_GPIO_F
- * @arg @ref LL_PWR_GPIO_G
- *
- * (*) value not defined in all devices
- * @param GPIONumber This parameter can be one of the following values:
- * @arg @ref LL_PWR_GPIO_BIT_0
- * @arg @ref LL_PWR_GPIO_BIT_1
- * @arg @ref LL_PWR_GPIO_BIT_2
- * @arg @ref LL_PWR_GPIO_BIT_3
- * @arg @ref LL_PWR_GPIO_BIT_4
- * @arg @ref LL_PWR_GPIO_BIT_5
- * @arg @ref LL_PWR_GPIO_BIT_6
- * @arg @ref LL_PWR_GPIO_BIT_7
- * @arg @ref LL_PWR_GPIO_BIT_8
- * @arg @ref LL_PWR_GPIO_BIT_9
- * @arg @ref LL_PWR_GPIO_BIT_10
- * @arg @ref LL_PWR_GPIO_BIT_11
- * @arg @ref LL_PWR_GPIO_BIT_12
- * @arg @ref LL_PWR_GPIO_BIT_13
- * @arg @ref LL_PWR_GPIO_BIT_14
- * @arg @ref LL_PWR_GPIO_BIT_15
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
- {
- return ((READ_BIT(*((__IO uint32_t *)GPIO), GPIONumber) == (GPIONumber)) ? 1UL : 0UL);
- }
- /**
- * @brief Enable GPIO pull-down state in Standby and Shutdown modes
- * @rmtoll PDCRA PD0-15 LL_PWR_EnableGPIOPullDown\n
- * PDCRB PD0-15 LL_PWR_EnableGPIOPullDown\n
- * PDCRC PD0-15 LL_PWR_EnableGPIOPullDown\n
- * PDCRD PD0-15 LL_PWR_EnableGPIOPullDown\n
- * PDCRE PD0-15 LL_PWR_EnableGPIOPullDown\n
- * PDCRF PD0-15 LL_PWR_EnableGPIOPullDown\n
- * PDCRG PD0-15 LL_PWR_EnableGPIOPullDown\n
- * @param GPIO This parameter can be one of the following values:
- * @arg @ref LL_PWR_GPIO_A
- * @arg @ref LL_PWR_GPIO_B
- * @arg @ref LL_PWR_GPIO_C
- * @arg @ref LL_PWR_GPIO_D
- * @arg @ref LL_PWR_GPIO_E
- * @arg @ref LL_PWR_GPIO_F
- * @arg @ref LL_PWR_GPIO_G
- *
- * (*) value not defined in all devices
- * @param GPIONumber This parameter can be one of the following values:
- * @arg @ref LL_PWR_GPIO_BIT_0
- * @arg @ref LL_PWR_GPIO_BIT_1
- * @arg @ref LL_PWR_GPIO_BIT_2
- * @arg @ref LL_PWR_GPIO_BIT_3
- * @arg @ref LL_PWR_GPIO_BIT_4
- * @arg @ref LL_PWR_GPIO_BIT_5
- * @arg @ref LL_PWR_GPIO_BIT_6
- * @arg @ref LL_PWR_GPIO_BIT_7
- * @arg @ref LL_PWR_GPIO_BIT_8
- * @arg @ref LL_PWR_GPIO_BIT_9
- * @arg @ref LL_PWR_GPIO_BIT_10
- * @arg @ref LL_PWR_GPIO_BIT_11
- * @arg @ref LL_PWR_GPIO_BIT_12
- * @arg @ref LL_PWR_GPIO_BIT_13
- * @arg @ref LL_PWR_GPIO_BIT_14
- * @arg @ref LL_PWR_GPIO_BIT_15
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_EnableGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
- {
- SET_BIT(*((__IO uint32_t *)(GPIO + 4U)), GPIONumber);
- }
- /**
- * @brief Disable GPIO pull-down state in Standby and Shutdown modes
- * @rmtoll PDCRA PD0-15 LL_PWR_DisableGPIOPullDown\n
- * PDCRB PD0-15 LL_PWR_DisableGPIOPullDown\n
- * PDCRC PD0-15 LL_PWR_DisableGPIOPullDown\n
- * PDCRD PD0-15 LL_PWR_DisableGPIOPullDown\n
- * PDCRE PD0-15 LL_PWR_DisableGPIOPullDown\n
- * PDCRF PD0-15 LL_PWR_DisableGPIOPullDown\n
- * PDCRG PD0-15 LL_PWR_DisableGPIOPullDown\n
- * @param GPIO This parameter can be one of the following values:
- * @arg @ref LL_PWR_GPIO_A
- * @arg @ref LL_PWR_GPIO_B
- * @arg @ref LL_PWR_GPIO_C
- * @arg @ref LL_PWR_GPIO_D
- * @arg @ref LL_PWR_GPIO_E
- * @arg @ref LL_PWR_GPIO_F
- * @arg @ref LL_PWR_GPIO_G
- *
- * (*) value not defined in all devices
- * @param GPIONumber This parameter can be one of the following values:
- * @arg @ref LL_PWR_GPIO_BIT_0
- * @arg @ref LL_PWR_GPIO_BIT_1
- * @arg @ref LL_PWR_GPIO_BIT_2
- * @arg @ref LL_PWR_GPIO_BIT_3
- * @arg @ref LL_PWR_GPIO_BIT_4
- * @arg @ref LL_PWR_GPIO_BIT_5
- * @arg @ref LL_PWR_GPIO_BIT_6
- * @arg @ref LL_PWR_GPIO_BIT_7
- * @arg @ref LL_PWR_GPIO_BIT_8
- * @arg @ref LL_PWR_GPIO_BIT_9
- * @arg @ref LL_PWR_GPIO_BIT_10
- * @arg @ref LL_PWR_GPIO_BIT_11
- * @arg @ref LL_PWR_GPIO_BIT_12
- * @arg @ref LL_PWR_GPIO_BIT_13
- * @arg @ref LL_PWR_GPIO_BIT_14
- * @arg @ref LL_PWR_GPIO_BIT_15
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_DisableGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
- {
- CLEAR_BIT(*((__IO uint32_t *)(GPIO + 4U)), GPIONumber);
- }
- /**
- * @brief Check if GPIO pull-down state is enabled
- * @rmtoll PDCRA PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
- * PDCRB PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
- * PDCRC PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
- * PDCRD PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
- * PDCRE PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
- * PDCRF PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
- * PDCRG PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
- * @param GPIO This parameter can be one of the following values:
- * @arg @ref LL_PWR_GPIO_A
- * @arg @ref LL_PWR_GPIO_B
- * @arg @ref LL_PWR_GPIO_C
- * @arg @ref LL_PWR_GPIO_D
- * @arg @ref LL_PWR_GPIO_E
- * @arg @ref LL_PWR_GPIO_F
- * @arg @ref LL_PWR_GPIO_G
- *
- * (*) value not defined in all devices
- * @param GPIONumber This parameter can be one of the following values:
- * @arg @ref LL_PWR_GPIO_BIT_0
- * @arg @ref LL_PWR_GPIO_BIT_1
- * @arg @ref LL_PWR_GPIO_BIT_2
- * @arg @ref LL_PWR_GPIO_BIT_3
- * @arg @ref LL_PWR_GPIO_BIT_4
- * @arg @ref LL_PWR_GPIO_BIT_5
- * @arg @ref LL_PWR_GPIO_BIT_6
- * @arg @ref LL_PWR_GPIO_BIT_7
- * @arg @ref LL_PWR_GPIO_BIT_8
- * @arg @ref LL_PWR_GPIO_BIT_9
- * @arg @ref LL_PWR_GPIO_BIT_10
- * @arg @ref LL_PWR_GPIO_BIT_11
- * @arg @ref LL_PWR_GPIO_BIT_12
- * @arg @ref LL_PWR_GPIO_BIT_13
- * @arg @ref LL_PWR_GPIO_BIT_14
- * @arg @ref LL_PWR_GPIO_BIT_15
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsEnabledGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
- {
- return ((READ_BIT(*((__IO uint32_t *)(GPIO + 4U)), GPIONumber) == (GPIONumber)) ? 1UL : 0UL);
- }
- /**
- * @}
- */
- /** @defgroup PWR_LL_EF_FLAG_Management FLAG_Management
- * @{
- */
- /**
- * @brief Get Internal Wake-up line Flag
- * @rmtoll SR1 WUFI LL_PWR_IsActiveFlag_InternWU
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_InternWU(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->SR1, PWR_SR1_WUFI);
- return ((temp == (PWR_SR1_WUFI))?1U:0U);
- }
- /**
- * @brief Get Stand-By Flag
- * @rmtoll SR1 SBF LL_PWR_IsActiveFlag_SB
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_SB(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->SR1, PWR_SR1_SBF);
- return ((temp == (PWR_SR1_SBF))?1U:0U);
- }
- /**
- * @brief Get Wake-up Flag 5
- * @rmtoll SR1 WUF5 LL_PWR_IsActiveFlag_WU5
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU5(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->SR1, PWR_SR1_WUF5);
- return ((temp == (PWR_SR1_WUF5))?1U:0U);
- }
- /**
- * @brief Get Wake-up Flag 4
- * @rmtoll SR1 WUF4 LL_PWR_IsActiveFlag_WU4
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU4(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->SR1, PWR_SR1_WUF4);
- return ((temp == (PWR_SR1_WUF4))?1U:0U);
- }
- /**
- * @brief Get Wake-up Flag 3
- * @rmtoll SR1 WUF3 LL_PWR_IsActiveFlag_WU3
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU3(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->SR1, PWR_SR1_WUF3);
- return ((temp == (PWR_SR1_WUF3))?1U:0U);
- }
- /**
- * @brief Get Wake-up Flag 2
- * @rmtoll SR1 WUF2 LL_PWR_IsActiveFlag_WU2
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU2(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->SR1, PWR_SR1_WUF2);
- return ((temp == (PWR_SR1_WUF2))?1U:0U);
- }
- /**
- * @brief Get Wake-up Flag 1
- * @rmtoll SR1 WUF1 LL_PWR_IsActiveFlag_WU1
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU1(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->SR1, PWR_SR1_WUF1);
- return ((temp == (PWR_SR1_WUF1))?1U:0U);
- }
- /**
- * @brief Clear Stand-By Flag
- * @rmtoll SCR CSBF LL_PWR_ClearFlag_SB
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_ClearFlag_SB(void)
- {
- WRITE_REG(PWR->SCR, PWR_SCR_CSBF);
- }
- /**
- * @brief Clear Wake-up Flags
- * @rmtoll SCR CWUF LL_PWR_ClearFlag_WU
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_ClearFlag_WU(void)
- {
- WRITE_REG(PWR->SCR, PWR_SCR_CWUF);
- }
- /**
- * @brief Clear Wake-up Flag 5
- * @rmtoll SCR CWUF5 LL_PWR_ClearFlag_WU5
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_ClearFlag_WU5(void)
- {
- WRITE_REG(PWR->SCR, PWR_SCR_CWUF5);
- }
- /**
- * @brief Clear Wake-up Flag 4
- * @rmtoll SCR CWUF4 LL_PWR_ClearFlag_WU4
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_ClearFlag_WU4(void)
- {
- WRITE_REG(PWR->SCR, PWR_SCR_CWUF4);
- }
- /**
- * @brief Clear Wake-up Flag 3
- * @rmtoll SCR CWUF3 LL_PWR_ClearFlag_WU3
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_ClearFlag_WU3(void)
- {
- WRITE_REG(PWR->SCR, PWR_SCR_CWUF3);
- }
- /**
- * @brief Clear Wake-up Flag 2
- * @rmtoll SCR CWUF2 LL_PWR_ClearFlag_WU2
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_ClearFlag_WU2(void)
- {
- WRITE_REG(PWR->SCR, PWR_SCR_CWUF2);
- }
- /**
- * @brief Clear Wake-up Flag 1
- * @rmtoll SCR CWUF1 LL_PWR_ClearFlag_WU1
- * @retval None
- */
- __STATIC_INLINE void LL_PWR_ClearFlag_WU1(void)
- {
- WRITE_REG(PWR->SCR, PWR_SCR_CWUF1);
- }
- /**
- * @brief Indicate whether VDDA voltage is below or above PVM4 threshold
- * @rmtoll SR2 PVMO4 LL_PWR_IsActiveFlag_PVMO4
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVMO4(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->SR2, PWR_SR2_PVMO4);
- return ((temp == (PWR_SR2_PVMO4))?1U:0U);
- }
- /**
- * @brief Indicate whether VDDA voltage is below or above PVM3 threshold
- * @rmtoll SR2 PVMO3 LL_PWR_IsActiveFlag_PVMO3
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVMO3(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->SR2, PWR_SR2_PVMO3);
- return ((temp == (PWR_SR2_PVMO3))?1U:0U);
- }
- #if defined(PWR_SR2_PVMO2)
- /**
- * @brief Indicate whether VDDIO2 voltage is below or above PVM2 threshold
- * @rmtoll SR2 PVMO2 LL_PWR_IsActiveFlag_PVMO2
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVMO2(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->SR2, PWR_SR2_PVMO2);
- return ((temp == (PWR_SR2_PVMO2))?1U:0U);
- }
- #endif /* PWR_SR2_PVMO2 */
- #if defined(PWR_SR2_PVMO1)
- /**
- * @brief Indicate whether VDDUSB voltage is below or above PVM1 threshold
- * @rmtoll SR2 PVMO1 LL_PWR_IsActiveFlag_PVMO1
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVMO1(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->SR2, PWR_SR2_PVMO1);
- return ((temp == (PWR_SR2_PVMO1))?1U:0U);
- }
- #endif /* PWR_SR2_PVMO1 */
- /**
- * @brief Indicate whether VDD voltage is below or above the selected PVD threshold
- * @rmtoll SR2 PVDO LL_PWR_IsActiveFlag_PVDO
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVDO(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->SR2, PWR_SR2_PVDO);
- return ((temp == (PWR_SR2_PVDO))?1U:0U);
- }
- /**
- * @brief Indicate whether the regulator is ready in the selected voltage range or if its output voltage is still changing to the required voltage level
- * @rmtoll SR2 VOSF LL_PWR_IsActiveFlag_VOS
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_VOS(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->SR2, PWR_SR2_VOSF);
- return ((temp == (PWR_SR2_VOSF))?1U:0U);
- }
- /**
- * @brief Indicate whether the regulator is ready in main mode or is in low-power mode
- * @note: Take care, return value "0" means the regulator is ready. Return value "1" means the output voltage range is still changing.
- * @rmtoll SR2 REGLPF LL_PWR_IsActiveFlag_REGLPF
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_REGLPF(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->SR2, PWR_SR2_REGLPF);
- return ((temp == (PWR_SR2_REGLPF))?1U:0U);
- }
- /**
- * @brief Indicate whether or not the low-power regulator is ready
- * @rmtoll SR2 REGLPS LL_PWR_IsActiveFlag_REGLPS
- * @retval State of bit (1 or 0).
- */
- __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_REGLPS(void)
- {
- uint32_t temp;
- temp = READ_BIT(PWR->SR2, PWR_SR2_REGLPS);
- return ((temp == (PWR_SR2_REGLPS))?1U:0U);
- }
- /**
- * @}
- */
- #if defined(USE_FULL_LL_DRIVER)
- /** @defgroup PWR_LL_EF_Init De-initialization function
- * @{
- */
- ErrorStatus LL_PWR_DeInit(void);
- /**
- * @}
- */
- #endif /* USE_FULL_LL_DRIVER */
- /** @defgroup PWR_LL_EF_Legacy_Functions Legacy functions name
- * @{
- */
- /* Old functions name kept for legacy purpose, to be replaced by the */
- /* current functions name. */
- #define LL_PWR_IsActiveFlag_VOSF LL_PWR_IsActiveFlag_VOS
- #define LL_PWR_EnableUSBDeadBattery LL_PWR_EnableUCPDDeadBattery
- #define LL_PWR_DisableUSBDeadBattery LL_PWR_DisableUCPDDeadBattery
- #define LL_PWR_IsEnabledUSBDeadBattery LL_PWR_IsEnabledUCPDDeadBattery
- #define LL_PWR_EnableDeadBatteryPD LL_PWR_EnableUCPDDeadBattery
- #define LL_PWR_DisableDeadBatteryPD LL_PWR_DisableUCPDDeadBattery
- #define LL_PWR_EnableUSBStandByModePD LL_PWR_EnableUCPDStandbyMode
- #define LL_PWR_EnableStandByModePD LL_PWR_EnableUCPDStandbyMode
- #define LL_PWR_DisableUSBStandByModePD LL_PWR_DisableUCPDStandbyMode
- #define LL_PWR_DisableStandByModePD LL_PWR_DisableUCPDStandbyMode
- #define LL_PWR_IsEnabledUSBStandByModePD LL_PWR_IsEnabledUCPDStandbyMode
- /**
- * @}
- */
- /**
- * @}
- */
- /**
- * @}
- */
- #endif /* defined(PWR) */
- /**
- * @}
- */
- #ifdef __cplusplus
- }
- #endif
- #endif /* STM32G4xx_LL_PWR_H */
|