STC15W408AS library 0.9.0
wdt.h
Go to the documentation of this file.
1#ifndef STC15_WDTH
2#define STC15_WDTH
3
4#include <sys.h>
5#include <bits.h>
6
37
46#define wdt_init(wdt_scale) \
47{ \
48 WDT_CONTR = 0; \
49 WDT_CONTR |= (wdt_scale & 0x07); \
50}
51
58#define wdt_start() (bit_set(WDT_CONTR, SBIT5))
59
66#define wdt_stop() (bit_clr(WDT_CONTR, CBIT5))
67
76#define is_wdt_started() (test_if_bit_set(WDT_CONTR, SBIT5))
77
84#define wdt_clear() (bit_set(WDT_CONTR, SBIT4))
85
94#define is_wdt_flag_on() (test_if_bit_set(WDT_CONTR, SBIT7))
95
102#define wdt_flag_reset() (bit_clr(WDT_CONTR, CBIT7))
103
110#define wdt_enable_in_idle() (bit_set(WDT_CONTR, SBIT3))
111
118#define wdt_disable_in_idle() (bit_clr(WDT_CONTR, CBIT3))
119
121
122
123#endif // STC15_WDTH