HAL PWR Functions

Wakeup pins management functions

group PWR_Exported_Functions_Group1

This section provides functions allowing to configure the wakeup pins:

Functions

hal_status_t HAL_PWR_LP_SetConfigWakeupPin ( uint32_t wakeup_pin , const hal_pwr_wakeup_pin_config_t * p_config )

Set wakeup pin configuration.

Parameters :
  • wakeup_pin – This parameter can be one or a combination of HAL_PWR_WAKEUP_PIN_x where x can be (1..8).

  • p_config – Pointer to a hal_pwr_wakeup_pin_config_t structure.

Return values :
  • HAL_INVALID_PARAM – p_config pointer is NULL.

  • HAL_OK – Wakeup pin has been correctly configured.

void HAL_PWR_LP_GetConfigWakeupPin ( uint32_t wakeup_pin , hal_pwr_wakeup_pin_config_t * p_config )

Get wakeup pin configuration.

Parameters :
  • wakeup_pin – This parameter can be one of HAL_PWR_WAKEUP_PIN_x where x can be (1..8).

  • p_config – Pointer to a hal_pwr_wakeup_pin_config_t structure.

void HAL_PWR_LP_EnableWakeupPin ( uint32_t wakeup_pin )

Enable the wakeup pin configuration.

Note

Wakeup pins are used to wake up the system from Stop 3, Standby and Shutdown modes.

Parameters :

wakeup_pin – This parameter can be one or a combination of HAL_PWR_WAKEUP_PIN_x where x can be (1..8).

void HAL_PWR_LP_DisableWakeupPin ( uint32_t wakeup_pin )

Disable the wakeup pin configuration.

Note

Wakeup pins are used to wake up the system from Stop 3, Standby and Shutdown modes.

Parameters :

wakeup_pin – This parameter can be one or a combination of HAL_PWR_WAKEUP_PIN_x where x can be (1..8).

hal_pwr_wakeup_pin_status_t HAL_PWR_LP_IsEnabledWakeupPin ( uint32_t wakeup_pin )

Check that wakeup pin is enabled.

Parameters :

wakeup_pin – This parameter can be one of HAL_PWR_WAKEUP_PIN_x where x can be (1..8).

Return values :

hal_pwr_wakeup_pin_status_t – The wakeup pin status.

RTC domain write protection management functions

group PWR_Exported_Functions_Group2

This section provides functions allowing to manage RTC domain write protection:

Functions

void HAL_PWR_EnableRTCDomainWriteProtection ( void )

Enable the RTC domain write protection (RCC Backup domain control register RCC_BDCR, RTC registers, TAMP registers, backup registers and backup SRAM).

Note

After a system reset, the RTC domain is protected against possible unwanted write accesses.

void HAL_PWR_DisableRTCDomainWriteProtection ( void )

Disable the RTC domain write protection (RCC Backup domain control register RCC_BDCR, RTC registers, TAMP registers, backup registers and backup SRAM).

hal_pwr_rtc_domain_wrp_status_t HAL_PWR_IsEnabledRTCDomainWriteProtection ( void )

Check if the RTC domain write protection is enabled.

Return values :

hal_pwr_rtc_domain_wrp_status_t – The RTC domain write protection status.

Main regulator management functions

group PWR_Exported_Functions_Group3

This section provides functions allowing to control power supply.

Functions

hal_status_t HAL_PWR_SetMainRegulatorVoltageScalingRange ( hal_pwr_volt_scale_range_t range )

Set the regulator voltage scaling range.

Warning

There are no constraints when moving to voltage scaling range 1.

Warning

Before moving to voltage scaling range 2, it is mandatory to ensure that the system frequency is below 110 MHz.

Warning

Before moving to voltage scaling range 3, it is mandatory to ensure that the system frequency is below 55 MHz.

Warning

Before moving to voltage scaling range 4,it is mandatory to ensure that the system frequency is below 25 MHz.

Parameters :

range – This parameter is an element of hal_pwr_volt_scale_range_t enumeration.

