本文整理汇总了C++中IWDG_ReloadCounter函数的典型用法代码示例。如果您正苦于以下问题:C++ IWDG_ReloadCounter函数的具体用法?C++ IWDG_ReloadCounter怎么用?C++ IWDG_ReloadCounter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IWDG_ReloadCounter函数的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;
}
示例2: main
int main(void)
{
//RCC_ClocksTypeDef Clocks;
uint8_t pos = 128+64;
SystemInit();
SystemCoreClockUpdate(); //update the system clock variable
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
GPIO_Init(GPIOA, &GPIOA_InitStruct);
timercounter = 0;
//set systick to 1 every 1uS
SysTick_Config(SystemCoreClock/8);
initUSART1();
GPIO_SetBits(GPIOA, GPIO_Pin_10);
//initialize the watchdog
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
IWDG_SetPrescaler(0x00);
//while(IWDG_GetFlagStatus(IWDG_FLAG_PVU)==SET);
IWDG_SetReload(0xFFFF);
//while(IWDG_GetFlagStatus(IWDG_FLAG_RVU)==SET);
//IWDG_SetWindowValue(0x0000);
//while(IWDG_GetFlagStatus(IWDG_FLAG_PVU)==SET);
IWDG_ReloadCounter();
IWDG_Enable();
static BitAction toggle = Bit_SET;
int i =0;
//init the u8g library
u8g_InitComFn(&u8g, &u8g_dev_ssd1306_128x64_i2c, u8g_com_hw_i2c_fn);
u8g_SetDefaultForegroundColor(&u8g);
while(1){
u8g_FirstPage(&u8g);
do
{
IWDG_ReloadCounter();
draw(pos);
} while ( u8g_NextPage(&u8g) );
/* refresh screen after some delay */
///* update position */
if(pos < 128+128){
pos--;
}else
{ pos = 128+128;
}
}
}
示例3: SI446X_WAIT_CTS
/*===========================================================================
SI446X_WAIT_CTS();
Function : wait the device ready to response a command
============================================================================*/
void SI446X_WAIT_CTS(void)
{
INT8U cts;
IWDG_ReloadCounter();
do
{
SI_CSN_LOW();
SPI_ExchangeByte(READ_CMD_BUFF);
cts = SPI_ExchangeByte(0xFF);
SI_CSN_HIGH();
}while(cts != 0xFF);
IWDG_ReloadCounter();
}
示例4: main
/**
* @brief Main program.
* @param None
* @retval None
*/
void main(void)
{
u8 i, cnt;
disableInterrupts();
Config();
HBRIDGE_OFF;
Errors_Init();
RTMS_INIT(runtime_it_1ms);
enableInterrupts();
LED_GREEN_ON;
// Wait for power supply settling
Timeout_SetTimeout2(200);
while(!Timeout_IsTimeout2());
// END Wait for power supply settling
LED_OFF;
// Handle RESET flags
if(RST_GetFlagStatus(RST_FLAG_IWDGF)) {
BLINK_REDLED(1);
}
else if(RST_GetFlagStatus(RST_FLAG_ILLOPF)) {
BLINK_REDLED(2);
}
RST_ClearFlag(RST_FLAG_POR_PDR | RST_FLAG_SWIMF | RST_FLAG_ILLOPF | RST_FLAG_IWDGF);
while(ISBLINKING_REDLED);
// END Handle RESET flags
Retrieve_Check_ROM_Timer_Val();
Timeout_SetTimeout1(HBRIDGE_CHARGE_TIME);
IWDG_Enable();
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
IWDG_SetPrescaler(IWDG_Prescaler_64); /* 431.15ms for RL[7:0]= 0xFF */
IWDG_SetReload(0xFF);
IWDG_WriteAccessCmd(IWDG_WriteAccess_Disable);
IWDG_ReloadCounter();
LoadStateRequest = LOAD_NOT_POWERED;
state = ST_WAIT_CAP_CHARGE;
while (1)
{
TimerSwitch_StateMachine();
Programming_Mode_Manager();
Task_1000ms();
Error_Handler();
Display_Remaining_Time();
IWDG_ReloadCounter();
}
}
示例5: vApplicationIdleHook
void vApplicationIdleHook( void )
{
unsigned long ulFreeSizeStackTask; //свободное место в процессах RTOS.
unsigned long ulFreeHeapSize; //свободное место в "куче" RTOS
uint8_t ucCPU_load; //загрузка RTOS
portTickType WakeTick = 0;
uint32_t count = 0;
uint32_t max_count = 0; //максимальное значение счетчика, вычисляется при калибровке и соответствует 100% CPU idle
WakeTick = xTaskGetTickCount() + configTICK_RATE_HZ;
while(1)
{
if (xTaskGetTickCount() >= WakeTick)
{
#if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 )
ulFreeSizeStackTask = uxTaskGetStackHighWaterMark(xHandleDebugTask) << 2;
ulFreeHeapSize = (unsigned long) xPortGetFreeHeapSize(); //in Byte
#endif
/* Определяем загруженность OS */
WakeTick += configTICK_RATE_HZ;
if(count > max_count) {
max_count = count; //калибровка
}
ucCPU_load = (uint8_t)(100.0 - 100.0 * (float)count / (float)max_count); //вычисляем текущую загрузку
count = 0; //обнуляем счетчик
}
if(WakeTick > xTaskGetTickCount() + configTICK_RATE_HZ<<1) {
WakeTick = configTICK_RATE_HZ + xTaskGetTickCount();
}
count++; //приращение счетчика
IWDG_ReloadCounter(); // Reload IWDG counter
}
}
示例6: 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();
}
示例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();
}
示例8: main
void main (void)
{
SPIRIT_INIT();
while (1)
{
if (Spirit_data == Spirit_waiting_window) // check if there is data ready to be sent
{
if(SysyTickCnt > ((endpoint_address * 100) + 50)) // check if window for sending
{
send_to_Base_Station(); // sending to Base Station
}
}
if(command_pending == 1)
{
apply_command();
}
IWDG_ReloadCounter(); //przeladowanie IWDG
// SdkEvalLedToggle(LED_GREEN);
if (App == App_connected)
{
daas_manage();
}else
{
app_connect();
}
}
} // End of main()
示例9: 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();
}
示例10: 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();
}
示例11: ADSample
void ADSample(void)
{
u8 i,tttemp;
ADC1_DeInit();
ADC1_ConversionConfig(ADC1_CONVERSIONMODE_SINGLE, ADC1_CHANNEL_3, ADC1_ALIGN_RIGHT);
ADC1_SchmittTriggerConfig(ADC1_SCHMITTTRIG_CHANNEL4,ENABLE);
ADC1_ITConfig(ADC1_IT_EOCIE,DISABLE);
ADC1_Cmd(ENABLE);
ADC1->CSR &= (u8)(~0x80);
ADC1_StartConversion();
while((ADC1->CSR & 0x80)!=0x80) IWDG_ReloadCounter(); // µÈ´ýת»»½áÊø
Conversion_Value += ADC1_GetConversionValue();
ADC1->CSR &= (u8)(~0x80);
u8ADChannelCnt++;
if(u8ADChannelCnt>=SAMPLE_TIMES)
{
u8ADChannelCnt = 0;
tttemp = (u8)((Conversion_Value>>2)/SAMPLE_TIMES);
if((tttemp<20) || (tttemp>200) ) u8Temp = OFF_TMP_SET;
else
{
for(i=0;T3580Tab[i]<tttemp;i++);
u8Temp = (u8)(i+(40*2));
}
Conversion_Value = 0;
}
示例12: main
int main(void)
{
uint32_t setHour=0,setMinute=0;
//uint32_t v;
Init();
while (1)
{
LED1( ON ); // 亮
Delay(500000);
LED1( OFF ); // 灭
Delay(500000);
if(receive[19]==1)
{
Accept_to_complete(&setHour,&setMinute);
memset(receive,0,sizeof(receive));
}
IWDG_ReloadCounter();
tmpchange();
vTemp = tmp();
printf("the temp =%d",vTemp/1000);
isTimeOut(setHour,setMinute);
}
}
示例13: 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;
}
示例14: Watchdog
void Watchdog(void) {
#ifdef __PFM6__
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
IWDG_ReloadCounter();
IWDG_WriteAccessCmd(IWDG_WriteAccess_Disable);
#endif
}
示例15: hal_watchdog_refresh
extern hal_result_t hal_watchdog_refresh(hal_watchdog_t id)
{
hal_watchdog_internal_item_t* intitem = s_hal_watchdog_theinternals.items[HAL_watchdog_id2index(id)];
hal_result_t res = hal_res_NOK_generic;
if(hal_false == s_hal_watchdog_initted_is(id))
{
return(hal_res_NOK_generic);
}
switch(id)
{
case hal_watchdog1_normal:
{
IWDG_ReloadCounter();
res = hal_res_OK;
} break;
case hal_watchdog2_window:
{
WWDG_SetCounter(intitem->reload);
res = hal_res_OK;
} break;
default:
{
res = hal_res_NOK_generic;
} break;
}
return(res);
}