KugleFirmware/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr_ex.c
/**
  * @brief  Configure the system Power Supply.
  * @param  SupplySource: Specifies the Power Supply source to set after a system startup.
  *         This parameter can be one of the following values:
  *            @arg PWR_LDO_SUPPLY                      The LDO regulator supplies the Vcore Power Domains.
  *
  *            @arg PWR_EXTERNAL_SOURCE_SUPPLY          The LDO regulator is Bypassed.
  *                                                     The Vcore Power Domains are supplied from external source.
  * @retval HAL status.
  */
@brief  Configure the system Power Supply.
@param  SupplySource: Specifies the Power Supply source to set after a system startup.
This parameter can be one of the following values:
@arg PWR_LDO_SUPPLY                      The LDO regulator supplies the Vcore Power Domains.

@arg PWR_EXTERNAL_SOURCE_SUPPLY          The LDO regulator is Bypassed.
The Vcore Power Domains are supplied from external source.
@retval HAL status.
@brief Configure the system Power Supply . @param SupplySource : Specifies the Power Supply source to set after a system startup . This parameter can be one of the following values : @arg PWR_LDO_SUPPLY The LDO regulator supplies the Vcore Power Domains . @arg PWR_EXTERNAL_SOURCE_SUPPLY The LDO regulator is Bypassed . The Vcore Power Domains are supplied from external source . @retval HAL status .
HAL_StatusTypeDef HAL_PWREx_ConfigSupply(uint32_t SupplySource)
{
  uint32_t tickstart = 0;
  assert_param(IS_PWR_SUPPLY(SupplySource));
  MODIFY_REG(PWR->CR3, PWR_SUPPLY_CONFIG_MASK, SupplySource);
  tickstart = HAL_GetTick();
  while(!__HAL_PWR_GET_FLAG(PWR_FLAG_ACTVOSRDY) && __HAL_PWR_GET_FLAG(PWR_FLAG_SCUEN))
  {
    if((HAL_GetTick() - tickstart ) > PWR_FLAG_SETTING_DELAY_US)
    {
      return HAL_TIMEOUT;
    }
  }
  return HAL_OK;
}
HAL_StatusTypeDef HAL_PWREx_ConfigSupply ( uint32_t SupplySource ) { uint32_t tickstart = 0 ; assert_param ( IS_PWR_SUPPLY ( SupplySource ) ) ; MODIFY_REG ( PWR -> CR3 , PWR_SUPPLY_CONFIG_MASK , SupplySource ) ; tickstart = HAL_GetTick ( ) ; while ( ! __HAL_PWR_GET_FLAG ( PWR_FLAG_ACTVOSRDY ) && __HAL_PWR_GET_FLAG ( PWR_FLAG_SCUEN ) ) { if ( ( HAL_GetTick ( ) - tickstart ) > PWR_FLAG_SETTING_DELAY_US ) { return HAL_TIMEOUT ; } } return HAL_OK ; }
@brief  Configure the system Power Supply.
@brief Configure the system Power Supply .
/* Check the parameters */ /* Set the power supply configuration */ /* Get tick */ /* Wait till voltage level flag is set and supply configuration update flag is reset */