当前位置: 首页>>代码示例>>C++>>正文


C++ PWR_GetFlagStatus函数代码示例

本文整理汇总了C++中PWR_GetFlagStatus函数的典型用法代码示例。如果您正苦于以下问题:C++ PWR_GetFlagStatus函数的具体用法?C++ PWR_GetFlagStatus怎么用?C++ PWR_GetFlagStatus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PWR_GetFlagStatus函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: vDebugPrintResetType

// Simply print to the debug console a string based on the type of reset.
// ============================================================================
void vDebugPrintResetType( void ) {

	if ( PWR_GetFlagStatus( PWR_FLAG_WU ) )
		vDebugPrintf( "PWR: Wake Up flag\r\n" );
	if ( PWR_GetFlagStatus( PWR_FLAG_SB ) )
		vDebugPrintf( "PWR: StandBy flag.\r\n" );
	if ( PWR_GetFlagStatus( PWR_FLAG_PVDO ) )
		vDebugPrintf( "PWR: PVD Output.\r\n" );
	if ( PWR_GetFlagStatus( PWR_FLAG_BRR ) )
		vDebugPrintf( "PWR: Backup regulator ready flag.\r\n" );
	if ( PWR_GetFlagStatus( PWR_FLAG_REGRDY ) )
		vDebugPrintf( "PWR: Main regulator ready flag.\r\n" );

	if ( RCC_GetFlagStatus( RCC_FLAG_BORRST ) )
		vDebugPrintf( "RCC: POR/PDR or BOR reset\r\n" );
	if ( RCC_GetFlagStatus( RCC_FLAG_PINRST ) )
		vDebugPrintf( "RCC: Pin reset.\r\n" );
	if ( RCC_GetFlagStatus( RCC_FLAG_PORRST ) )
		vDebugPrintf( "RCC: POR/PDR reset.\r\n" );
	if ( RCC_GetFlagStatus( RCC_FLAG_SFTRST ) )
		vDebugPrintf( "RCC: Software reset.\r\n" );
	if ( RCC_GetFlagStatus( RCC_FLAG_IWDGRST ) )
		vDebugPrintf( "RCC: Independent Watchdog reset.\r\n" );
	if ( RCC_GetFlagStatus( RCC_FLAG_WWDGRST ) )
		vDebugPrintf( "RCC: Window Watchdog reset.\r\n" );
	if ( RCC_GetFlagStatus( RCC_FLAG_LPWRRST ) )
		vDebugPrintf( "RCC: Low Power reset.\r\n" );
}
开发者ID:jongwonk,项目名称:stm32f407_test,代码行数:30,代码来源:debug.c

示例2: PVDTset

void PVDTset()
{

	RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
	PWR_PVDLevelConfig(PWR_PVDLevel_2V8);
	//PWR_PVDLevelConfig(PWR_PVDLevel_2V6);
	PWR_PVDCmd(ENABLE);
	while(1)
	{
		
		if(PWR_GetFlagStatus(PWR_FLAG_PVDO))
		{
			uart_printf("VDD<2.8V=PWR->CSR\r\n");
			break;
		}
	}
	uart_printf("PWR->CSR=0x%x\r\n",PWR->CSR);
	
	while(1)
	{
		if(PWR_GetFlagStatus(PWR_FLAG_PVDO)==0)
		{
			uart_printf("VDD>2.8V=PWR->CSR\r\n");
			break;
		}
	}
}
开发者ID:CherishFan,项目名称:MT02_MCO,代码行数:27,代码来源:power_test.c

示例3: RTC_Config