Return values :
  • HAL_ERROR – VOS setting timeout.

  • HAL_OK – Regulator voltage scaling range has been correctly configured.

hal_pwr_volt_scale_range_t HAL_PWR_GetMainRegulatorVoltageScalingRange ( void )

Get the regulator voltage scaling range.

Return values :

Range – The current applied voltage scaling range.

hal_status_t HAL_PWR_SetMainRegulatorSupply ( hal_pwr_main_regulator_supply_t regulator )

Set the system supply regulator configuration.

Parameters :

regulator – This parameter is an element of hal_pwr_main_regulator_supply_t enumeration.

Return values :
  • HAL_ERROR – regulator setting timeout.

  • HAL_OK – System supply regulator has been correctly configured.

hal_pwr_main_regulator_supply_t HAL_PWR_GetMainRegulatorSupply ( void )

Get the system supply regulator configuration.

Return values :

hal_pwr_main_regulator_supply_t – System supply regulator configuration.

void HAL_PWR_SetMainRegulatorStartupMode ( hal_pwr_main_regulator_fast_startup_mode_t mode )

Set the main regulator fast startup mode.

Parameters :

mode – This parameter is an element of hal_pwr_main_regulator_fast_startup_mode_t enumeration.

hal_pwr_main_regulator_fast_startup_mode_t HAL_PWR_GetMainRegulatorStartupMode ( void )

Get the main regulator fast startup mode.

Return values :

hal_pwr_main_regulator_fast_startup_mode_t – The main regulator fast startup mode.

void HAL_PWR_SetAnalogIOSwitchSupply ( hal_pwr_analog_io_switch_supply_t analog_switch_supply )

Set the IO analog switch supply.

Parameters :

analog_switch_supply – This parameter is an element of hal_pwr_analog_io_switch_supply_t enumeration.

hal_pwr_analog_io_switch_supply_t HAL_PWR_GetAnalogIOSwitchSupply ( void )

Get the IO analog switch supply.

Return values :

hal_pwr_analog_io_switch_supply_t – IO Analog switch supply.

hal_status_t HAL_PWR_EnableVddUSBIndependentSupply ( void )

Enable the Vdd USB independent supply.

Return values :
  • HAL_ERROR – Vdd USB independent supply setting timeout.

  • HAL_OK – Vdd USB independent supply has been correctly configured.

void HAL_PWR_DisableVddUSBIndependentSupply ( void )

Disable the Vdd USB independent supply.

hal_pwr_independent_supply_status_t HAL_PWR_IsEnabledVddUSBIndependentSupply ( void )

Check if the Vdd USB independent supply is enabled.

Return values :

hal_pwr_independent_supply_status_t – The VddUSB independent supply status.

hal_status_t HAL_PWR_EnableVddIO2IndependentSupply ( void )

Enable the Vdd IO2 independent supply.

Return values :
  • HAL_ERROR – Vdd IO2 independent supply setting timeout.

  • HAL_OK – Vdd IO2 independent supply has been correctly configured.

void HAL_PWR_DisableVddIO2IndependentSupply ( void )

Disable the Vdd IO2 independent supply.

hal_pwr_independent_supply_status_t HAL_PWR_IsEnabledVddIO2IndependentSupply ( void )

Check if the Vdd USB independent supply is enabled.

Return values :

hal_pwr_independent_supply_status_t – The VddIO2 independent supply status.

hal_status_t HAL_PWR_EnableVddAIndependentSupply ( uint32_t monitor )

Enable the Vdd analog independent supply.

Parameters :

monitor – This parameter can be one or a combination of the following values:

  • HAL_PWR_VDD_ANALOG_MONITOR_1 : Independent VddA voltage monitor 1.

  • HAL_PWR_VDD_ANALOG_MONITOR_2 : Independent VddA voltage monitor 2.

Return values :
  • HAL_ERROR – Independent voltage monitor setting timeout.

  • HAL_OK – Independent voltage monitor has been correctly configured.

void HAL_PWR_DisableVddAIndependentSupply ( void )

Disable the Vdd analog independent supply.

hal_pwr_independent_supply_status_t HAL_PWR_IsEnabledVddAIndependentSupply ( void )

