Hal Drivers for L4

Dependents:   BSP OneHopeOnePrayer FINAL_AUDIO_RECORD AudioDemo

Fork of STM32L4xx_HAL_Driver by Senior Design: Sound Monitor

Embed: (wiki syntax)

« Back to documentation index

Extended Peripheral Control functions

Extended Peripheral Control functions
[PWR Extended Exported Functions]

Extended Peripheral Control functions. More...

Functions

uint32_t HAL_PWREx_GetVoltageRange (void)
 Return Voltage Scaling Range.
HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling (uint32_t VoltageScaling)
 Configure the main internal regulator output voltage.
void HAL_PWREx_EnableBatteryCharging (uint32_t ResistorSelection)
 Enable battery charging.
void HAL_PWREx_DisableBatteryCharging (void)
 Disable battery charging.
void HAL_PWREx_EnableVddUSB (void)
 Enable VDDUSB supply.
void HAL_PWREx_DisableVddUSB (void)
 Disable VDDUSB supply.
void HAL_PWREx_EnableVddIO2 (void)
 Enable VDDIO2 supply.
void HAL_PWREx_DisableVddIO2 (void)
 Disable VDDIO2 supply.
void HAL_PWREx_EnableInternalWakeUpLine (void)
 Enable Internal Wake-up Line.
void HAL_PWREx_DisableInternalWakeUpLine (void)
 Disable Internal Wake-up Line.
HAL_StatusTypeDef HAL_PWREx_EnableGPIOPullUp (uint32_t GPIO, uint32_t GPIONumber)
 Enable GPIO pull-up state in Standby and Shutdown modes.
HAL_StatusTypeDef HAL_PWREx_DisableGPIOPullUp (uint32_t GPIO, uint32_t GPIONumber)
 Disable GPIO pull-up state in Standby mode and Shutdown modes.
HAL_StatusTypeDef HAL_PWREx_EnableGPIOPullDown (uint32_t GPIO, uint32_t GPIONumber)
 Enable GPIO pull-down state in Standby and Shutdown modes.
HAL_StatusTypeDef HAL_PWREx_DisableGPIOPullDown (uint32_t GPIO, uint32_t GPIONumber)
 Disable GPIO pull-down state in Standby and Shutdown modes.
void HAL_PWREx_EnablePullUpPullDownConfig (void)
 Enable pull-up and pull-down configuration.
void HAL_PWREx_DisablePullUpPullDownConfig (void)
 Disable pull-up and pull-down configuration.
void HAL_PWREx_EnableSRAM2ContentRetention (void)
 Enable SRAM2 content retention in Standby mode.
void HAL_PWREx_DisableSRAM2ContentRetention (void)
 Disable SRAM2 content retention in Standby mode.
void HAL_PWREx_EnablePVM1 (void)
 Enable the Power Voltage Monitoring 1: VDDUSB versus 1.2V.
void HAL_PWREx_DisablePVM1 (void)
 Disable the Power Voltage Monitoring 1: VDDUSB versus 1.2V.
void HAL_PWREx_EnablePVM2 (void)
 Enable the Power Voltage Monitoring 2: VDDIO2 versus 0.9V.
void HAL_PWREx_DisablePVM2 (void)
 Disable the Power Voltage Monitoring 2: VDDIO2 versus 0.9V.
void HAL_PWREx_EnablePVM3 (void)
 Enable the Power Voltage Monitoring 3: VDDA versus 1.62V.
void HAL_PWREx_DisablePVM3 (void)
 Disable the Power Voltage Monitoring 3: VDDA versus 1.62V.
void HAL_PWREx_EnablePVM4 (void)
 Enable the Power Voltage Monitoring 4: VDDA versus 2.2V.
void HAL_PWREx_DisablePVM4 (void)
 Disable the Power Voltage Monitoring 4: VDDA versus 2.2V.
HAL_StatusTypeDef HAL_PWREx_ConfigPVM (PWR_PVMTypeDef *sConfigPVM)
 Configure the Peripheral Voltage Monitoring (PVM).
void HAL_PWREx_EnableLowPowerRunMode (void)
 Enter Low-power Run mode.
HAL_StatusTypeDef HAL_PWREx_DisableLowPowerRunMode (void)
 Exit Low-power Run mode.
void HAL_PWREx_EnterSTOP1Mode (uint32_t Regulator, uint8_t STOPEntry)
 Enter Stop 1 mode.