void RTC_Config(void)	
{
	/*后备寄存器1中,存了一个特殊字符0xA5A5
	第一次上电或后备电源掉电后,该寄存器数据丢失,
	表明RTC数据丢失,需要重新配置 */
    if(BKP_ReadBackupRegister(BKP_DR1) != 0xA5A5) //检查是否第一次上电或后备电池已经掉电,
    {       
        Write_Log("Backup VBAT PowerDown or First time PowerUp,Initialize RTC\r\n");
        RTC_Configuration();
        BKP_WriteBackupRegister(BKP_DR1, 0xA5A5);
        
        time_now.tm_year = 2011;
        time_now.tm_mon = 10; //月份表示为0~11
        time_now.tm_mday = 13;
        time_now.tm_hour = 13;
        time_now.tm_min = 16;
        time_now.tm_sec = 38;
        Time_SetCalendarTime(time_now);//设置初始时间
    } 
    else //若后备寄存器没有掉电,则无需重新配置RTC
    {
        Write_Log("Backup VBAT Keep, Don't RTC Configuralation\r\n");
                    //等待RTC与APB同步
  		RTC_WaitForSynchro();
		RTC_WaitForLastTask();
	
  		//使能秒中断 
  		RTC_ITConfig(RTC_IT_SEC, ENABLE);  
  		RTC_WaitForLastTask();
    }
      //这里我们可以利用RCC_GetFlagStatus()函数查看本次复位类型
    if (RCC_GetFlagStatus(RCC_FLAG_PORRST) != RESET)
    {
		por_rst_flag = 1;	
        Write_Log("PowerUp Reset\r\n");
    }
    else if (RCC_GetFlagStatus(RCC_FLAG_PINRST) != RESET)
    {
		pin_rst_flag = 1;
        Write_Log("pin Reset\r\n");
    }
    else if(PWR_GetFlagStatus(PWR_FLAG_WU)!= RESET)  //wakeup唤醒
    {
        Write_Log("WakeUp...\r\n");     
    }
    if(PWR_GetFlagStatus(PWR_FLAG_SB) != RESET) //检查是否由待机模式下唤醒,如是则不需要配置RTC
        /* System resumed from STANDBY mode */      
         /* Clear StandBy flag */
    PWR_ClearFlag(PWR_FLAG_SB);

        //清除RCC中复位标志
    RCC_ClearFlag();
	return;
}
开发者ID:jiangtaojiang,项目名称:bloodpressure,代码行数:54,代码来源:RTC.c

示例4: RTCAlarm_IRQHandler

/*******************************************************************************
* Function Name  : RTCAlarm_IRQHandler
* Description    : This function handles RTC Alarm interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void RTCAlarm_IRQHandler(void)
{
	if(RTC_GetITStatus(RTC_IT_ALR) != RESET)
	{
		SPARK_WLAN_SLEEP = 0;

		/* Clear EXTI line17 pending bit */
		EXTI_ClearITPendingBit(EXTI_Line17);

		/* Check if the Wake-Up flag is set */
		if(PWR_GetFlagStatus(PWR_FLAG_WU) != RESET)
		{
			/* Clear Wake Up flag */
			PWR_ClearFlag(PWR_FLAG_WU);
		}

		/* Wait until last write operation on RTC registers has finished */
		RTC_WaitForLastTask();

		/* Clear RTC Alarm interrupt pending bit */
		RTC_ClearITPendingBit(RTC_IT_ALR);

		/* Wait until last write operation on RTC registers has finished */
		RTC_WaitForLastTask();
	}
}
开发者ID:Mike43110,项目名称:core-firmware,代码行数:33,代码来源:stm32_it.cpp

示例5: HAL_Feature_Set

int HAL_Feature_Set(HAL_Feature feature, bool enabled)
{
    switch (feature)
    {
        case FEATURE_RETAINED_MEMORY:
        {
            FunctionalState state = enabled ? ENABLE : DISABLE;
            // Switch on backup SRAM clock
            // Switch on backup power regulator, so that it survives the deep sleep mode,
            // software and hardware reset. Power must be supplied to VIN or VBAT to retain SRAM values.
            PWR_BackupRegulatorCmd(state);
            // Wait until backup power regulator is ready, should be fairly instantaneous... but timeout in 10ms.
            if (state == ENABLE) {
                system_tick_t start = HAL_Timer_Get_Milli_Seconds();
                while (PWR_GetFlagStatus(PWR_FLAG_BRR) == RESET) {
                    if (HAL_Timer_Get_Milli_Seconds() - start > 10UL) {
                        return -2;
                    }
                };
            }
            return 0;
        }

    }
    return -1;
}
开发者ID:RobertNewkirk,项目名称:particle,代码行数:26,代码来源:core_hal_stm32f2xx.c

示例6: LowPower_EnterSTANDBYMode_WAKEUP_1

/**
  * @brief  Enters MCU in STANDBY mode. The wake-up from STANDBY mode is performed 
  *         when a rising edge is detected on WakeUp pin.
  * @param  None
  * @retval None
  */
void LowPower_EnterSTANDBYMode_WAKEUP_1(void)
{
//  LCD_Clear(LCD_COLOR_WHITE);
  
  /* Set the LCD Back Color */
//  LCD_SetBackColor(LCD_COLOR_BLUE);
  /* Set the LCD Text Color */
//  LCD_SetTextColor(LCD_COLOR_WHITE);
  
//  LCD_DisplayStringLine(LCD_LINE_7, " MCU in STANDBY Mode");
//  LCD_DisplayStringLine(LCD_LINE_8, " To exit press SEL  ");
  /* Check if the StandBy flag is set */
  if (PWR_GetFlagStatus(PWR_FLAG_SB) != RESET)
  {       
    /* Clear StandBy flag */
    PWR_ClearFlag(PWR_FLAG_SB);
    
    RTC_WaitForSynchro();
  }
  
  RTC_AlarmCmd(RTC_Alarm_A, DISABLE);
  
  /* Enable WakeUp pin */
  PWR_WakeUpPinCmd(PWR_WakeUpPin_1, ENABLE);
  
  /* Request to enter STANDBY mode (Wake Up flag is cleared in PWR_EnterSTANDBYMode function) */
  PWR_EnterSTANDBYMode();
}
开发者ID:NjordCZ,项目名称:opentag-eval,代码行数:34,代码来源:lowpower.c

示例7: main

/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f30x.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f30x.c file
     */
  /* PVD configuration */
  PWR_Config();

  /* SYSCFG configuration */
  SYSCFG_Config();
  
  /* TIM1 channels Configuration in PWM mode */
  TIM_Config();

  /* Wait till a PVD event is detected */
  while(PWR_GetFlagStatus(PWR_FLAG_PVDO) == RESET);
  
  /* Infinite loop */
  while (1)
  {
  }
}
开发者ID:jeasinema,项目名称:STM32F3_Model,代码行数:30,代码来源:main.c

示例8: HAL_Feature_Get

bool HAL_Feature_Get(HAL_Feature feature)
{
    switch (feature)
    {
        // Warm Start: active when resuming from Standby mode (deep sleep)
        case FEATURE_WARM_START:
        {
            return (PWR_GetFlagStatus(PWR_FLAG_SB) != RESET);
        }
        // Retained Memory: active when backup regulator is enabled
        case FEATURE_RETAINED_MEMORY:
        {
            return (PWR_GetFlagStatus(PWR_FLAG_BRR) != RESET);
        }
    }
    return false;
}
开发者ID:RobertNewkirk,项目名称:particle,代码行数:17,代码来源:core_hal_stm32f2xx.c

示例9: SetHSICLKToMSI

/**
  * @brief  To select MSI as System clock source 
  * @caller ADC_Icc_Test
  * @param Frequence, DIV by 2 ot not , With or without RTC
  * @retval None
  */
void SetHSICLKToMSI(uint32_t freq,bool div2,bool With_RTC)
{
  
  /* RCC system reset */
  RCC_DeInit();

  /* Flash 1 wait state */
  FLASH_SetLatency(FLASH_Latency_0);
  
  /* Disable Prefetch Buffer */
  FLASH_PrefetchBufferCmd(DISABLE);

  /* Disable 64-bit access */
  FLASH_ReadAccess64Cmd(DISABLE);
         
  /* Disable FLASH during SLeep  */
  FLASH_SLEEPPowerDownCmd(ENABLE);
 
  /* Enable the PWR APB1 Clock */
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);

  /* Select the Voltage Range 3 (1.2V) */
  PWR_VoltageScalingConfig(PWR_VoltageScaling_Range3);

  /* Wait Until the Voltage Regulator is ready */
  while (PWR_GetFlagStatus(PWR_FLAG_VOS) != RESET)
  {}

  /* To configure the MSI frequency */
  RCC_MSIRangeConfig(freq);
  
  /* Select MSI as system clock source */
  RCC_SYSCLKConfig(RCC_SYSCLKSource_MSI);

  /* Wait till MSI is used as system clock source */
  while (RCC_GetSYSCLKSource() != 0x00)
  {}
  
  if (div2)
  {
    RCC_HCLKConfig(RCC_SYSCLK_Div2);    
  }

  RCC_HSICmd(DISABLE);

  /* Disable HSE clock */
  RCC_HSEConfig(RCC_HSE_OFF);

  /* Disable LSE clock */
  if (! With_RTC)
    RCC_LSEConfig(RCC_LSE_OFF);

  /* Disable LSI clock */
  RCC_LSICmd(DISABLE);  

}
开发者ID:nullsub,项目名称:stm32l-democode,代码行数:62,代码来源:icc_measure.c

示例10: LowPower_EnterSTANDBYMode_RTCAlarm

/**
  * @brief  Enters MCU in STANDBY mode. The wake-up from STANDBY mode is performed 
  *         by an RTC Alarm event.
  * @param  None
  * @retval None
  */
void LowPower_EnterSTANDBYMode_RTCAlarm(void)
{
 // LCD_Clear(LCD_COLOR_WHITE);
  
  /* Set the LCD Back Color */
//  LCD_SetBackColor(LCD_COLOR_BLUE);
  
  /* Set the LCD Text Color */
 // LCD_SetTextColor(LCD_COLOR_WHITE);
  
  /* External Interrupt Disable */
  //Demo_IntExtOnOffCmd(DISABLE);
  
  /* Enable WakeUp pin */
  PWR_WakeUpPinCmd(PWR_WakeUpPin_1, ENABLE);
    
  /* Check if the StandBy flag is set */
  if (PWR_GetFlagStatus(PWR_FLAG_SB) != RESET)
  {       
    /* Clear StandBy flag */
    PWR_ClearFlag(PWR_FLAG_SB);
   
    RTC_WaitForSynchro();
  }
  
  if (RTC_ReadBackupRegister(RTC_BKP_DR0) != 0x5AA5)
  {
  //  LCD_DisplayStringLine(LCD_LINE_1, "Time and Date are   ");
   // LCD_DisplayStringLine(LCD_LINE_2, "not configured,     ");
  //  LCD_DisplayStringLine(LCD_LINE_3, "please go to the    ");
  //  LCD_DisplayStringLine(LCD_LINE_4, "calendar menu and   ");
  //  LCD_DisplayStringLine(LCD_LINE_5, "set the time and    ");
  //  LCD_DisplayStringLine(LCD_LINE_6, "date parameters.    ");
  //  LCD_DisplayStringLine(LCD_LINE_7, "Press JoyStick to   ");
  //  LCD_DisplayStringLine(LCD_LINE_8, "continue...         ");
    
    
    /* External Interrupt Enable */
    //Demo_IntExtOnOffCmd(ENABLE);
    return;
  }
  
  Calendar_AlarmPreAdjust_A();

 // LCD_DisplayStringLine(LCD_LINE_7, " MCU in STANDBY Mode");
 // LCD_DisplayStringLine(LCD_LINE_8, " Wait For RTC Alarm ");
  
  /* Request to enter STANDBY mode (Wake Up flag is cleared in PWR_EnterSTANDBYMode function) */
  PWR_EnterSTANDBYMode();
}
开发者ID:NjordCZ,项目名称:opentag-eval,代码行数:56,代码来源:lowpower.c

示例11: RTC_Configuration

/**
  * @brief  Configures RTC clock source and prescaler.
  * @param  None
  * @retval None
  */
void RTC_Configuration(void)
{
  /* Check if the StandBy flag is set */
  if(PWR_GetFlagStatus(PWR_FLAG_SB) != RESET)
  {/* System resumed from STANDBY mode */

    /* Turn on LD4 */
    STM32vldiscovery_LEDOn(LED4);

    /* Clear StandBy flag */
    PWR_ClearFlag(PWR_FLAG_SB);

    /* Wait for RTC APB registers synchronisation */
    RTC_WaitForSynchro();
    /* No need to configure the RTC as the RTC configuration(clock source, enable,
       prescaler,...) is kept after wake-up from STANDBY */
  }
  else
  {/* StandBy flag is not set */

    /* RTC clock source configuration ----------------------------------------*/
    /* Reset Backup Domain */
    BKP_DeInit();
  
    /* Enable LSE OSC */
    RCC_LSEConfig(RCC_LSE_ON);
    /* Wait till LSE is ready */
    while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
    {
    }

    /* Select the RTC Clock Source */
    RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);

    /* Enable the RTC Clock */
    RCC_RTCCLKCmd(ENABLE);

    /* RTC configuration -----------------------------------------------------*/
    /* Wait for RTC APB registers synchronisation */
    RTC_WaitForSynchro();

    /* Set the RTC time base to 1s */
    RTC_SetPrescaler(32767);  
    /* Wait until last write operation on RTC registers has finished */
    RTC_WaitForLastTask();
  }
}
开发者ID:BogdanSorlea,项目名称:stm32-vl-discovery-template,代码行数:52,代码来源:main.c

示例12: BKPSRAM_Init

void BKPSRAM_Init(void) {
  /* Enable PWR clock */
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
	
  /* Enable backup SRAM Clock */
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_BKPSRAM, ENABLE);
	
  /* Allow access to backup domain */
  PWR_BackupAccessCmd(ENABLE);
	
  /* Enable the Backup SRAM low power Regulator */
  /* This will allow data to stay when using VBat mode */
  PWR_BackupRegulatorCmd(ENABLE);
	
  /* Wait for backup regulator to be ready  */
  while (PWR_GetFlagStatus(PWR_FLAG_BRR) == RESET);
}
开发者ID:olilarkin,项目名称:OwlWare,代码行数:17,代码来源:bkp_sram.c

示例13: Platform_Init

void Platform_Init(void)
{
  /*STM32 wakeup by watchdog in standby mode, re-enter standby mode in this situation*/
  PlatformWDGReload();
  if ( (PWR_GetFlagStatus(PWR_FLAG_SB) != RESET) && RCC_GetFlagStatus(RCC_FLAG_IWDGRST) != RESET)
  {
    RCC_ClearFlag();
    Platform_Enter_STANDBY();
  }
  PWR_ClearFlag(PWR_FLAG_SB);

  mico_rtos_init_mutex(&printf_mutex);
  Platform_Button_EL_Init();
  Platform_Button_STANDBY_Init();
  Platform_LED_SYS_Init();
  Platform_LED_RF_Init();
  Platform_Debug_UART_Init();
}
开发者ID:1220749046,项目名称:MICO,代码行数:18,代码来源:platform.c

示例14: Init_Last_Reset_Info

static void Init_Last_Reset_Info()
{
    if (HAL_Core_System_Reset_FlagSet(SOFTWARE_RESET))
    {
        // Load reset info from backup registers
        last_reset_info.reason = BKP_ReadBackupRegister(BKP_DR2);
        const uint16_t hi = BKP_ReadBackupRegister(BKP_DR3);
        const uint16_t lo = BKP_ReadBackupRegister(BKP_DR4);
        last_reset_info.data = ((uint32_t)hi << 16) | (uint32_t)lo;
        // Clear backup registers
        BKP_WriteBackupRegister(BKP_DR2, 0);
        BKP_WriteBackupRegister(BKP_DR3, 0);
        BKP_WriteBackupRegister(BKP_DR4, 0);
    }
    else // Hardware reset
    {
        if (HAL_Core_System_Reset_FlagSet(WATCHDOG_RESET))
        {
            last_reset_info.reason = RESET_REASON_WATCHDOG;
        }
        else if (HAL_Core_System_Reset_FlagSet(POWER_MANAGEMENT_RESET))
        {
            last_reset_info.reason = RESET_REASON_POWER_MANAGEMENT; // Reset generated when entering standby mode (nRST_STDBY: 0)
        }
        else if (HAL_Core_System_Reset_FlagSet(POWER_DOWN_RESET))
        {
            last_reset_info.reason = RESET_REASON_POWER_DOWN;
        }
        else if (HAL_Core_System_Reset_FlagSet(PIN_RESET)) // Pin reset flag should be checked in the last place
        {
            last_reset_info.reason = RESET_REASON_PIN_RESET;
        }
        else if (PWR_GetFlagStatus(PWR_FLAG_SB) != RESET) // Check if MCU was in standby mode
        {
            last_reset_info.reason = RESET_REASON_POWER_MANAGEMENT; // Reset generated when exiting standby mode (nRST_STDBY: 1)
        }
        else
        {
            last_reset_info.reason = RESET_REASON_UNKNOWN;
        }
        last_reset_info.data = 0; // Not used
    }
    // Note: RCC reset flags should be cleared, see HAL_Core_Init()
}
开发者ID:spark,项目名称:firmware,代码行数:44,代码来源:core_hal.c

示例15: 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 Pin1 (PA.00)
  * @param  None
  * @retval None
  */
void StandbyMode_Measure(void)
{
  /* Check if the StandBy flag is set */
  if (PWR_GetFlagStatus(PWR_FLAG_SB) != RESET)
  {       
    /* Clear StandBy flag */
    PWR_ClearFlag(PWR_FLAG_SB);
  }
  /* Enable WKUP pin 1 */
  PWR_WakeUpPinCmd(PWR_WakeUpPin_1,ENABLE);

  /* Request to enter STANDBY mode (Wake Up flag is cleared in PWR_EnterSTANDBYMode function) */
  PWR_EnterSTANDBYMode();
  
  /* Infinite loop */
  while (1)
  {
  }
}
开发者ID:BGCX261,项目名称:ziplockk-embedded-svn-to-git,代码行数:30,代码来源:stm32f30x_lp_modes.c


注:本文中的PWR_GetFlagStatus函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。