1 /********************************** (C) COPYRIGHT  *******************************
2  * File Name          : ch32v10x_iwdg.h
3  * Author             : WCH
4  * Version            : V1.0.0
5  * Date               : 2020/04/30
6  * Description        : This file contains all the functions prototypes for the
7  *                      IWDG firmware library.
8  * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
9  * SPDX-License-Identifier: Apache-2.0
10  *******************************************************************************/
11 #ifndef __CH32V10x_IWDG_H
12 #define __CH32V10x_IWDG_H
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include "ch32v10x.h"
19 
20 /* IWDG_WriteAccess */
21 #define IWDG_WriteAccess_Enable     ((uint16_t)0x5555)
22 #define IWDG_WriteAccess_Disable    ((uint16_t)0x0000)
23 
24 /* IWDG_prescaler */
25 #define IWDG_Prescaler_4            ((uint8_t)0x00)
26 #define IWDG_Prescaler_8            ((uint8_t)0x01)
27 #define IWDG_Prescaler_16           ((uint8_t)0x02)
28 #define IWDG_Prescaler_32           ((uint8_t)0x03)
29 #define IWDG_Prescaler_64           ((uint8_t)0x04)
30 #define IWDG_Prescaler_128          ((uint8_t)0x05)
31 #define IWDG_Prescaler_256          ((uint8_t)0x06)
32 
33 /* IWDG_Flag */
34 #define IWDG_FLAG_PVU               ((uint16_t)0x0001)
35 #define IWDG_FLAG_RVU               ((uint16_t)0x0002)
36 
37 void       IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess);
38 void       IWDG_SetPrescaler(uint8_t IWDG_Prescaler);
39 void       IWDG_SetReload(uint16_t Reload);
40 void       IWDG_ReloadCounter(void);
41 void       IWDG_Enable(void);
42 FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG);
43 
44 #ifdef __cplusplus
45 }
46 #endif
47 
48 #endif /* __CH32V10x_IWDG_H */
49