123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- #include "gd32f10x_wwdgt.h"
- void wwdgt_deinit(void)
- {
- rcu_periph_reset_enable(RCU_WWDGTRST);
- rcu_periph_reset_disable(RCU_WWDGTRST);
- }
- void wwdgt_enable(void)
- {
- WWDGT_CTL |= WWDGT_CTL_WDGTEN;
- }
- void wwdgt_counter_update(uint16_t counter_value)
- {
- WWDGT_CTL = (uint32_t)(CTL_CNT(counter_value));
- }
- void wwdgt_config(uint16_t counter, uint16_t window, uint32_t prescaler)
- {
- WWDGT_CTL = (uint32_t)(CTL_CNT(counter));
- WWDGT_CFG = (uint32_t)(CFG_WIN(window) | prescaler);
- }
- FlagStatus wwdgt_flag_get(void)
- {
- if(WWDGT_STAT & WWDGT_STAT_EWIF) {
- return SET;
- }
- return RESET;
- }
- void wwdgt_flag_clear(void)
- {
- WWDGT_STAT = (uint32_t)(RESET);
- }
- void wwdgt_interrupt_enable(void)
- {
- WWDGT_CFG |= WWDGT_CFG_EWIE;
- }
|