• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IS_IWDG_PRESCALER函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: HAL_IWDG_Init

/**
  * @brief  Initializes the IWDG according to the specified
  *         parameters in the IWDG_InitTypeDef and creates the associated handle.
  * @param  hiwdg: pointer to a IWDG_HandleTypeDef structure that contains
  *                the configuration information for the specified IWDG module.
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg)
{
  /* Check the IWDG handle allocation */
  if(hiwdg == NULL)
  {
    return HAL_ERROR;
  }

  /* Check the parameters */
  assert_param(IS_IWDG_ALL_INSTANCE(hiwdg->Instance));
  assert_param(IS_IWDG_PRESCALER(hiwdg->Init.Prescaler));
  assert_param(IS_IWDG_RELOAD(hiwdg->Init.Reload)); 
  
  if(hiwdg->State == HAL_IWDG_STATE_RESET)
  {  
    /* Init the low level hardware */
    HAL_IWDG_MspInit(hiwdg);
  }
  
  /* Change IWDG peripheral state */
  hiwdg->State = HAL_IWDG_STATE_BUSY;  
  
  /* Enable write access to IWDG_PR and IWDG_RLR registers */  
  __HAL_IWDG_ENABLE_WRITE_ACCESS(hiwdg);
  
  /* Write to IWDG registers the IWDG_Prescaler & IWDG_Reload values to work with */
  MODIFY_REG(hiwdg->Instance->PR, IWDG_PR_PR, hiwdg->Init.Prescaler);
  MODIFY_REG(hiwdg->Instance->RLR, IWDG_RLR_RL, hiwdg->Init.Reload);
 
  /* Change IWDG peripheral state */
  hiwdg->State = HAL_IWDG_STATE_READY;
  
  /* Return function status */
  return HAL_OK;
}
开发者ID:A-L-E-X,项目名称:micropython,代码行数:42,代码来源:stm32f4xx_hal_iwdg.c


示例2: IWDG_SetPrescaler

/*******************************************************************************
* Function Name  : IWDG_SetPrescaler
* Description    : Sets IWDG Prescaler value.
* Input          : - IWDG_Prescaler: specifies the IWDG Prescaler value.
*                    This parameter can be one of the following values:
*                       - IWDG_Prescaler_4: IWDG prescaler set to 4
*                       - IWDG_Prescaler_8: IWDG prescaler set to 8
*                       - IWDG_Prescaler_16: IWDG prescaler set to 16
*                       - IWDG_Prescaler_32: IWDG prescaler set to 32
*                       - IWDG_Prescaler_64: IWDG prescaler set to 64
*                       - IWDG_Prescaler_128: IWDG prescaler set to 128
*                       - IWDG_Prescaler_256: IWDG prescaler set to 256
* Output         : None
* Return         : None
*******************************************************************************/
void IWDG_SetPrescaler(u8 IWDG_Prescaler)
{
  /* Check the parameters */
  assert_param(IS_IWDG_PRESCALER(IWDG_Prescaler));

  IWDG->PR = IWDG_Prescaler;
}
开发者ID:Helius,项目名称:trying-with-dso-nano-v1,代码行数:22,代码来源:stm32f10x_iwdg.c


示例3: HAL_IWDG_Init

/**
  * @brief  Initializes the IWDG according to the specified
  *         parameters in the IWDG_InitTypeDef and creates the associated handle.
  * @param  hiwdg: IWDG handle
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg)
{
    uint32_t tmp;

    /* Check the IWDG handle allocation */
    if(hiwdg == NULL)
    {
        return HAL_ERROR;
    }

    /* Check the parameters */
    assert_param(IS_IWDG_PRESCALER(hiwdg->Init.Prescaler));
    assert_param(IS_IWDG_RELOAD(hiwdg->Init.Reload));

    if(hiwdg->State == HAL_IWDG_STATE_RESET)
    {
        /* Init the low level hardware */
        HAL_IWDG_MspInit(hiwdg);
    }

    /* Change IWDG peripheral state */
    hiwdg->State = HAL_IWDG_STATE_BUSY;

    /* Set IWDG counter clock prescaler */
    /* Get the PR register value */
    tmp = hiwdg->Instance->PR;

    /* Clear PR[2:0] bits */
    tmp &= ((uint32_t)~(IWDG_PR_PR));

    /* Prepare the IWDG Prescaler parameter */
    tmp |= hiwdg->Init.Prescaler;

    /* Enable write access to IWDG_PR and IWDG_RLR registers */
    __HAL_IWDG_ENABLE_WRITE_ACCESS(hiwdg);

    /* Write to IWDG PR */
    hiwdg->Instance->PR = tmp;

    /* Set IWDG counter reload value */
    /* Get the RLR register value */
    tmp = hiwdg->Instance->RLR;

    /* Clear RL[11:0] bits */
    tmp &= ((uint32_t)~(IWDG_RLR_RL));

    /* Prepare the IWDG Prescaler parameter */
    tmp |= hiwdg->Init.Reload;

    /* Write to IWDG RLR */
    hiwdg->Instance->RLR = tmp;

    /* Change IWDG peripheral state */
    hiwdg->State = HAL_IWDG_STATE_READY;

    /* Return function status */
    return HAL_OK;
}
开发者ID:sinaaghli,项目名称:STM32DT,代码行数:64,代码来源:stm32f2xx_hal_iwdg.c


