⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stm32f10x_wwdg.lst

📁 编译环境是 iar EWARM ,STM32 下的UCOSII
💻 LST
📖 第 1 页 / 共 2 页
字号:
     70          *                    This parameter can be one of the following values:
     71          *                       - WWDG_Prescaler_1: WWDG counter clock = (PCLK1/4096)/1
     72          *                       - WWDG_Prescaler_2: WWDG counter clock = (PCLK1/4096)/2
     73          *                       - WWDG_Prescaler_4: WWDG counter clock = (PCLK1/4096)/4
     74          *                       - WWDG_Prescaler_8: WWDG counter clock = (PCLK1/4096)/8
     75          * Output         : None
     76          * Return         : None
     77          *******************************************************************************/
     78          void WWDG_SetPrescaler(u32 WWDG_Prescaler)
     79          {
     80            u32 tmpreg = 0;
     81          
     82            /* Check the parameters */
     83            assert_param(IS_WWDG_PRESCALER(WWDG_Prescaler));
     84          
     85            /* Clear WDGTB[1:0] bits */
     86            tmpreg = WWDG->CFR & CFR_WDGTB_Mask;
     87          
     88            /* Set WDGTB[1:0] bits according to WWDG_Prescaler value */
     89            tmpreg |= WWDG_Prescaler;
     90          
     91            /* Store the new value */
     92            WWDG->CFR = tmpreg;
     93          }
     94          
     95          /*******************************************************************************
     96          * Function Name  : WWDG_SetWindowValue
     97          * Description    : Sets the WWDG window value.
     98          * Input          : - WindowValue: specifies the window value to be compared to
     99          *                    the downcounter.
    100          *                    This parameter value must be lower than 0x80.
    101          * Output         : None
    102          * Return         : None
    103          *******************************************************************************/
    104          void WWDG_SetWindowValue(u8 WindowValue)
    105          {
    106            u32 tmpreg = 0;
    107          
    108            /* Check the parameters */
    109            assert_param(IS_WWDG_WINDOW_VALUE(WindowValue));
    110          
    111            /* Clear W[6:0] bits */
    112            tmpreg = WWDG->CFR & CFR_W_Mask;
    113          
    114            /* Set W[6:0] bits according to WindowValue value */
    115            tmpreg |= WindowValue & BIT_Mask;
    116          
    117            /* Store the new value */
    118            WWDG->CFR = tmpreg;
    119          }
    120          
    121          /*******************************************************************************
    122          * Function Name  : WWDG_EnableIT
    123          * Description    : Enables the WWDG Early Wakeup interrupt(EWI).
    124          * Input          : None
    125          * Output         : None
    126          * Return         : None
    127          *******************************************************************************/
    128          void WWDG_EnableIT(void)
    129          {
    130            *(vu32 *) CFR_EWI_BB = (u32)ENABLE;
    131          }
    132          
    133          /*******************************************************************************
    134          * Function Name  : WWDG_SetCounter
    135          * Description    : Sets the WWDG counter value.
    136          * Input          : - Counter: specifies the watchdog counter value.
    137          *                    This parameter must be a number between 0x40 and 0x7F.
    138          * Output         : None
    139          * Return         : None
    140          *******************************************************************************/
    141          void WWDG_SetCounter(u8 Counter)
    142          {
    143            /* Check the parameters */
    144            assert_param(IS_WWDG_COUNTER(Counter));
    145          
    146            /* Write to T[6:0] bits to configure the counter value, no need to do
    147               a read-modify-write; writing a 0 to WDGA bit does nothing */
    148            WWDG->CR = Counter & BIT_Mask;
    149          }
    150          
    151          /*******************************************************************************
    152          * Function Name  : WWDG_Enable
    153          * Description    : Enables WWDG and load the counter value.
    154          *                  - Counter: specifies the watchdog counter value.
    155          *                    This parameter must be a number between 0x40 and 0x7F.
    156          * Input          : None
    157          * Output         : None
    158          * Return         : None
    159          *******************************************************************************/
    160          void WWDG_Enable(u8 Counter)
    161          {
    162            /* Check the parameters */
    163            assert_param(IS_WWDG_COUNTER(Counter));
    164          
    165            WWDG->CR = CR_WDGA_Set | Counter;
    166          }
    167          
    168          /*******************************************************************************
    169          * Function Name  : WWDG_GetFlagStatus
    170          * Description    : Checks whether the Early Wakeup interrupt flag is set or not.
    171          * Input          : None
    172          * Output         : None
    173          * Return         : The new state of the Early Wakeup interrupt flag (SET or RESET)
    174          *******************************************************************************/
    175          FlagStatus WWDG_GetFlagStatus(void)
    176          {
    177            return (FlagStatus)(*(vu32 *) SR_EWIF_BB);
    178          }
    179          
    180          /*******************************************************************************
    181          * Function Name  : WWDG_ClearFlag
    182          * Description    : Clears Early Wakeup interrupt flag.
    183          * Input          : None
    184          * Output         : None
    185          * Return         : None
    186          *******************************************************************************/
    187          void WWDG_ClearFlag(void)
    188          {
    189            WWDG->SR = (u32)RESET;
    190          }
    191          
    192          /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/

Errors: 5
Warnings: none

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -