Bouffalo SDK  1.0
Bouffalolab Software Development Kit
bflb_wdg.h
Go to the documentation of this file.
1 #ifndef _BFLB_WDG_H
2 #define _BFLB_WDG_H
3 
4 #include "bflb_core.h"
5 
14 #if !defined(BL702L)
15 #define WDG_CLKSRC_BCLK 0
16 #endif
17 #define WDG_CLKSRC_32K 1
18 #define WDG_CLKSRC_1K 2
19 #define WDG_CLKSRC_XTAL 3
20 #if !defined(BL702) && !defined(BL602)
21 #define WDG_CLKSRC_GPIO 4
22 #endif
23 #define WDG_CLKSRC_NO 5
24 
28 #define WDG_MODE_INTERRUPT 0
29 #define WDG_MODE_RESET 1
30 
43  uint8_t clock_source;
44  uint8_t clock_div;
45  uint16_t comp_val;
46  uint8_t mode;
47 };
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
59 void bflb_wdg_init(struct bflb_device_s *dev, const struct bflb_wdg_config_s *config);
60 
66 void bflb_wdg_start(struct bflb_device_s *dev);
67 
73 void bflb_wdg_stop(struct bflb_device_s *dev);
74 
81 uint16_t bflb_wdg_get_countervalue(struct bflb_device_s *dev);
82 
89 void bflb_wdg_set_countervalue(struct bflb_device_s *dev, uint16_t value);
90 
97 
103 void bflb_wdg_compint_clear(struct bflb_device_s *dev);
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
117 #endif
void bflb_wdg_stop(struct bflb_device_s *dev)
Stop watchdog.
uint8_t mode
Definition: bflb_wdg.h:46
uint16_t bflb_wdg_get_countervalue(struct bflb_device_s *dev)
Get watchdog counter value.
uint8_t clock_div
Definition: bflb_wdg.h:44
void bflb_wdg_start(struct bflb_device_s *dev)
Start watchdog.
uint8_t clock_source
Definition: bflb_wdg.h:43
void bflb_wdg_init(struct bflb_device_s *dev, const struct bflb_wdg_config_s *config)
Initialize watchdog.
uint16_t comp_val
Definition: bflb_wdg.h:45
void bflb_wdg_reset_countervalue(struct bflb_device_s *dev)
Reset watchdog counter value.
void bflb_wdg_compint_clear(struct bflb_device_s *dev)
Clear watchdog compare interrupt status.
WDG configuration structure.
Definition: bflb_wdg.h:42
void bflb_wdg_set_countervalue(struct bflb_device_s *dev, uint16_t value)
Set watchdog counter value.