示例4: HAL_IWDG_Init

/**
  * @brief  Initialize the IWDG according to the specified parameters in the 
  *         IWDG_InitTypeDef and start watchdog. Before exiting function, 
  *         watchdog is refreshed in order to have correct time base.
  * @param  hiwdg  pointer to a IWDG_HandleTypeDef structure that contains
  *                the configuration information for the specified IWDG module.
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg)
{
  uint32_t tickstart;

  /* Check the IWDG handle allocation */
  if(hiwdg == NULL)
  {
    return HAL_ERROR;
  }

  /* Check the parameters */
  assert_param(IS_IWDG_ALL_INSTANCE(hiwdg->Instance));
  assert_param(IS_IWDG_PRESCALER(hiwdg->Init.Prescaler));
  assert_param(IS_IWDG_RELOAD(hiwdg->Init.Reload));
  assert_param(IS_IWDG_WINDOW(hiwdg->Init.Window));

  /* Enable IWDG. LSI is turned on automaticaly */
  __HAL_IWDG_START(hiwdg);

  /* Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers by writing
  0x5555 in KR */
  IWDG_ENABLE_WRITE_ACCESS(hiwdg);

  /* Write to IWDG registers the Prescaler & Reload values to work with */
  hiwdg->Instance->PR = hiwdg->Init.Prescaler;
  hiwdg->Instance->RLR = hiwdg->Init.Reload;

  /* Check pending flag, if previous update not done, return timeout */
  tickstart = HAL_GetTick();

   /* Wait for register to be updated */
  while(hiwdg->Instance->SR != RESET)
  {
    if((HAL_GetTick() - tickstart ) > HAL_IWDG_DEFAULT_TIMEOUT)
    {
      return HAL_TIMEOUT;
    }
  }

  /* If window parameter is different than current value, modify window 
  register */
  if(hiwdg->Instance->WINR != hiwdg->Init.Window)
  {
    /* Write to IWDG WINR the IWDG_Window value to compare with. In any case,
    even if window feature is disabled, Watchdog will be reloaded by writing 
    windows register */
    hiwdg->Instance->WINR = hiwdg->Init.Window;
  }
  else
  {
    /* Reload IWDG counter with value defined in the reload register */
    __HAL_IWDG_RELOAD_COUNTER(hiwdg);
  }

  /* Return function status */
  return HAL_OK;
}
开发者ID:Archcady,项目名称:mbed-os,代码行数:65,代码来源:stm32l4xx_hal_iwdg.c


示例5: HAL_IWDG_Init

