123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- /**
- **************************************************************************
- * @file at32f403a_407_wwdt.c
- * @brief contains all the functions for the wwdt firmware library
- **************************************************************************
- * Copyright notice & Disclaimer
- *
- * The software Board Support Package (BSP) that is made available to
- * download from Artery official website is the copyrighted work of Artery.
- * Artery authorizes customers to use, copy, and distribute the BSP
- * software and its related documentation for the purpose of design and
- * development in conjunction with Artery microcontrollers. Use of the
- * software is governed by this copyright notice and the following disclaimer.
- *
- * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
- * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
- * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
- * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
- * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
- *
- **************************************************************************
- */
- #include "at32f403a_407_conf.h"
- /** @addtogroup AT32F403A_407_periph_driver
- * @{
- */
- /** @defgroup WWDT
- * @brief WWDT driver modules
- * @{
- */
- #ifdef WWDT_MODULE_ENABLED
- /** @defgroup WWDT_private_functions
- * @{
- */
- /**
- * @brief wwdt reset by crm reset register
- * @retval none
- */
- void wwdt_reset(void)
- {
- crm_periph_reset(CRM_WWDT_PERIPH_RESET, TRUE);
- crm_periph_reset(CRM_WWDT_PERIPH_RESET, FALSE);
- }
- /**
- * @brief wwdt division set
- * @param division
- * this parameter can be one of the following values:
- * - WWDT_PCLK1_DIV_4096 (wwdt counter clock = (pclk1/4096)/1)
- * - WWDT_PCLK1_DIV_8192 (wwdt counter clock = (pclk1/4096)/2)
- * - WWDT_PCLK1_DIV_16384 (wwdt counter clock = (pclk1/4096)/4)
- * - WWDT_PCLK1_DIV_32768 (wwdt counter clock = (pclk1/4096)/8)
- * @retval none
- */
- void wwdt_divider_set(wwdt_division_type division)
- {
- WWDT->cfg_bit.div = division;
- }
- /**
- * @brief wwdt reload counter interrupt flag clear
- * @param none
- * @retval none
- */
- void wwdt_flag_clear(void)
- {
- WWDT->sts = 0;
- }
- /**
- * @brief wwdt enable and the counter value load
- * @param wwdt_cnt (0x40~0x7f)
- * @retval none
- */
- void wwdt_enable(uint8_t wwdt_cnt)
- {
- WWDT->ctrl = wwdt_cnt | WWDT_EN_BIT;
- }
- /**
- * @brief wwdt reload counter interrupt enable
- * @param none
- * @retval none
- */
- void wwdt_interrupt_enable(void)
- {
- WWDT->cfg_bit.rldien = TRUE;
- }
- /**
- * @brief wwdt reload counter interrupt flag get
- * @param none
- * @retval state of reload counter interrupt flag
- */
- flag_status wwdt_flag_get(void)
- {
- return (flag_status)WWDT->sts_bit.rldf;
- }
- /**
- * @brief wwdt reload counter interrupt flag get
- * @param none
- * @retval state of reload counter interrupt flag
- */
- flag_status wwdt_interrupt_flag_get(void)
- {
- return (flag_status)(WWDT->sts_bit.rldf && WWDT->cfg_bit.rldien);
- }
- /**
- * @brief wwdt counter value set
- * @param wwdt_cnt (0x40~0x7f)
- * @retval none
- */
- void wwdt_counter_set(uint8_t wwdt_cnt)
- {
- WWDT->ctrl_bit.cnt = wwdt_cnt;
- }
- /**
- * @brief wwdt window counter value set
- * @param window_cnt (0x40~0x7f)
- * @retval none
- */
- void wwdt_window_counter_set(uint8_t window_cnt)
- {
- WWDT->cfg_bit.win = window_cnt;
- }
- /**
- * @}
- */
- #endif
- /**
- * @}
- */
- /**
- * @}
- */
|