本文整理汇总了C++中HAL_PWR_EnableBkUpAccess函数的典型用法代码示例。如果您正苦于以下问题:C++ HAL_PWR_EnableBkUpAccess函数的具体用法?C++ HAL_PWR_EnableBkUpAccess怎么用?C++ HAL_PWR_EnableBkUpAccess使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HAL_PWR_EnableBkUpAccess函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rtc_init_start
void rtc_init_start(bool force_init) {
RTCHandle.Instance = RTC;
/* Configure RTC prescaler and RTC data registers */
/* RTC configured as follow:
- Hour Format = Format 24
- Asynch Prediv = Value according to source clock
- Synch Prediv = Value according to source clock
- OutPut = Output Disable
- OutPutPolarity = High Polarity
- OutPutType = Open Drain */
RTCHandle.Init.HourFormat = RTC_HOURFORMAT_24;
RTCHandle.Init.AsynchPrediv = RTC_ASYNCH_PREDIV;
RTCHandle.Init.SynchPrediv = RTC_SYNCH_PREDIV;
RTCHandle.Init.OutPut = RTC_OUTPUT_DISABLE;
RTCHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
RTCHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
rtc_need_init_finalise = false;
if (!force_init) {
uint32_t bdcr = RCC->BDCR;
if ((bdcr & (RCC_BDCR_RTCEN | RCC_BDCR_RTCSEL | RCC_BDCR_LSEON | RCC_BDCR_LSERDY))
== (RCC_BDCR_RTCEN | RCC_BDCR_RTCSEL_0 | RCC_BDCR_LSEON | RCC_BDCR_LSERDY)) {
// LSE is enabled & ready --> no need to (re-)init RTC
// remove Backup Domain write protection
HAL_PWR_EnableBkUpAccess();
// Clear source Reset Flag
__HAL_RCC_CLEAR_RESET_FLAGS();
// provide some status information
rtc_info |= 0x40000 | (RCC->BDCR & 7) | (RCC->CSR & 3) << 8;
return;
} else if ((bdcr & (RCC_BDCR_RTCEN | RCC_BDCR_RTCSEL))
== (RCC_BDCR_RTCEN | RCC_BDCR_RTCSEL_1)) {
// LSI configured as the RTC clock source --> no need to (re-)init RTC
// remove Backup Domain write protection
HAL_PWR_EnableBkUpAccess();
// Clear source Reset Flag
__HAL_RCC_CLEAR_RESET_FLAGS();
// Turn the LSI on (it may need this even if the RTC is running)
RCC->CSR |= RCC_CSR_LSION;
// provide some status information
rtc_info |= 0x80000 | (RCC->BDCR & 7) | (RCC->CSR & 3) << 8;
return;
}
}
rtc_startup_tick = HAL_GetTick();
rtc_info = 0x3f000000 | (rtc_startup_tick & 0xffffff);
if (rtc_use_lse) {
if (lse_magic()) {
// don't even try LSE
rtc_use_lse = false;
rtc_info &= ~0x01000000;
}
}
PYB_RTC_MspInit_Kick(&RTCHandle, rtc_use_lse);
}
示例2: Init_RTC
/**
* @brief Initialize RTC block
*
* @note
* @param None
* @retval None
*/
static void Init_RTC(void)
{
/* Initialize the HW - 37Khz LSI being used*/
/* Enable the LSI clock */
__HAL_RCC_LSI_ENABLE();
/* Enable power module clock */
__PWR_CLK_ENABLE();
/* Enable acces to the RTC registers */
HAL_PWR_EnableBkUpAccess();
/**
* Write twice the value to flush the APB-AHB bridge
* This bit shall be written in the register before writing the next one
*/
HAL_PWR_EnableBkUpAccess();
/* Select LSI as RTC Input */
__HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSI);
/* Enable RTC */
__HAL_RCC_RTC_ENABLE();
hrtc.Instance = RTC; /**< Define instance */
hrtc.Lock = HAL_UNLOCKED; /**< Initialize lock */
hrtc.State = HAL_RTC_STATE_READY; /**< Initialize state */
/**
* Bypass the shadow register
*/
HAL_RTCEx_EnableBypassShadow(&hrtc);
/**
* Set the Asynchronous prescaler
*/
hrtc.Init.AsynchPrediv = RTC_ASYNCH_PRESCALER;
hrtc.Init.SynchPrediv = RTC_SYNCH_PRESCALER;
HAL_RTC_Init(&hrtc);
/* Disable Write Protection */
__HAL_RTC_WRITEPROTECTION_DISABLE(&hrtc) ;
HAL_APP_RTC_Set_Wucksel(&hrtc, WUCKSEL_DIVIDER); /**< Tick timer is 55us */
/* Wait for LSI to be stable */
while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSIRDY) == 0);
return;
}
示例3: StandbyBKPSRAMMode_Measure
/**
* @brief This function configures the system to enter Standby mode with
* backup SRAM ON for current consumption measurement purpose.
* STANDBY Mode
* ============
* - RTC OFF
* - IWDG and LSI OFF
* - Backup SRAM ON
* - Wakeup using WakeUp Pin (PI.11)
* @param None
* @retval None
*/
void StandbyBKPSRAMMode_Measure(void)
{
/* Enable Power Clock*/
__HAL_RCC_PWR_CLK_ENABLE();
/* Allow access to Backup */
HAL_PWR_EnableBkUpAccess();
/* Reset RTC Domain */
__HAL_RCC_BACKUPRESET_FORCE();
__HAL_RCC_BACKUPRESET_RELEASE();
/* Disable all used wakeup sources: Pin6(PI.11) */
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN6);
/* Clear all related wakeup flags */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
/* Re-enable all used wakeup sources: Pin6(PI.11) */
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN6);
/* Enable BKPRAM Clock */
__HAL_RCC_BKPSRAM_CLK_ENABLE();
/* Enable the Backup SRAM low power Regulator */
HAL_PWREx_EnableBkUpReg();
/* Request to enter STANDBY mode */
HAL_PWR_EnterSTANDBYMode();
}
示例4: rtc_init
void rtc_init(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct;
uint32_t rtc_freq = 0;
if (rtc_inited) return;
rtc_inited = 1;
RtcHandle.Instance = RTC;
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable Power clock
__PWR_CLK_ENABLE();
// Enable access to Backup domain
HAL_PWR_EnableBkUpAccess();
// Reset Backup domain
__HAL_RCC_BACKUPRESET_FORCE();
__HAL_RCC_BACKUPRESET_RELEASE();
// Enable LSE Oscillator
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; /* Mandatory, otherwise the PLL is reconfigured! */
RCC_OscInitStruct.LSEState = RCC_LSE_ON; /* External 32.768 kHz clock on OSC_IN/OSC_OUT */
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) == HAL_OK) {
// Connect LSE to RTC
__HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSE);
rtc_freq = LSE_VALUE;
} else {
// Enable LSI clock
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; // Mandatory, otherwise the PLL is reconfigured!
RCC_OscInitStruct.LSEState = RCC_LSE_OFF;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
error("RTC error: LSI clock initialization failed.");
}
// Connect LSI to RTC
__HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSI);
// Note: The LSI clock can be measured precisely using a timer input capture.
rtc_freq = LSI_VALUE;
}
// Enable RTC
__HAL_RCC_RTC_ENABLE();
RtcHandle.Init.HourFormat = RTC_HOURFORMAT_24;
RtcHandle.Init.AsynchPrediv = 127;
RtcHandle.Init.SynchPrediv = (rtc_freq / 128) - 1;
RtcHandle.Init.OutPut = RTC_OUTPUT_DISABLE;
RtcHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
RtcHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
if (HAL_RTC_Init(&RtcHandle) != HAL_OK) {
error("RTC error: RTC initialization failed.");
}
}
示例5: HAL_IWDG_MspInit
/** @defgroup HAL_MSP_Private_Functions
* @{
*/
void HAL_IWDG_MspInit(IWDG_HandleTypeDef* hiwdg)
{
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWR_EnableBkUpAccess();
}
示例6: rtc_free
void rtc_free(void)
{
// Enable Power clock
__PWR_CLK_ENABLE();
// Enable access to Backup domain
HAL_PWR_EnableBkUpAccess();
// Reset Backup domain
__HAL_RCC_BACKUPRESET_FORCE();
__HAL_RCC_BACKUPRESET_RELEASE();
// Disable access to Backup domain
HAL_PWR_DisableBkUpAccess();
// Disable LSI and LSE clocks
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.LSIState = RCC_LSI_OFF;
RCC_OscInitStruct.LSEState = RCC_LSE_OFF;
HAL_RCC_OscConfig(&RCC_OscInitStruct);
rtc_inited = 0;
}
示例7: HAL_RTC_MspInit
void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)
{
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWR_EnableBkUpAccess();
/*##-2- Configure LSE as RTC clock source ###################################*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
//Error_Handler();
}
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
if(HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
//Error_Handler();
}
/*##-3- Enable RTC peripheral Clocks #######################################*/
/* Enable RTC Clock */
__HAL_RCC_RTC_ENABLE();
}
示例8: rtc_backup_init
/* USER CODE BEGIN 1 */
static void rtc_backup_init()
{
uint32_t temp;
//__HAL_RCC_BKP_CLK_ENABLE();//for backup sram
/* Allow access to Backup */
HAL_PWR_EnableBkUpAccess();
}
示例9: HAL_RTC_MspInit
/**
* @brief RTC MSP Initialization
* This function configures the hardware resources used in this example:
* - Peripheral's clock enable
* @param hrtc: RTC handle pointer
* @note Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to select
* the RTC clock source; in this case the Backup domain will be reset in
* order to modify the RTC Clock source, as consequence RTC registers (including
* the backup registers) and RCC_CSR register are set to their reset values.
* @retval None
*/
void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)
{
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
/*##-1- Enables the PWR Clock and Enables access to the backup domain ###################################*/
/* To change the source clock of the RTC feature (LSE, LSI), You have to:
- Enable the power clock using __HAL_RCC_PWR_CLK_ENABLE()
- Enable write access using HAL_PWR_EnableBkUpAccess() function before to
configure the RTC clock source (to be done once after reset).
- Reset the Back up Domain using __HAL_RCC_BACKUPRESET_FORCE() and
__HAL_RCC_BACKUPRESET_RELEASE().
- Configure the needed RTC clock source */
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWR_EnableBkUpAccess();
/* Enable BKP CLK enable for backup registers */
__HAL_RCC_BKP_CLK_ENABLE();
#ifdef RTC_CLOCK_SOURCE_LSE
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.LSIState = RCC_LSI_OFF;
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
if(HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();
}
#elif defined (RTC_CLOCK_SOURCE_LSI)
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
RCC_OscInitStruct.LSEState = RCC_LSE_OFF;
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
if(HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();
}
#else
#error Please select the RTC Clock source inside the main.h file
#endif /*RTC_CLOCK_SOURCE_LSE*/
/*##-2- Enable the RTC & BKP peripheral Clock ##############################*/
/* Enable RTC Clock */
__HAL_RCC_RTC_ENABLE();
}
示例10: HAL_LCD_MspInit
/**
* @brief LCD MSP Init.
* @param hlcd: LCD handle
* @retval None
*/
void HAL_LCD_MspInit(LCD_HandleTypeDef *hlcd)
{
GPIO_InitTypeDef GPIO_InitStruct;
RCC_OscInitTypeDef RCC_OscInitStruct;
/*##-1- Enable PWR peripheral Clock #######################################*/
__PWR_CLK_ENABLE();
/*##-2- Allow Access and Reset the Backup Domaine ##########################*/
/* Allow Access to Backup Domaine */
HAL_PWR_EnableBkUpAccess();
/* Reset the Backup Domaine */
__HAL_RCC_BACKUPRESET_FORCE();
__HAL_RCC_BACKUPRESET_RELEASE();
/*##-3- Configue LSE as RTC clock soucre ###################################*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
/* Infinite loop */
while(1);
}
__HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSE);
/*##-4- Enable LCD GPIO Clocks #############################################*/
__GPIOA_CLK_ENABLE();
__GPIOB_CLK_ENABLE();
__GPIOC_CLK_ENABLE();
/*##-5- Configure peripheral GPIO ##########################################*/
/* Configure Output for LCD */
/* Port A */
GPIO_InitStruct.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_8 | GPIO_PIN_9 |GPIO_PIN_10 |GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
GPIO_InitStruct.Alternate = GPIO_AF1_LCD;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* Configure Output for LCD */
/* Port B */
GPIO_InitStruct.Pin = GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_8 | GPIO_PIN_9 \
| GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* Configure Output for LCD */
/* Port C*/
GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_6 \
| GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 |GPIO_PIN_11 ;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*##-6- Enable LCD peripheral Clock ########################################*/
__LCD_CLK_ENABLE();
}
示例11: StandbyMode_Measure
/**
* @brief This function configures the system to enter Standby mode for
* current consumption measurement purpose.
* STANDBY Mode
* ============
* - Backup SRAM and RTC OFF
* - IWDG and LSI OFF
* - Wakeup using WakeUp Pin (PA.00)
* @param None
* @retval None
*/
void StandbyMode_Measure(void)
{
/* Enable Power Clock*/
__HAL_RCC_PWR_CLK_ENABLE();
/* Allow access to Backup */
HAL_PWR_EnableBkUpAccess();
/* Reset RTC Domain */
__HAL_RCC_BACKUPRESET_FORCE();
__HAL_RCC_BACKUPRESET_RELEASE();
/* Disable all used wakeup sources: Pin1(PA.0) */
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
/* Clear all related wakeup flags */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
/* Re-enable all used wakeup sources: Pin1(PA.0) */
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);
/*## Enter Standby Mode ####################################################*/
/* Request to enter STANDBY mode */
HAL_PWR_EnterSTANDBYMode();
}
示例12: StandbyMode_Measure
/**
* @brief This function configures the system to enter Standby mode for
* current consumption measurement purpose.
* STANDBY Mode
* ============
* - RTC OFF
* - IWDG and LSI OFF
* - Wakeup using WakeUp Pin (wire Vdd to PA.00)
* @retval None
*/
void StandbyMode_Measure(void)
{
/* Enable Power Clock*/
__HAL_RCC_PWR_CLK_ENABLE();
/* Allow access to Backup */
HAL_PWR_EnableBkUpAccess();
/* Reset RTC Domain */
__HAL_RCC_BACKUPRESET_FORCE();
__HAL_RCC_BACKUPRESET_RELEASE();
/* The Following Wakeup sequence is highly recommended prior to each Standby mode entry
mainly when using more than one wakeup source this is to not miss any wakeup event.
- Disable all used wakeup sources,
- Clear all related wakeup flags,
- Re-enable all used wakeup sources,
- Enter the Standby mode.
*/
/*#### Disable all used wakeup sources: WKUP pin ###########################*/
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
/*#### Clear all related wakeup flags ######################################*/
/* Clear PWR wake up Flag */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
/* Enable WKUP pin */
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);
/* Request to enter STANDBY mode */
HAL_PWR_EnterSTANDBYMode();
}
示例13: RTC_Config
/**
* @brief Configures the RTC.
* @param None
* @retval None
*/
static void RTC_Config(void)
{
/* Enable Power Clock*/
__PWR_CLK_ENABLE();
/* Allow Access to RTC Backup domaine */
HAL_PWR_EnableBkUpAccess();
RtcHandle.Instance= RTC;
/* Check if the system was resumed from StandBy mode */
if (__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
{
/* Clear StandBy flag */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
/* Disable the write protection for RTC registers */
__HAL_RTC_WRITEPROTECTION_DISABLE(&RtcHandle);
/* Wait for RTC APB registers synchronisation (needed after start-up from Reset)*/
if (HAL_RTC_WaitForSynchro(&RtcHandle) != HAL_OK)
{
while(1);
}
/* Enable the write protection for RTC registers */
__HAL_RTC_WRITEPROTECTION_ENABLE(&RtcHandle);
/* No need to configure the RTC as the RTC config(clock source, enable,
prescaler,...) are kept after wake-up from STANDBY */
}
else
{
/* Reset Backup Domaine */
__HAL_RCC_BACKUPRESET_FORCE();
__HAL_RCC_BACKUPRESET_RELEASE();
/* Set the RTC time base to 1s */
/* Configure RTC prescaler and RTC data registers as follows:
- Hour Format = Format 24
- Asynch Prediv = Value according to source clock
- Synch Prediv = Value according to source clock
- OutPut = Output Disable
- OutPutPolarity = High Polarity
- OutPutType = Open Drain */
RtcHandle.Init.HourFormat = RTC_HOURFORMAT_24;
RtcHandle.Init.AsynchPrediv = RTC_ASYNCH_PREDIV;
RtcHandle.Init.SynchPrediv = RTC_SYNCH_PREDIV;
RtcHandle.Init.OutPut = RTC_OUTPUT_DISABLE;
RtcHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
RtcHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
if(HAL_RTC_Init(&RtcHandle) != HAL_OK)
{
/* Initialization Error */
while(1);
}
}
}
示例14: HAL_IWDG_MspInit
/**
* @brief IWDG MSP Initialization
* This function configures the hardware resources used in this example:
* - Peripheral's clock enable
* - LSI enable
* @param hwwdg: IWDG handle pointer
* @retval None
*/
void HAL_IWDG_MspInit(IWDG_HandleTypeDef* hiwdg)
{
__PWR_CLK_ENABLE();
HAL_PWR_EnableBkUpAccess();
/*## Enable peripherals and GPIO Clocks ####################################*/
/* RCC LSI clock enable */
__HAL_RCC_LSI_ENABLE();
/* Wait till LSI is ready */
while (__HAL_RCC_GET_FLAG(RCC_FLAG_LSIRDY) == RESET)
{}
}
示例15: ParamInit
void ParamInit(void)
{
uint8_t i;
sParamGeneral paramGeneral;
Flash_M25P64_Read_Buffer((uint8_t*)¶mGeneral, ADDRESS_PARAM_GENERAL, sizeof(paramGeneral));
if(paramGeneral.final != FINAL_OK) { /* if settings are empty, usb mode */
HAL_PWR_EnableBkUpAccess();
BACUP_STATUS->BACUP_STATUS_REG = USB_ENABLED;
HAL_PWR_DisableBkUpAccess();
NVIC_SystemReset();
}
else
{