/**
  * @brief  Initializes the IWDG according to the specified
  *         parameters in the IWDG_InitTypeDef and creates the associated handle.
  * @param  hiwdg: pointer to a IWDG_HandleTypeDef structure that contains
  *                the configuration information for the specified IWDG module.
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg)
{
  /* Check the IWDG handle allocation */
  if(hiwdg == NULL)
  {
    return HAL_ERROR;
  }

  /* Check the parameters */
  assert_param(IS_IWDG_ALL_INSTANCE(hiwdg->Instance));
  assert_param(IS_IWDG_PRESCALER(hiwdg->Init.Prescaler));
  assert_param(IS_IWDG_RELOAD(hiwdg->Init.Reload));
  
  /* Check pending flag, if previous update not done, return error */
  if((__HAL_IWDG_GET_FLAG(hiwdg, IWDG_FLAG_PVU) != RESET)
     &&(__HAL_IWDG_GET_FLAG(hiwdg, IWDG_FLAG_RVU) != RESET))
  {
    return HAL_ERROR;
  }
    
  if(hiwdg->State == HAL_IWDG_STATE_RESET)
  {  
    /* Allocate lock resource and initialize it */
    hiwdg->Lock = HAL_UNLOCKED;

    /* Init the low level hardware */
    HAL_IWDG_MspInit(hiwdg);
  }
  
  /* Change IWDG peripheral state */
  hiwdg->State = HAL_IWDG_STATE_BUSY;  
  
  /* Enable write access to IWDG_PR and IWDG_RLR registers */  
  IWDG_ENABLE_WRITE_ACCESS(hiwdg);
  
  /* Write to IWDG registers the IWDG_Prescaler & IWDG_Reload values to work with */
  MODIFY_REG(hiwdg->Instance->PR, IWDG_PR_PR, hiwdg->Init.Prescaler);
  MODIFY_REG(hiwdg->Instance->RLR, IWDG_RLR_RL, hiwdg->Init.Reload);
 
  /* Change IWDG peripheral state */
  hiwdg->State = HAL_IWDG_STATE_READY;
  
  /* Return function status */
  return HAL_OK;
}
开发者ID:EverSince,项目名称:STM32-AD7156,代码行数:52,代码来源:stm32l1xx_hal_iwdg.c


示例6: HAL_IWDG_Init

/**
  * @brief  Initialize the IWDG according to the specified parameters in the 
  *         IWDG_InitTypeDef and start watchdog. Before exiting function, 
  *         watchdog is refreshed in order to have correct time base.
  * @param  hiwdg  pointer to a IWDG_HandleTypeDef structure that contains
  *                the configuration information for the specified IWDG module.
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg)
{
  uint32_t tickstart;

  /* Check the IWDG handle allocation */
  if(hiwdg == NULL)
  {
    return HAL_ERROR;
  }

  /* Check the parameters */
  assert_param(IS_IWDG_ALL_INSTANCE(hiwdg->Instance));
  assert_param(IS_IWDG_PRESCALER(hiwdg->Init.Prescaler));
  assert_param(IS_IWDG_RELOAD(hiwdg->Init.Reload));

  /* Enable IWDG. LSI is turned on automaticaly */
  __HAL_IWDG_START(hiwdg);

  /* Enable write access to IWDG_PR, IWDG_RLR registers by writing
  0x5555 in KR */
  IWDG_ENABLE_WRITE_ACCESS(hiwdg);

  /* Write to IWDG registers the Prescaler & Reload values to work with */
  hiwdg->Instance->PR = hiwdg->Init.Prescaler;
  hiwdg->Instance->RLR = hiwdg->Init.Reload;

  /* Check pending flag, if previous update not done, return timeout */
  tickstart = HAL_GetTick();

   /* Wait for register to be updated */
  while(hiwdg->Instance->SR != RESET)
  {
    if((HAL_GetTick() - tickstart ) > HAL_IWDG_DEFAULT_TIMEOUT)
    {
      return HAL_TIMEOUT;
    }
  }

  /* Reload IWDG counter with value defined in the reload register */
  __HAL_IWDG_RELOAD_COUNTER(hiwdg);

  /* Return function status */
  return HAL_OK;
}
开发者ID:Lora-net,项目名称:LoRaMac-node,代码行数:52,代码来源:stm32l1xx_hal_iwdg.c


示例7: iwdg_stm32_install_timeout

static int iwdg_stm32_install_timeout(struct device *dev,
				      const struct wdt_timeout_cfg *config)
{
	IWDG_TypeDef *iwdg = IWDG_STM32_STRUCT(dev);
	u32_t timeout = config->window.max * USEC_PER_MSEC;
	u32_t prescaler = 0U;
	u32_t reload = 0U;
	u32_t tickstart;

	if (config->callback != NULL) {
		return -ENOTSUP;
	}

	iwdg_stm32_convert_timeout(timeout, &prescaler, &reload);

	if (IS_IWDG_TIMEOUT(timeout) || IS_IWDG_PRESCALER(prescaler) ||
	    IS_IWDG_RELOAD(reload)) {
		/* One of the parameters provided is invalid */
		return -EINVAL;
	}

	tickstart = k_uptime_get_32();

	while (LL_IWDG_IsReady(iwdg) == 0) {
		/* Wait untill WVU, RVU, PVU are reset before updating  */
		if ((k_uptime_get_32() - tickstart) > IWDG_DEFAULT_TIMEOUT) {
			return -ENODEV;
		}
	}

	LL_IWDG_EnableWriteAccess(iwdg);

	LL_IWDG_SetPrescaler(iwdg, prescaler);
	LL_IWDG_SetReloadCounter(iwdg, reload);

	return 0;
}
开发者ID:milinddeore,项目名称:zephyr,代码行数:37,代码来源:iwdg_stm32.c


