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


C++ IWDG_SetReload函数代码示例

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


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

示例1: PIOS_WDG_Init

/** 
 * @brief Initialize the watchdog timer for a specified timeout
 *
 * It is important to note that this function returns the achieved timeout 
 * for this hardware.  For hardware independence this should be checked when
 * scheduling updates.  Other hardware dependent details may need to be 
 * considered such as a window time which sets a minimum update time, 
 * and this function should return a recommended delay for clearing.  
 *
 * For the STM32 nominal clock rate is 32 khz, but for the maximum clock rate of
 * 60 khz and a prescaler of 4 yields a clock rate of 15 khz.  The delay that is
 * set in the watchdog assumes the nominal clock rate, but the delay for FreeRTOS
 * to use is 75% of the minimal delay.
 *
 * @returns Maximum recommended delay between updates based on PIOS_WATCHDOG_TIMEOUT constant
 */
uint16_t PIOS_WDG_Init()
{
	uint16_t delay = ((uint32_t) PIOS_WATCHDOG_TIMEOUT * 60) / 16;
	if (delay > 0x0fff)
		delay = 0x0fff;
#if defined(PIOS_INCLUDE_WDG)
	DBGMCU_Config(DBGMCU_IWDG_STOP, ENABLE);	// make the watchdog stop counting in debug mode
	IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
	IWDG_SetPrescaler(IWDG_Prescaler_16);
	IWDG_SetReload(delay);
	IWDG_ReloadCounter();
	IWDG_Enable();

	// watchdog flags now stored in backup registers
	PWR_BackupAccessCmd(ENABLE);

	wdg_configuration.bootup_flags = RTC_ReadBackupRegister(PIOS_WDG_REGISTER);

	/*
	 * Start from an empty set of registered flags so previous boots
	 * can't influence the current one
	 */
	RTC_WriteBackupRegister(PIOS_WDG_REGISTER, 0);
#endif
	return delay;
}
开发者ID:1heinz,项目名称:TauLabs,代码行数:42,代码来源:pios_wdg.c

示例2: WDT_Init

/******************************************************************************
  * @brief  看门狗初始化
  * @param 	tm:看门狗时间,0.5s / 1s / 2s / 3s /默认最长3.542秒 
  * @retval None 
******************************************************************************/
void	WDT_Init(TYPE_WDTtime tm)
{
	IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);	//关闭IWDG_PR和IWDG_RLR 的写保护
	if(tm == WDT_S5)IWDG_SetReload(578); 			//设置重装载值
	else if(tm == WDT_1S)IWDG_SetReload(1158);
	else if(tm == WDT_2S)IWDG_SetReload(2315);
	else if(tm == WDT_3S)IWDG_SetReload(3473);
	else IWDG_SetReload(0xFFF);
	IWDG_SetPrescaler(IWDG_Prescaler_32); 			//设置预分频系数为32
	//IWDG_ReloadCounter();
	IWDG_Enable(); //使能看门狗
} 
开发者ID:byteman,项目名称:digtalcell,代码行数:17,代码来源:Board.c

示例3: InitWatchdog

void InitWatchdog(void){
	
	IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
	IWDG_SetPrescaler(IWDG_Prescaler_4); 			
	IWDG_SetReload(0xFFF); 
	IWDG_Enable();
}
开发者ID:ION-Racing,项目名称:Sikkerhetsmodul,代码行数:7,代码来源:Watchdog.c

示例4: LCDPANELProcessInit

int LCDPANELProcessInit(void)
{
	rt_thread_t init_thread;
    rt_err_t result = RT_EOK;

	// 创建消息队列,分配队列存储空间
    result = rt_mq_init(&rx_mq, "mqt", &msg_pool[0], 32 - sizeof(void*), sizeof(msg_pool), RT_IPC_FLAG_FIFO);
   
    if (result != RT_EOK) 
    { 
        rt_kprintf("init message queue failed.\n"); 
        return result; 
    }

	IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);			// Enable write access to IWDG_PR and IWDG_RLR registers
	IWDG_SetPrescaler(IWDG_Prescaler_32);					// IWDG counter clock: 40KHz(LSI) / 32 = 1.25 KHz 
	IWDG_SetReload(1250);									// Set counter reload value to 1250 
	IWDG_ReloadCounter();									// Reload IWDG counter 