void HAL_PWREx_EnterSTOP2Mode (uint8_t STOPEntry)
 Enter Stop 2 mode.
void HAL_PWREx_EnterSHUTDOWNMode (void)
 Enter Shutdown mode.
void HAL_PWREx_PVD_PVM_IRQHandler (void)
 This function handles the PWR PVD/PVMx interrupt request.
__weak void HAL_PWREx_PVM1Callback (void)
 PWR PVM1 interrupt callback.
__weak void HAL_PWREx_PVM2Callback (void)
 PWR PVM2 interrupt callback.
__weak void HAL_PWREx_PVM3Callback (void)
 PWR PVM3 interrupt callback.
__weak void HAL_PWREx_PVM4Callback (void)
 PWR PVM4 interrupt callback.

Detailed Description

Extended Peripheral Control functions.

 ===============================================================================
              ##### Extended Peripheral Initialization and de-initialization functions #####
 ===============================================================================
    [..]


Function Documentation

HAL_StatusTypeDef HAL_PWREx_ConfigPVM ( PWR_PVMTypeDef *  sConfigPVM )

Configure the Peripheral Voltage Monitoring (PVM).

Parameters:
sConfigPVM,:pointer to a PWR_PVMTypeDef structure that contains the PVM configuration information.
Note:
The API configures a single PVM according to the information contained in the input structure. To configure several PVMs, the API must be singly called for each PVM used.
Refer to the electrical characteristics of your device datasheet for more details about the voltage thresholds corresponding to each detection level and to each monitored supply.
Return values:
HALstatus

Definition at line 674 of file stm32l4xx_hal_pwr_ex.c.

HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling ( uint32_t  VoltageScaling )

Configure the main internal regulator output voltage.

Parameters:
VoltageScaling,:specifies the regulator output voltage to achieve a tradeoff between performance and power consumption. This parameter can be one of the following values:

  • PWR_REGULATOR_VOLTAGE_SCALE1: Regulator voltage output range 1 mode, typical output voltage at 1.2 V, system frequency up to 80 MHz.
  • PWR_REGULATOR_VOLTAGE_SCALE2: Regulator voltage output range 2 mode, typical output voltage at 1.0 V, system frequency up to 26 MHz.
Note:
When moving from Range 1 to Range 2, the system frequency must be decreased to a value below 26 MHz before calling HAL_PWREx_ControlVoltageScaling() API. When moving from Range 2 to Range 1, the system frequency can be increased to a value up to 80 MHz after calling HAL_PWREx_ControlVoltageScaling() API.
When moving from Range 2 to Range 1, the API waits for VOSF flag to be cleared before returning the status. If the flag is not cleared within 50 microseconds, HAL_TIMEOUT status is reported.
Return values:
HALStatus

Definition at line 147 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_DisableBatteryCharging ( void   )

Disable battery charging.

Return values:
None

Definition at line 212 of file stm32l4xx_hal_pwr_ex.c.

HAL_StatusTypeDef HAL_PWREx_DisableGPIOPullDown ( uint32_t  GPIO,
uint32_t  GPIONumber 
)

Disable GPIO pull-down state in Standby and Shutdown modes.

Note:
Reset the relevant PDy bits of PWR_PDCRx register used to configure the I/O in pull-down state in Standby and Shutdown modes.
Even if a PDy bit to reset is reserved, the other PDy bits entered as input parameter at the same time are reset.
Parameters:
GPIO,:Specifies the IO port. This parameter can be PWR_GPIO_A..PWR_GPIO_H to select the GPIO peripheral.
GPIONumber,:Specify the I/O pins numbers. This parameter can be one of the following values: PWR_GPIO_BIT_0, ..., PWR_GPIO_BIT_15 (except for PORTH where less I/O pins are available) or the logical OR of several of them to reset several bits for a given port in a single API call.
Return values:
HALStatus

Definition at line 488 of file stm32l4xx_hal_pwr_ex.c.

HAL_StatusTypeDef HAL_PWREx_DisableGPIOPullUp ( uint32_t  GPIO,
uint32_t  GPIONumber 
)

Disable GPIO pull-up state in Standby mode and Shutdown modes.

Note:
Reset the relevant PUy bits of PWR_PUCRx register used to configure the I/O in pull-up state in Standby and Shutdown modes.
Even if a PUy bit to reset is reserved, the other PUy bits entered as input parameter at the same time are reset.
Parameters:
GPIO,:Specifies the IO port. This parameter can be PWR_GPIO_A, ..., PWR_GPIO_H to select the GPIO peripheral.
GPIONumber,:Specify the I/O pins numbers. This parameter can be one of the following values: PWR_GPIO_BIT_0, ..., PWR_GPIO_BIT_15 (except for PORTH where less I/O pins are available) or the logical OR of several of them to reset several bits for a given port in a single API call.
Return values:
HALStatus

Definition at line 365 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_DisableInternalWakeUpLine ( void   )

Disable Internal Wake-up Line.

Return values:
None

Definition at line 275 of file stm32l4xx_hal_pwr_ex.c.

HAL_StatusTypeDef HAL_PWREx_DisableLowPowerRunMode ( void   )

Exit Low-power Run mode.

Note:
Before HAL_PWREx_DisableLowPowerRunMode() completion, the function checks that REGLPF has been properly reset (otherwise, HAL_PWREx_DisableLowPowerRunMode returns HAL_TIMEOUT status). The system clock frequency can then be increased above 2 MHz.
Return values:
HALStatus

Definition at line 848 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_DisablePullUpPullDownConfig ( void   )

Disable pull-up and pull-down configuration.

Note:
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 in Standby and Shutdown modes.
Return values:
None

Definition at line 550 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_DisablePVM1 ( void   )

Disable the Power Voltage Monitoring 1: VDDUSB versus 1.2V.

Return values:
None

Definition at line 597 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_DisablePVM2 ( void   )

Disable the Power Voltage Monitoring 2: VDDIO2 versus 0.9V.

Return values:
None

Definition at line 616 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_DisablePVM3 ( void   )

Disable the Power Voltage Monitoring 3: VDDA versus 1.62V.

Return values:
None

Definition at line 635 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_DisablePVM4 ( void   )

Disable the Power Voltage Monitoring 4: VDDA versus 2.2V.

Return values:
None

Definition at line 654 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_DisableSRAM2ContentRetention ( void   )

Disable SRAM2 content retention in Standby mode.

Note:
When RRS bit is reset, SRAM2 is powered off in Standby mode and its content is lost.
Return values:
None

Definition at line 575 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_DisableVddIO2 ( void   )

Disable VDDIO2 supply.

Return values:
None

Definition at line 255 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_DisableVddUSB ( void   )

Disable VDDUSB supply.

Return values:
None

Definition at line 234 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_EnableBatteryCharging ( uint32_t  ResistorSelection )

Enable battery charging.

When VDD is present, charge the external battery on VBAT thru an internal resistor.

Parameters:
ResistorSelection,:specifies the resistor impedance. This parameter can be one of the following values:

  • PWR_BATTERY_CHARGING_RESISTOR_5: 5 kOhms resistor
  • PWR_BATTERY_CHARGING_RESISTOR_1_5: 1.5 kOhms resistor
Return values:
None

Definition at line 196 of file stm32l4xx_hal_pwr_ex.c.

HAL_StatusTypeDef HAL_PWREx_EnableGPIOPullDown ( uint32_t  GPIO,
uint32_t  GPIONumber 
)

Enable GPIO pull-down state in Standby and Shutdown modes.

Note:
Set the relevant PDy bits of PWR_PDCRx register to configure the I/O in pull-down state in Standby and Shutdown modes.
This state is effective in Standby and Shutdown modes only if APC bit is set through HAL_PWREx_EnablePullUpPullDownConfig() API.
The configuration is lost when exiting the Shutdown mode due to the power-on reset, maintained when exiting the Standby mode.
To avoid any conflict at Standby and Shutdown modes exits, the corresponding PUy bit of PWR_PUCRx register is cleared unless it is reserved.
Even if a PDy bit to set is reserved, the other PDy bits entered as input parameter at the same time are set.
Parameters:
GPIO,:Specify the IO port. This parameter can be PWR_GPIO_A..PWR_GPIO_H to select the GPIO peripheral.
GPIONumber,:Specify the I/O pins numbers. This parameter can be one of the following values: PWR_GPIO_BIT_0, ..., PWR_GPIO_BIT_15 (except for PORTH where less I/O pins are available) or the logical OR of several of them to set several bits for a given port in a single API call.
Return values:
HALStatus

Definition at line 426 of file stm32l4xx_hal_pwr_ex.c.

HAL_StatusTypeDef HAL_PWREx_EnableGPIOPullUp ( uint32_t  GPIO,
uint32_t  GPIONumber 
)

Enable GPIO pull-up state in Standby and Shutdown modes.

Note:
Set the relevant PUy bits of PWR_PUCRx register to configure the I/O in pull-up state in Standby and Shutdown modes.
This state is effective in Standby and Shutdown modes only if APC bit is set through HAL_PWREx_EnablePullUpPullDownConfig() API.
The configuration is lost when exiting the Shutdown mode due to the power-on reset, maintained when exiting the Standby mode.
To avoid any conflict at Standby and Shutdown modes exits, the corresponding PDy bit of PWR_PDCRx register is cleared unless it is reserved.
Even if a PUy bit to set is reserved, the other PUy bits entered as input parameter at the same time are set.
Parameters:
GPIO,:Specify the IO port. This parameter can be PWR_GPIO_A, ..., PWR_GPIO_H to select the GPIO peripheral.
GPIONumber,:Specify the I/O pins numbers. This parameter can be one of the following values: PWR_GPIO_BIT_0, ..., PWR_GPIO_BIT_15 (except for PORTH where less I/O pins are available) or the logical OR of several of them to set several bits for a given port in a single API call.
Return values:
HALStatus

Definition at line 303 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_EnableInternalWakeUpLine ( void   )

Enable Internal Wake-up Line.

Return values:
None

Definition at line 265 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_EnableLowPowerRunMode ( void   )

Enter Low-power Run mode.

Note:
In Low-power Run mode, all I/O pins keep the same state as in Run mode.
When Regulator is set to PWR_LOWPOWERREGULATOR_ON, the user can optionally configure the Flash in power-down monde in setting the RUN_PD bit in FLASH_ACR register. Additionally, the clock frequency must be reduced below 2 MHz. Setting RUN_PD in FLASH_ACR then appropriately reducing the clock frequency must be done before calling HAL_PWREx_EnableLowPowerRunMode() API.
Return values:
None

Definition at line 833 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_EnablePullUpPullDownConfig ( void   )

Enable pull-up and pull-down configuration.

Note:
When APC bit is set, the I/O pull-up and pull-down configurations defined in PWR_PUCRx and PWR_PDCRx registers are applied in Standby and Shutdown modes.
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_PWREx_EnableGPIOPullUp() and HAL_PWREx_EnableGPIOPullDown() API's ensure there is no conflict when setting PUy or PDy bit.
Return values:
None

Definition at line 538 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_EnablePVM1 ( void   )

Enable the Power Voltage Monitoring 1: VDDUSB versus 1.2V.

Return values:
None

Definition at line 588 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_EnablePVM2 ( void   )

Enable the Power Voltage Monitoring 2: VDDIO2 versus 0.9V.

Return values:
None

Definition at line 607 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_EnablePVM3 ( void   )

Enable the Power Voltage Monitoring 3: VDDA versus 1.62V.

Return values:
None

Definition at line 626 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_EnablePVM4 ( void   )

Enable the Power Voltage Monitoring 4: VDDA versus 2.2V.

Return values:
None

Definition at line 645 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_EnableSRAM2ContentRetention ( void   )

Enable SRAM2 content retention in Standby mode.

Note:
When RRS bit is set, SRAM2 is powered by the low-power regulator in Standby mode and its content is kept.
Return values:
None

Definition at line 563 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_EnableVddIO2 ( void   )

Enable VDDIO2 supply.

Note:
Remove VDDIO2 electrical and logical isolation, once VDDIO2 supply is present.
Return values:
None

Definition at line 245 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_EnableVddUSB ( void   )

Enable VDDUSB supply.

Note:
Remove VDDUSB electrical and logical isolation, once VDDUSB supply is present.
Return values:
None

Definition at line 224 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_EnterSHUTDOWNMode ( void   )

Enter Shutdown mode.

Note:
In Shutdown mode, the PLL, the HSI, the MSI, the LSI and the HSE oscillators are switched off. The voltage regulator is disabled and Vcore domain is powered off. SRAM1, SRAM2 and registers contents are lost except for registers in the Backup domain. The BOR is not available.
The I/Os can be configured either with a pull-up or pull-down or can be kept in analog state.
Return values:
None

Definition at line 1002 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_EnterSTOP1Mode ( uint32_t  Regulator,
uint8_t  STOPEntry 
)

Enter Stop 1 mode.

Note:
In Stop 1 mode, all I/O pins keep the same state as in Run mode.
All clocks in the VCORE domain are stopped; the PLL, the MSI, the HSI and the HSE oscillators are disabled. Some peripherals with the wakeup capability (I2Cx, USARTx and LPUART) can switch on the HSI to receive a frame, and switch off the HSI after receiving the frame if it is not a wakeup frame. In this case, the HSI clock is propagated only to the peripheral requesting it. SRAM1, SRAM2 and register contents are preserved. The BOR is available. The voltage regulator can be configured either in normal or low-power mode.
When exiting Stop 1 mode by issuing an interrupt or a wakeup event, the HSI RC oscillator is selected as system clock if STOPWUCK bit in RCC_CFGR register is set; the MSI oscillator is selected if STOPWUCK is cleared.
When the voltage regulator operates in low power mode, an additional startup delay is incurred when waking up from Stop 1 mode. By keeping the internal regulator ON during Stop 1 mode, the consumption is higher although the startup time is reduced.
Parameters:
Regulator,:Specifies the regulator state in Stop 1 mode. This parameter can be one of the following values:

  • PWR_MAINREGULATOR_ON: Stop 1 mode with regulator ON
  • PWR_LOWPOWERREGULATOR_ON: Stop 1 mode with low power regulator ON This parameter has no effect when entering stop mode 2.
STOPEntry,:specifies if Stop mode in entered with WFI or WFE instruction. This parameter can be one of the following values:

  • PWR_STOPENTRY_WFI: Enter Stop mode with WFI instruction
  • PWR_STOPENTRY_WFE: Enter Stop mode with WFE instruction
Return values:
None

Definition at line 899 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_EnterSTOP2Mode ( uint8_t  STOPEntry )

Enter Stop 2 mode.

Note:
In Stop 2 mode, all I/O pins keep the same state as in Run mode.
All clocks in the VCORE domain are stopped, the PLL, the MSI, the HSI and the HSE oscillators are disabled. Some peripherals with wakeup capability (LCD, LPTIM1, I2C3 and LPUART) can switch on the HSI to receive a frame, and switch off the HSI after receiving the frame if it is not a wakeup frame. In this case the HSI clock is propagated only to the peripheral requesting it. SRAM1, SRAM2 and register contents are preserved. The BOR is available. The voltage regulator is set in low-power mode but LPR bit must be cleared to enter stop 2 mode. Otherwise, Stop 1 mode is entered.
When exiting Stop 2 mode by issuing an interrupt or a wakeup event, the HSI RC oscillator is selected as system clock if STOPWUCK bit in RCC_CFGR register is set; the MSI oscillator is selected if STOPWUCK is cleared.
Parameters:
STOPEntry,:specifies if Stop mode in entered with WFI or WFE instruction. This parameter can be one of the following values:

  • PWR_STOPENTRY_WFI: Enter Stop mode with WFI instruction
  • PWR_STOPENTRY_WFE: Enter Stop mode with WFE instruction
Return values:
None

Definition at line 959 of file stm32l4xx_hal_pwr_ex.c.

uint32_t HAL_PWREx_GetVoltageRange ( void   )

Return Voltage Scaling Range.

Return values:
VOSbit field (PWR_REGULATOR_VOLTAGE_RANGE1 or PWR_REGULATOR_VOLTAGE_RANGE2)

Definition at line 120 of file stm32l4xx_hal_pwr_ex.c.

void HAL_PWREx_PVD_PVM_IRQHandler ( void   )

This function handles the PWR PVD/PVMx interrupt request.

Note:
This API should be called under the PVD_PVM_IRQHandler().
Return values:
None

Definition at line 1027 of file stm32l4xx_hal_pwr_ex.c.

__weak void HAL_PWREx_PVM1Callback ( void   )

PWR PVM1 interrupt callback.

Return values:
None

Definition at line 1081 of file stm32l4xx_hal_pwr_ex.c.

__weak void HAL_PWREx_PVM2Callback ( void   )

PWR PVM2 interrupt callback.

Return values:
None

Definition at line 1093 of file stm32l4xx_hal_pwr_ex.c.

__weak void HAL_PWREx_PVM3Callback ( void   )

PWR PVM3 interrupt callback.

Return values:
None

Definition at line 1104 of file stm32l4xx_hal_pwr_ex.c.

__weak void HAL_PWREx_PVM4Callback ( void   )

PWR PVM4 interrupt callback.

Return values:
None

Definition at line 1115 of file stm32l4xx_hal_pwr_ex.c.