Check if the Vdd analog independent supply is enabled.

Return values :

hal_pwr_independent_supply_status_t – The VddA independent supply status.

hal_status_t HAL_PWR_EnableVdd11USBIndependentSupply ( void )

Enable the Vdd11 USB independent supply.

Return values :

HAL_OK – The Vdd11 USB has been correctly enabled.

void HAL_PWR_DisableVdd11USBIndependentSupply ( void )

Disable the Vdd11 USB independent supply.

hal_pwr_independent_supply_status_t HAL_PWR_IsEnabledVdd11USBIndependentSupply ( void )

Check if the Vdd11 USB independent supply is enabled.

Return values :

hal_pwr_independent_supply_status_t – The Vdd11 USB independent supply status.

hal_status_t HAL_PWR_EnableVddUSBHSTransceiverSupply ( void )

Enable the internal USB HS transceiver supply.

Return values :
  • HAL_ERROR – USB Boost setting timeout or voltage scaling less than range 2.

  • HAL_OK – USB HS has been correctly enabled.

void HAL_PWR_DisableVddUSBHSTransceiverSupply ( void )

Disable the internal USB HS transceiver supply.

hal_pwr_independent_supply_status_t HAL_PWR_IsEnabledVddUSBHSTransceiverSupply ( void )

Check if the internal USB HS transceiver supply is enabled.

Return values :

hal_pwr_independent_supply_status_t – The USB HS transceiver supply status.

Low power mode management functions

group PWR_Exported_Functions_Group4

This section provides functions allowing to manage low power modes:

Functions

void HAL_PWR_ClearCorePendingEvent ( void )

Clear core pending event.

Note

This API clears the pending event in order to enter a given core to Sleep or Stop mode with WFE entry.

Warning

It must be called just before APIs performing enter Sleep and Stop mode using Wait For Event request

void HAL_PWR_EnterSleepMode ( hal_pwr_low_pwr_mode_entry_t sleep_entry )

Enter the core in Sleep mode.

Parameters :

sleep_entry – Parameter to hal_pwr_low_pwr_mode_entry_t enumeration.

void HAL_PWR_EnterStopMode ( hal_pwr_low_pwr_mode_entry_t stop_entry , hal_pwr_stop_mode_t stop_mode )

Enter the MCU in Stop mode.

Parameters :
void HAL_PWR_EnterStandbyMode ( void )

Enter the MCU in Standby mode.

void HAL_PWR_EnterShutdownMode ( void )

Enter the MCU in Shutdown mode.

void HAL_PWR_SetCoreSleepMode ( hal_pwr_core_sleep_mode_t sleep_mode )

Set the core sleep mode configuration.

Parameters :

sleep_mode – This parameter is an element of hal_pwr_core_sleep_mode_t enumeration.

hal_pwr_core_sleep_mode_t HAL_PWR_GetCoreSleepMode ( void )

Get the core sleep mode configuration.

Return values :

hal_pwr_core_sleep_mode_t – The core sleep mode configuration.

void HAL_PWR_EnableCoreSleepOnExit ( void )

Enable SLEEP-ON-EXIT feature when returning from handler mode to thread mode.

void HAL_PWR_DisableCoreSleepOnExit ( void )

Disable SLEEP-ON-EXIT feature when returning from handler mode to thread mode.

hal_pwr_core_sleep_on_exit_status_t HAL_PWR_IsEnabledCoreSleepOnExit ( void )

Check if the Core SLEEP-ON-EXIT is enabled or disabled.

Return values :

hal_pwr_core_sleep_on_exit_status_t – Core sleep on exit status.

void HAL_PWR_EnableCoreSendEventOnPending ( void )

Enable core Send Event On Pending feature.

void HAL_PWR_DisableCoreSendEventOnPending ( void )

Disable core Send Event On Pending.

hal_pwr_core_sev_on_pending_status_t HAL_PWR_IsEnabledCoreSendEventOnPending ( void )

Get core Send Event On Pending.

Return values :

hal_pwr_core_sev_on_pending_status_t – Core send event on pending status.