示例8: HAL_IWDG_Init

/**
  * @brief  Initialize the IWDG according to the specified
  *         parameters in the IWDG_InitTypeDef and initialize the associated handle.
  * @param  hiwdg: pointer to a IWDG_HandleTypeDef structure that contains
  *                the configuration information for the specified IWDG module.
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg)
{
  uint32_t tickstart = 0;

  /* Check the IWDG handle allocation */
  if(hiwdg == NULL)
  {
    return HAL_ERROR;
  }

  /* Check the parameters */
  assert_param(IS_IWDG_PRESCALER(hiwdg->Init.Prescaler));
  assert_param(IS_IWDG_RELOAD(hiwdg->Init.Reload));
  assert_param(IS_IWDG_WINDOW(hiwdg->Init.Window));

  /* Check pending flag, if previous update not done, return error */
  if(((hiwdg->Instance->SR) & IWDG_SR_FLAGS) != 0)
  {
    return HAL_ERROR;
  }

  if(hiwdg->State == HAL_IWDG_STATE_RESET)
  {
    /* Allocate lock resource and initialize it */
    hiwdg->Lock = HAL_UNLOCKED;

    /* Init the low level hardware */
    HAL_IWDG_MspInit(hiwdg);
  }

  /* Change IWDG peripheral state */
  hiwdg->State = HAL_IWDG_STATE_BUSY;

  /* Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers */
  /* by writing 0x5555 in KR */
  IWDG_ENABLE_WRITE_ACCESS(hiwdg);

  /* Write to IWDG registers the IWDG_Prescaler & IWDG_Reload values to work with */
  MODIFY_REG(hiwdg->Instance->PR, IWDG_PR_PR, hiwdg->Init.Prescaler);
  MODIFY_REG(hiwdg->Instance->RLR, IWDG_RLR_RL, hiwdg->Init.Reload);

  /* check if window option is enabled */
  if (((hiwdg->Init.Window) != IWDG_WINDOW_DISABLE) || ((hiwdg->Instance->WINR) != IWDG_WINDOW_DISABLE))
  {
    tickstart = HAL_GetTick();

     /* Wait for register to be updated */
    while(((hiwdg->Instance->SR) & IWDG_SR_FLAGS) != 0)
    {
      if((HAL_GetTick() - tickstart ) > HAL_IWDG_DEFAULT_TIMEOUT)
      {
        /* Set IWDG state */
        hiwdg->State = HAL_IWDG_STATE_TIMEOUT;
        return HAL_TIMEOUT;
      }
    }

    /* Write to IWDG WINR the IWDG_Window value to compare with */
    MODIFY_REG(hiwdg->Instance->WINR, IWDG_WINR_WIN, hiwdg->Init.Window);
  }

  /* Change IWDG peripheral state */
  hiwdg->State = HAL_IWDG_STATE_READY;

  /* Return function status */
  return HAL_OK;
}
开发者ID:Babody,项目名称:mbed,代码行数:74,代码来源:stm32l4xx_hal_iwdg.c


示例9: IWDG_SetPrescaler

/**
  * @简述  设置 IWDG 预分频值.
  * @参数  IWDG_Prescaler: 指定 IWDG 预分频值.
  *                        这个参数可以是下面的值之一:
  *                        IWDG_Prescaler_4:   设置IWDG预分频值为 4
  *                        IWDG_Prescaler_8:   设置IWDG预分频值为 8
  *                        IWDG_Prescaler_16:  设置IWDG预分频值为 16
  *                        IWDG_Prescaler_32:  设置IWDG预分频值为 32
  *                        IWDG_Prescaler_64:  设置IWDG预分频值为 64
  *                        IWDG_Prescaler_128: 设置IWDG预分频值为 128
  *                        IWDG_Prescaler_256: 设置IWDG预分频值为 256
  * @返回  没有
  */
void IWDG_SetPrescaler(uint8_t IWDG_Prescaler)
{
  /* 检查参数 */
  assert_param(IS_IWDG_PRESCALER(IWDG_Prescaler));
  IWDG->PR = IWDG_Prescaler;
}
开发者ID:ljqhack,项目名称:seuOS,代码行数:19,代码来源:stm32f10x_iwdg.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IS_IWDG_RELOAD函数代码示例发布时间:2022-05-30
下一篇:
C++ IS_ITEM_GUID函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap