1 /*****************************************************************************
2  * Copyright (c) 2019, Nations Technologies Inc.
3  *
4  * All rights reserved.
5  * ****************************************************************************
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * - Redistributions of source code must retain the above copyright notice,
11  * this list of conditions and the disclaimer below.
12  *
13  * Nations' name may not be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY NATIONS "AS IS" AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
19  * DISCLAIMED. IN NO EVENT SHALL NATIONS BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
22  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
25  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  * ****************************************************************************/
27 
28 /**
29  * @file n32wb452_wwdg.h
30  * @author Nations
31  * @version v1.0.0
32  *
33  * @copyright Copyright (c) 2019, Nations Technologies Inc. All rights reserved.
34  */
35 #ifndef __N32WB452_WWDG_H__
36 #define __N32WB452_WWDG_H__
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 #include "n32wb452.h"
43 
44 /** @addtogroup N32WB452_StdPeriph_Driver
45  * @{
46  */
47 
48 /** @addtogroup WWDG
49  * @{
50  */
51 
52 /** @addtogroup WWDG_Exported_Types
53  * @{
54  */
55 
56 /**
57  * @}
58  */
59 
60 /** @addtogroup WWDG_Exported_Constants
61  * @{
62  */
63 
64 /** @addtogroup WWDG_Prescaler
65  * @{
66  */
67 
68 #define WWDG_PRESCALER_DIV1 ((uint32_t)0x00000000)
69 #define WWDG_PRESCALER_DIV2 ((uint32_t)0x00000080)
70 #define WWDG_PRESCALER_DIV4 ((uint32_t)0x00000100)
71 #define WWDG_PRESCALER_DIV8 ((uint32_t)0x00000180)
72 #define IS_WWDG_PRESCALER_DIV(PRESCALER)                                                                               \
73     (((PRESCALER) == WWDG_PRESCALER_DIV1) || ((PRESCALER) == WWDG_PRESCALER_DIV2)                                      \
74      || ((PRESCALER) == WWDG_PRESCALER_DIV4) || ((PRESCALER) == WWDG_PRESCALER_DIV8))
75 #define IS_WWDG_WVALUE(VALUE) ((VALUE) <= 0x7F)
76 #define IS_WWDG_CNT(COUNTER)  (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F))
77 
78 /**
79  * @}
80  */
81 
82 /**
83  * @}
84  */
85 
86 /** @addtogroup WWDG_Exported_Macros
87  * @{
88  */
89 /**
90  * @}
91  */
92 
93 /** @addtogroup WWDG_Exported_Functions
94  * @{
95  */
96 
97 void WWDG_DeInit(void);
98 void WWDG_SetPrescalerDiv(uint32_t WWDG_Prescaler);
99 void WWDG_SetWValue(uint8_t WindowValue);
100 void WWDG_EnableInt(void);
101 void WWDG_SetCnt(uint8_t Counter);
102 void WWDG_Enable(uint8_t Counter);
103 FlagStatus WWDG_GetEWINTF(void);
104 void WWDG_ClrEWINTF(void);
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 #endif /* __N32WB452__WWDG_H */
111 
112 /**
113  * @}
114  */
115 
116 /**
117  * @}
118  */
119 
120 /**
121  * @}
122  */
123