void HAL_PWR_LP_SetSmartRunDomainMode ( hal_pwr_system_mode_srd_mode_t mode )

Set the Smart Run Domain mode when the System in Stop 0/1/2 mode.

Parameters :

mode – This parameter is an element of hal_pwr_system_mode_srd_mode_t enumeration.

hal_pwr_system_mode_srd_mode_t HAL_PWR_LP_GetSmartRunDomainMode ( void )

Get the Smart Run Domain mode when the System in Stop 0/1/2 mode.

Return values :

hal_pwr_system_mode_srd_mode_t – Smart run domain in Run mod status.

void HAL_PWR_LP_SetBrownoutResetMode ( hal_pwr_brownout_reset_mode_t mode )

Set BOR ultra-low power mode.

Note

BOR operating can be in discontinuous (ultra-low power) mode in Stop 1, Stop 2, Stop 3 and Standby modes and when the regulator is in Range 4 (Run, Sleep or Stop 0 mode).

Parameters :

mode – This parameter is an element of hal_pwr_brownout_reset_mode_t enumeration.

hal_pwr_brownout_reset_mode_t HAL_PWR_LP_GetBrownoutResetMode ( void )

Get BOR ultra-low power mode.

Return values :

hal_pwr_brownout_reset_mode_t – Brownout reset mode status.

void HAL_PWR_Stop3Wakeup_IRQHandler ( uint32_t wakeup_pin )

This function handles the PWR wake-up from Stop 3 interrupt request.

Parameters :

wakeup_pin – This parameter can be one or a combination of the following values:

  • HAL_PWR_WAKEUP_PIN_1 : Wakeup pin 1.

  • HAL_PWR_WAKEUP_PIN_2 : Wakeup pin 2.

  • HAL_PWR_WAKEUP_PIN_3 : Wakeup pin 3.

  • HAL_PWR_WAKEUP_PIN_4 : Wakeup pin 4.

  • HAL_PWR_WAKEUP_PIN_5 : Wakeup pin 5.

  • HAL_PWR_WAKEUP_PIN_6 : Wakeup pin 6.

  • HAL_PWR_WAKEUP_PIN_7 : Wakeup pin 7.

  • HAL_PWR_WAKEUP_PIN_8 : Wakeup pin 8

  • HAL_PWR_WAKEUP_PIN_ALL: Wakeup pin all.

void HAL_PWR_Stop3WakeupCallback ( uint32_t wakeup_pin )

PWR wake-up from Stop 3 interrupt request callback.

Parameters :

wakeup_pin – Specifies the wake-up pin interrupt to be handled. This parameter can be one or a combination of the following values:

  • HAL_PWR_WAKEUP_PIN_1 : Wakeup pin 1.

  • HAL_PWR_WAKEUP_PIN_2 : Wakeup pin 2.

  • HAL_PWR_WAKEUP_PIN_3 : Wakeup pin 3.

  • HAL_PWR_WAKEUP_PIN_4 : Wakeup pin 4.

  • HAL_PWR_WAKEUP_PIN_5 : Wakeup pin 5.

  • HAL_PWR_WAKEUP_PIN_6 : Wakeup pin 6.

  • HAL_PWR_WAKEUP_PIN_7 : Wakeup pin 7.

  • HAL_PWR_WAKEUP_PIN_8 : Wakeup pin 8.

  • HAL_PWR_WAKEUP_PIN_ALL: Wakeup pin all.

Voltage monitoring management functions

group PWR_Exported_Functions_Group5

This section provides functions allowing to configure voltage monitoring.

Functions

void HAL_PWR_SetProgrammableVoltageDetectorLevel ( hal_pwr_pvd_level_t level )

Set the voltage threshold detection by the Programmable Voltage Detector (PVD).

Parameters :

level – This parameter is an element of hal_pwr_pvd_level_t enumeration.

hal_pwr_pvd_level_t HAL_PWR_GetProgrammableVoltageDetectorLevel ( void )

Get the voltage threshold detection by the Programmable Voltage Detector (PVD).