//	IWDG_Enable();											// Enable IWDG (the LSI oscillator will be enabled by hardware) 

	init_thread = rt_thread_create( "lcdpanel",
									LCDPANELProcess_thread_entry,
									RT_NULL,
									2048,10,10);

	if( init_thread != RT_NULL )
	{
		rt_thread_startup(init_thread);
	}

	return 0;
}
开发者ID:13007490745,项目名称:Wind,代码行数:32,代码来源:LCDPANEL.C

示例5: RCC_LSICmd

void PhotonWdgs::begin(bool _enableWwdg,bool _enableIwdg,unsigned long _timeout, TIMid id)
{
    if(!_enableWwdg && !_enableIwdg) {
        // nothing to do ...
        return;
    }
    PhotonWdgs::_aliveCount = 0;
    PhotonWdgs::_timeoutval = _timeout / 10;

    RCC_LSICmd(ENABLE); //LSI is needed for Watchdogs

    PhotonWdgs::_wdgTimer.begin(PhotonWdgs::_tickleWDGs, 20, hmSec, id);
    // OTA updates won't work with watchdog enabled
    System.disableUpdates();
    PhotonWdgs::_wwdgRunning = _enableWwdg;
    if(_enableWwdg) {
        RCC_APB1PeriphClockCmd(RCC_APB1Periph_WWDG, ENABLE);
        WWDG_SetPrescaler(WWDG_Prescaler_8);
        WWDG_SetWindowValue(0x7F);
        WWDG_Enable(0x7F);
    }
    PhotonWdgs::_iwdgRunning = _enableIwdg;
    if(_enableIwdg) {
        IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
        IWDG_SetPrescaler(IWDG_Prescaler_256);
        IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
        IWDG_SetReload(0xFFF);
        IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
        IWDG_Enable();
    }
}
开发者ID:specialcircumstances,项目名称:PondTopperUpper,代码行数:31,代码来源:photon-wdgs.cpp

示例6: PlatformWDGInitialize

OSStatus PlatformWDGInitialize( uint32_t timeout_ms )
{
  plat_log_trace();
  OSStatus err = kNoErr;
// PLATFORM_TO_DO

  /* Get the LSI frequency:  TIM5 is used to measure the LSI frequency */
  LsiFreq = GetLSIFrequency();
   
  IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);

  /* IWDG counter clock: LSI/32 */
  IWDG_SetPrescaler(IWDG_Prescaler_128);

  /* Set counter reload value to obtain 250ms IWDG TimeOut.
     Counter Reload Value = 250ms/IWDG counter clock period
                          = 250ms / (LSI/32)
                          = 0.25s / (LsiFreq/32)
                          = LsiFreq/(32 * 4)
                          = LsiFreq/128
   */
  IWDG_SetReload((uint16_t)(LsiFreq*timeout_ms/128000));

  /* Reload IWDG counter */
  IWDG_ReloadCounter();

  /* Enable IWDG (the LSI oscillator will be enabled by hardware) */
  IWDG_Enable();

  return err;
}
开发者ID:1220749046,项目名称:MICO,代码行数:31,代码来源:PlatformWDG.c

示例7: WatchDogInit

void WatchDogInit(void)
{    
  /* IWDG timeout equal to 250 ms (the timeout may varies due to LSI frequency
     dispersion) */
  /* Enable write access to IWDG_PR and IWDG_RLR registers */
  IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);

  /* IWDG counter clock: LSI/32 */
    /*   prescaler            min/ms    max/ms
         4                        0.1             409.6
         8                        0.2             819.2
         16                      0.4             1638.4
         32                      0.8              3276.8
         64                      1.6              6553.5
         128                    3.2              13107.2
         256                    6.4              26214.4   
  */
  IWDG_SetPrescaler(IWDG_Prescaler_16);

  /* Set counter reload value to obtain 250ms IWDG TimeOut.
     Counter Reload Value = 250ms/IWDG counter clock period
                          = 250ms / (LSI/32)
                          = 0.25s / (LsiFreq/32)
                          = LsiFreq/(32 * 4)
                          = LsiFreq/128
   */
  IWDG_SetReload(0X4AAA);//(LsiFreq/128);

  /* Reload IWDG counter */
  IWDG_ReloadCounter();

  /* Enable IWDG (the LSI oscillator will be enabled by hardware) */
  IWDG_Enable();
}
开发者ID:nathanlnw,项目名称:HB_LOCAL_TakePhoto,代码行数:34,代码来源:Device_808.c

示例8: IWDG_Configuration

/**
 * @brief   iwdg config
 */
void IWDG_Configuration(void)
{
	/* Enable write access to IWDG_PR and IWDG_RLR registers */
	IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);

	/* IWDG counter clock: LSI/32 */
	IWDG_SetPrescaler(IWDG_Prescaler_32);

	/* Set counter reload value to obtain 250ms IWDG TimeOut.
	 Counter Reload Value = 250ms/IWDG counter clock period
						  = 250ms / (LSI/32)
						  = 0.25s / (LsiFreq/32)
						  = LsiFreq/(32 * 4)
						  = LsiFreq/128
	*/
//	IWDG_SetReload(LSI_FREQ / 128);

	// iwdg period is 1000mS
	IWDG_SetReload(LSI_FREQ / 32);

	/* Reload IWDG counter */
	IWDG_ReloadCounter();

	/* Enable IWDG (the LSI oscillator will be enabled by hardware) */
	IWDG_Enable();

}
开发者ID:ptz19861212,项目名称:pumponef103rc,代码行数:30,代码来源:iwdg.c

示例9: Watchdog_Init

/**
 * Initializes the boards watchdog timer. If the behavior of the board is changed, this method may need to be
 * modified if the main control loop is changed.
 *
 * @param none
 * @retval none
 */
void Watchdog_Init(void) {
	/* Get the LSI frequency from TIM5 */
	LsiFreq = GetLSIFrequency();
	printf("LSI Frequency: %" PRIu32 "\n", LsiFreq);

	/* Enable write access to IWDG_PR and IWDG_RLR registers */
	IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);

	/* IWDG counter clock: LSI/32 */
	IWDG_SetPrescaler(IWDG_Prescaler_64);

	/* Set counter reload value to obtain 1s IWDG TimeOut.
	     IWDG counter clock Frequency = LsiFreq/32
	     Counter Reload Value = 250ms/IWDG counter clock period
	                          = 0.25s / (32/LsiFreq)
	                          = LsiFreq/(32 * 4)
	                          = LsiFreq/128
	 */
	IWDG_SetReload(LsiFreq/16);

	/* Reload IWDG counter */
	IWDG_ReloadCounter();

	/* Enable IWDG (the LSI oscillator will be enabled by hardware) */
	IWDG_Enable();
}
开发者ID:Teodor85,项目名称:Tekdaqc-Firmware,代码行数:33,代码来源:Tekdaqc_Config.c

示例10: IWDG_Config

//==============================================================================
// 看門狗設定 : 用來當RESET 用
//==============================================================================
void IWDG_Config(unsigned char timeout)
{
  /* IWDG timeout equal to 250 ms (the timeout may varies due to LSI frequency
  dispersion) */
  /* Enable write access to IWDG_PR and IWDG_RLR registers */
  IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
  
  /* IWDG counter clock: LSI/32 */
  //IWDG_SetPrescaler(IWDG_Prescaler_32);
  /* IWDG counter clock: LSI/256 */
  IWDG_SetPrescaler(IWDG_Prescaler_256);
  
  /* Set counter reload value to obtain 250ms IWDG TimeOut.
  Counter Reload Value = 250ms/IWDG counter clock period
  = 250ms / (LSI/32)
  = 0.25s / (LsiFreq/32)
  = LsiFreq/(32 * 4)
  = LsiFreq/128
  */
  // IWDG_SetReload(LsiFreq/128);
  
  IWDG_SetReload(timeout);
  
  /* Reload IWDG counter */
  IWDG_ReloadCounter();
  
  /* Enable IWDG (the LSI oscillator will be enabled by hardware) */
  IWDG_Enable();
}
开发者ID:joelin3246,项目名称:Project_2121034,代码行数:32,代码来源:main.c

示例11: main

/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main(void)
{	
	RCC_Configuration();
	GPIO_Configuration();
	USART_Configuration();	
	SysTick_Config(SystemCoreClock/10);
	// Enable the LSI OSC 
 	RCC_LSICmd(ENABLE);
	// Wait till LSI is ready 
	while (RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET) {};
	
 	IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
	// IWDG counter clock: LSI/256 
	IWDG_SetPrescaler(IWDG_Prescaler_256);
	IWDG_SetReload(0x0FFF);
	// Reload IWDG counter 
	IWDG_ReloadCounter();
	// Enable IWDG (the LSI oscillator will be enabled by hardware) 
	IWDG_Enable(); 
	
	// Write memmory
	FLASH_UnlockBank1();
	FLASH_ErasePage(FLAG_ADDR);
	FLASH_ProgramWord(FLAG_ADDR,(u32)FLAG_UPDATED);
	FLASH_LockBank1();
	
	updateFW_control();
}
开发者ID:thaigiang,项目名称:VMS,代码行数:33,代码来源:main.c

示例12: WDT_init

void WDT_init(void)
{
	IWDG_WriteAccessEnable();
	IWDG_SetPrescaler(IWDG_Prescaler_256);
	IWDG_SetReload(0xFFF);
	IWDG_Enable();
	IWDG_ReloadCounter();
}
开发者ID:maxk9,项目名称:etro_new,代码行数:8,代码来源:main.c

示例13: watchdog_config

void watchdog_config(void)
{
	IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
	IWDG_SetReload(0x80);
	IWDG_SetPrescaler(IWDG_Prescaler_32);
	IWDG_Enable();
	tim13_config();
}
开发者ID:athersec,项目名称:robo_a,代码行数:8,代码来源:watchdog.c

示例14: IWDG_Configuration

 //*******************初始化独立看门狗*************************************
//函数定义: void IWDG_Configuration(void) 
//描    述:初始化独立看门狗
//入口参数:无
//出口参数:无
//备    注:分频因子=4*2^prer.但最大值只能是256!时间计算(大概):Tout=40K/((4*2^prer)*rlr)值	 2S超时
//Editor:liuqh 2013-1-16  Company: BXXJS
//*******************************************************************
static void IWDG_Configuration(void) 
{
	IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);//使能对IWDG->PR和IWDG->RLR的写
	IWDG_SetPrescaler(IWDG_Prescaler_64);//64分频
	IWDG_SetReload(1300);
	IWDG_ReloadCounter();
	IWDG_Enable();		
}
开发者ID:uincore,项目名称:FreeModbus_Slave-Master-RTT-STM32,代码行数:16,代码来源:bsp.c

示例15: IWDG_Configuration

/**
 * IWDG_Configuration
 */
static void IWDG_Configuration(void) 
{
    IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
    IWDG_SetPrescaler(IWDG_Prescaler_64);
    IWDG_SetReload(1875);
    IWDG_ReloadCounter();
    IWDG_Enable();
}
开发者ID:1847123212,项目名称:EasyFlash,代码行数:11,代码来源:bsp.c


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