1 /**************************************************************************//**
2 * @file wwdt.c
3 * @version V3.00
4 * @brief M480 series WWDT driver source file
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 * @copyright (C) 2016-2020 Nuvoton Technology Corp. All rights reserved.
8 *****************************************************************************/
9 #include "NuMicro.h"
10
11
12 /** @addtogroup Standard_Driver Standard Driver
13 @{
14 */
15
16 /** @addtogroup WWDT_Driver WWDT Driver
17 @{
18 */
19
20 /** @addtogroup WWDT_EXPORTED_FUNCTIONS WWDT Exported Functions
21 @{
22 */
23
24 /**
25 * @brief Open WWDT and start counting
26 *
27 * @param[in] u32PreScale Pre-scale setting of WWDT counter. Valid values are:
28 * - \ref WWDT_PRESCALER_1
29 * - \ref WWDT_PRESCALER_2
30 * - \ref WWDT_PRESCALER_4
31 * - \ref WWDT_PRESCALER_8
32 * - \ref WWDT_PRESCALER_16
33 * - \ref WWDT_PRESCALER_32
34 * - \ref WWDT_PRESCALER_64
35 * - \ref WWDT_PRESCALER_128
36 * - \ref WWDT_PRESCALER_192
37 * - \ref WWDT_PRESCALER_256
38 * - \ref WWDT_PRESCALER_384
39 * - \ref WWDT_PRESCALER_512
40 * - \ref WWDT_PRESCALER_768
41 * - \ref WWDT_PRESCALER_1024
42 * - \ref WWDT_PRESCALER_1536
43 * - \ref WWDT_PRESCALER_2048
44 * @param[in] u32CmpValue Setting the window compared value. Valid values are between 0x0 to 0x3F.
45 * @param[in] u32EnableInt Enable WWDT time-out interrupt function. Valid values are TRUE and FALSE.
46 *
47 * @return None
48 *
49 * @details This function makes WWDT module start counting with different counter period by pre-scale setting and compared window value.
50 * @note This WWDT_CTL register can be write only one time after chip is powered on or reset.
51 */
WWDT_Open(uint32_t u32PreScale,uint32_t u32CmpValue,uint32_t u32EnableInt)52 void WWDT_Open(uint32_t u32PreScale,
53 uint32_t u32CmpValue,
54 uint32_t u32EnableInt)
55 {
56 WWDT->CTL = u32PreScale |
57 (u32CmpValue << WWDT_CTL_CMPDAT_Pos) |
58 ((u32EnableInt == TRUE) ? WWDT_CTL_INTEN_Msk : 0U) |
59 WWDT_CTL_WWDTEN_Msk;
60 return;
61 }
62
63 /*@}*/ /* end of group WWDT_EXPORTED_FUNCTIONS */
64
65 /*@}*/ /* end of group WWDT_Driver */
66
67 /*@}*/ /* end of group Standard_Driver */
68
69 /*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/
70