Return values :

hal_pwr_pvd_level_t – The current PVD level.

void HAL_PWR_EnableProgrammableVoltageDetector ( void )

Enable the voltage threshold detection by the Programmable Voltage Detector (PVD).

void HAL_PWR_DisableProgrammableVoltageDetector ( void )

Disable the voltage threshold detection by the Programmable Voltage Detector (PVD).

hal_pwr_pvd_status_t HAL_PWR_IsEnabledProgrammableVoltageDetector ( void )

Check if the Programmable Voltage Detector (PVD) is enabled.

Return values :

hal_pwr_pvd_status_t – The Programmable Voltage Detector status.

void HAL_PWR_EnableVddUSBMonitor ( void )

Enable the Vdd USB voltage monitor.

void HAL_PWR_DisableVddUSBMonitor ( void )

Disable the Vdd USB voltage monitor.

hal_pwr_monitor_status_t HAL_PWR_IsEnabledVddUSBMonitor ( void )

Check if the Vdd USB voltage monitor is enabled.

Return values :

hal_pwr_monitor_status_t – The Vdd USB voltage monitor status.

void HAL_PWR_EnableVddIO2Monitor ( void )

Enable the Vdd IO2 voltage monitor.

void HAL_PWR_DisableVddIO2Monitor ( void )

Disable the Vdd IO2 voltage monitor.

hal_pwr_monitor_status_t HAL_PWR_IsEnabledVddIO2Monitor ( void )

Check if the Vdd IO2 voltage monitor is enabled.

Return values :

hal_pwr_monitor_status_t – The Vdd IO2 voltage monitor status.

void HAL_PWR_EnableVddAMonitor1 ( void )

Enable the Vdd Analog voltage monitor 1.

void HAL_PWR_DisableVddAMonitor1 ( void )

Disable the Vdd Analog voltage monitor 1.

hal_pwr_monitor_status_t HAL_PWR_IsEnabledVddAMonitor1 ( void )

Check if the Vdd Analog voltage monitor 1 is enabled.

Return values :

hal_pwr_monitor_status_t – The Vdd analog voltage monitor 1 status.

void HAL_PWR_EnableVddAMonitor2 ( void )

Enable the Vdd Analog voltage monitor 2.

void HAL_PWR_DisableVddAMonitor2 ( void )

Disable the Vdd Analog voltage monitor 2.

hal_pwr_monitor_status_t HAL_PWR_IsEnabledVddAMonitor2 ( void )

Check if the Vdd Analog voltage monitor 2 is enabled.

Return values :

hal_pwr_monitor_status_t – The Vdd analog voltage monitor 2 status.

void HAL_PWR_EnableTemperatureVbatMonitor ( void )

Enable the temperature and VBAT monitor.

void HAL_PWR_DisableTemperatureVbatMonitor ( void )

Disable the temperature and VBAT monitor.

hal_pwr_monitor_status_t HAL_PWR_IsEnabledTemperatureVbatMonitor ( void )

Check if the temperature and VBAT monitor is enabled or disabled.

Return values :

hal_pwr_monitor_status_t – The temperature and VBAT monitor status.

Memory retention management functions

group PWR_Exported_Functions_Group6

This section provides functions allowing to manage memory content retention.

Functions

hal_status_t HAL_PWR_LP_EnableMemoryRetention ( hal_pwr_memory_retention_t memory )

Enable memory retention.

Parameters :

memory – This parameter is an element of hal_pwr_memory_retention_t enumeration.

Return values :

HAL_OK – The memory retention is successfully enabled.

void HAL_PWR_LP_DisableMemoryRetention ( hal_pwr_memory_retention_t memory )

Disable memory retention.

Parameters :

memory – This parameter is an element of hal_pwr_memory_retention_t enumeration.

hal_pwr_memory_retention_status_t HAL_PWR_LP_IsEnabledMemoryRetention ( hal_pwr_memory_retention_t memory )

Check if the memory retention is enabled.

Parameters :

memory – This parameter is an element of hal_pwr_memory_retention_t enumeration.

Return values :

hal_pwr_memory_retention_status_t – The memory retention status.

void HAL_PWR_LP_EnableMemoryPageRetention ( hal_pwr_memory_retention_t memory , uint32_t page_idx , uint32_t page_nbr )

Enable memory pages retention.

Parameters :
  • memory – This parameter is an element of hal_pwr_memory_retention_t enumeration.

  • page_idx – The starting page of memory.

  • page_nbr – The memory pages number.

void HAL_PWR_LP_DisableMemoryPageRetention ( hal_pwr_memory_retention_t memory , uint32_t page_idx , uint32_t page_nbr )

Disable memory pages retention.

Parameters :
  • memory – This parameter is an element of hal_pwr_memory_retention_t enumeration.

  • page_idx – The starting page of memory.

  • page_nbr – The memory pages number.

hal_pwr_memory_page_retention_status_t HAL_PWR_LP_IsEnabledMemoryPageRetention ( hal_pwr_memory_retention_t memory , uint32_t page_idx )

Check if the memory page retention is enabled.

Parameters :
Return values :

hal_pwr_memory_page_retention_status_t – The memory page retention status.

void HAL_PWR_LP_EnableUCPDRetention ( void )

Enable the UCPD configuration memorization in Stop 3 and Standby mode.

Note

This function must be called just before entering Stop 3 or Standby mode.

void HAL_PWR_LP_DisableUCPDRetention ( void )

Disable UCPD configuration memorization in Stop 3 and Standby mode.

Note

This function must be called on exiting the Stop 3 or Standby mode and before any UCPD configuration update.

hal_pwr_ucpd_retention_status_t HAL_PWR_LP_IsEnabledUCPDRetention ( void )

Check if the UCPD is enabled.

Return values :

hal_pwr_ucpd_retention_status_t – The UCPD retention status.

void HAL_PWR_LP_EnableOTGHSPHYRetention ( void )

Enable OTG HS PHY power during low power modes (Stop2, Stop3 and Standby).

void HAL_PWR_LP_DisableOTGHSPHYRetention ( void )

Disable OTG HS PHY power during low power modes (Stop2, Stop3 and Standby).

hal_pwr_otghsphy_retention_status_t HAL_PWR_LP_IsEnabledOTGHSPHYRetention ( void )

Check if the OTG HS PHY power during low power modes (Stop2, Stop 3 and Standby) is enabled.

Return values :

hal_pwr_otghsphy_retention_status_t – The OTG HS PHY status.

Memories fast wake-up management functions

group PWR_Exported_Functions_Group7

This section provides functions allowing to manage memories fast wake-up.

Functions

void HAL_PWR_LP_EnableMemoryFastWakeup ( uint32_t memories )

Enable the memories fast wakeup from stop mode.

Parameters :

memories – Specifies the memories to be selected. This parameter can be one or a combination of the following values:

  • HAL_PWR_FLASH_STOP01_FAST_WAKEUP : Flash fast wake-up.

  • HAL_PWR_SRAM4_STOP012_FAST_WAKEUP : SRAM4 fast wake-up.

  • HAL_PWR_MEMORIES_FAST_WAKEUP_ALL : All memories fast wake-up.

void HAL_PWR_LP_DisableMemoryFastWakeup ( uint32_t memories )

Disable the memories fast wakeup from stop mode.

Parameters :

memories – Specifies the memories to be selected. This parameter can be one or a combination of the following values:

  • HAL_PWR_FLASH_STOP01_FAST_WAKEUP : Flash fast wake-up.

  • HAL_PWR_SRAM4_STOP012_FAST_WAKEUP : SRAM4 fast wake-up.

  • HAL_PWR_MEMORIES_FAST_WAKEUP_ALL : All memories fast wake-up.

hal_pwr_memory_fast_wakeup_status_t HAL_PWR_LP_IsEnabledMemoryFastWakeup ( uint32_t memory )

Check the flash and SRAM4 memories fast wakeup from Stop mode is enabled.

Parameters :

memory – This parameter can be one of the following values:

Return values :

hal_pwr_memory_fast_wakeup_status_t – The memory fast wakeup status.

