px-fwlib 0.10.0
Cross-platform embedded library and documentation for 8/16/32-bit microcontrollers generated with Doxygen 1.9.2
px_wwdg.h
1#ifndef __PX_WWDG_H__
2#define __PX_WWDG_H__
3/* =============================================================================
4 ____ ___ ____ ___ _ _ ___ __ __ ___ __ __ TM
5 | _ \ |_ _| / ___| / _ \ | \ | | / _ \ | \/ | |_ _| \ \/ /
6 | |_) | | | | | | | | | | \| | | | | | | |\/| | | | \ /
7 | __/ | | | |___ | |_| | | |\ | | |_| | | | | | | | / \
8 |_| |___| \____| \___/ |_| \_| \___/ |_| |_| |___| /_/\_\
9
10 Copyright (c) 2021 Pieter Conradie <https://piconomix.com>
11
12 License: MIT
13 https://github.com/piconomix/px-fwlib/blob/master/LICENSE.md
14
15 Title: px_wwdg.h : System Window Watchdog module
16 Author(s): Pieter Conradie
17 Creation Date: 2021-05-08
18
19============================================================================= */
20
21/**
22 * @ingroup STM32
23 * @defgroup STM32_WWDG px_wwdg.h : System Window Watchdog module
24 *
25 * This module is used to initialise the WWDG peripheral.
26 *
27 * File(s):
28 * - arch/arm/stm32/inc/px_wwdg.h
29 * - arch/arm/stm32/src/px_wwdg.c
30 *
31 * @{
32 */
33
34/* _____STANDARD INCLUDES____________________________________________________ */
35
36/* _____PROJECT INCLUDES_____________________________________________________ */
37#include "px_defs.h"
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42/* _____DEFINITIONS__________________________________________________________ */
43
44/* _____TYPE DEFINITIONS_____________________________________________________ */
45/// Window Watchdog clock prescaler (PCLK / 4096 clock source)
46typedef enum
47{
48 PX_WWDG_PRESCALER_1 = 0, ///< Clock = (PCLK / 4096) / 1
49 PX_WWDG_PRESCALER_2 = 1, ///< Clock = (PCLK / 4096) / 2
50 PX_WWDG_PRESCALER_4 = 2, ///< Clock = (PCLK / 4096) / 4
51 PX_WWDG_PRESCALER_8 = 3, ///< Clock = (PCLK / 4096) / 8
53
54/* _____GLOBAL VARIABLES_____________________________________________________ */
55
56/* _____GLOBAL FUNCTION DECLARATIONS_________________________________________ */
57/**
58 * Initialise System Window Watchdog
59 *
60 * @param prescaler Clock prescaler. See #px_wwdg_prescaler_t
61 * @param counter Reload counter value (max 0x7f)
62 * @param window Reload window (0 if not used; max 0x7f)
63 */
64void px_wwdg_init(px_wwdg_prescaler_t prescaler, uint8_t counter, uint8_t window);
65
66/**
67 * Reload watchdog counter, a.k.a. "patting the dog"
68 */
69void px_wwdg_reload_counter(void);
70
71/**
72 * Halt watchdog by disabling peripheral clock.
73 */
74void px_wwdg_halt(void);
75
76/**
77 * Resume watchdog by enabling peripheral clock.
78 */
79void px_wwdg_resume(void);
80
81/**
82 * Report state saved by early warning interrupt in .noinit variables.
83 */
84void px_wwdg_dbg_report(void);
85
86/* _____MACROS_______________________________________________________________ */
87
88#ifdef __cplusplus
89}
90#endif
91
92/// @}
93#endif
px_wwdg_prescaler_t
Window Watchdog clock prescaler (PCLK / 4096 clock source)
Definition: px_wwdg.h:47
void px_wwdg_halt(void)
Halt watchdog by disabling peripheral clock.
Definition: px_wwdg.c:187
void px_wwdg_dbg_report(void)
Report state saved by early warning interrupt in .noinit variables.
Definition: px_wwdg.c:197
void px_wwdg_reload_counter(void)
Reload watchdog counter, a.k.a.
Definition: px_wwdg.c:174
void px_wwdg_init(px_wwdg_prescaler_t prescaler, uint8_t counter, uint8_t window)
Initialise System Window Watchdog.
Definition: px_wwdg.c:118
void px_wwdg_resume(void)
Resume watchdog by enabling peripheral clock.
Definition: px_wwdg.c:192
@ PX_WWDG_PRESCALER_4
Clock = (PCLK / 4096) / 4.
Definition: px_wwdg.h:50
@ PX_WWDG_PRESCALER_1
Clock = (PCLK / 4096) / 1.
Definition: px_wwdg.h:48
@ PX_WWDG_PRESCALER_2
Clock = (PCLK / 4096) / 2.
Definition: px_wwdg.h:49
@ PX_WWDG_PRESCALER_8
Clock = (PCLK / 4096) / 8.
Definition: px_wwdg.h:51