Battery management functions

group PWR_Exported_Functions_Group8

This section provides functions allowing to manage battery charging.

Functions

void HAL_PWR_SetConfigBatteryCharging ( hal_pwr_battery_charging_res_value_t value )

Set the Battery charging resistor.

Note

When Vdd is present, charge the external battery through an internal resistor.

Parameters :

value – Specifies the charging resistor. This parameter can be one of the following values:

  • HAL_PWR_BATTERY_CHARGING_RES_5K : 5 KOhm resistor.

  • HAL_PWR_BATTERY_CHARGING_RES_1_5K : 1.5 KOhm resistor.

hal_pwr_battery_charging_res_value_t HAL_PWR_GetConfigBatteryCharging ( void )

Get the Battery charging resistor.

Note

When Vdd is present, charge the external battery through an internal resistor.

Return values :

hal_pwr_battery_charging_res_value_t – The battery charging resistor value.

void HAL_PWR_EnableBatteryCharging ( void )

Enable the Battery charging.

void HAL_PWR_DisableBatteryCharging ( void )

Disable the Battery charging.

hal_pwr_battery_charging_status_t HAL_PWR_IsEnabledBatteryCharging ( void )

Check that battery charging is enabled.

Return values :

hal_pwr_battery_charging_status_t – The battery charging status.

void HAL_PWR_LP_EnableUCPDDeadBattery ( void )

Enable dead battery behavior.

Note

After exiting reset, the USB Type-C (dead battery) behavior is enabled, which might 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 handover control to the UCPD (the UCPD must be initialized before doing the disable).

void HAL_PWR_LP_DisableUCPDDeadBattery ( void )

Disable dead battery behavior.

Note

After exiting reset, the USB Type-C (dead battery) behavior is enabled, which might 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 handover control to the UCPD (the UCPD must be initialized before doing the disable).

hal_pwr_ucpd_dead_battery_status_t HAL_PWR_LP_IsEnabledUCPDDeadBattery ( void )

Check that UCPD dead battery battery is enabled.

Return values :

hal_pwr_ucpd_dead_battery_status_t – The UCPD dead battery status.

I/O Pull management functions

group PWR_Exported_Functions_Group9

This section provides functions allowing to manage power GPIO pull.

Functions

void HAL_PWR_SetConfigGPIOPull ( hal_pwr_gpio_port_t port , uint32_t pin , hal_pwr_gpio_pull_t pull )

Set GPIO pull configuration.

Parameters :
hal_pwr_gpio_pull_t HAL_PWR_GetConfigGPIOPull ( hal_pwr_gpio_port_t port , uint32_t pin )

Get GPIO pull configuration.

Parameters :
  • port – This parameter is an element of hal_pwr_gpio_port_t enumeration.

  • pin – Specify the I/O pins numbers.

Return values :

hal_pwr_gpio_pull_t – The GPIO pull configuration.

void HAL_PWR_EnableGPIOPull ( void )

Enable GPIO pull configuration.

Note

Pull-up set by PUy bit of PWR_PUCRx register is not activated if the corresponding PDy bit of PWR_PDCRx register is also set (pull-down configuration priority is higher). HAL_PWR_LP_SetConfigGPIOPull() API ensure there is no conflict when setting PUy or PDy bit.

Warning

When APC bit is set, the I/O pull-up and pull-down configurations defined in PWR_PUCRx and PWR_PDCRx registers are applied.

void HAL_PWR_DisableGPIOPull ( void )

Disable GPIO pull configuration.

Warning

When APC bit is cleared, the I/O pull-up and pull-down configurations defined in PWR_PUCRx and PWR_PDCRx registers are not applied.

hal_pwr_gpio_pull_config_status_t HAL_PWR_IsEnabledGPIOPull ( void )

Check that gpio pull is enabled.

Warning

When APC bit is cleared, the I/O pull-up and pull-down configurations defined in PWR_PUCRx and PWR_PDCRx registers are not applied.

Return values :

hal_pwr_gpio_pull_config_status_t – The GPIO pull status.