File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
TARGET_RASPBERRYPI/TARGET_RP2040 Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include "watchdog_api.h"
2
+ #include "hardware/watchdog.h"
3
+ #include "structs/watchdog.h"
4
+
5
+ #if DEVICE_WATCHDOG
6
+
7
+ watchdog_status_t hal_watchdog_init (const watchdog_config_t * config )
8
+ {
9
+ // The pico watchdogs accept a maximum value of 0x7fffff
10
+ if ( config -> timeout_ms < 0x1 && config -> timeout_ms > 0x7FFFFF ) {
11
+ return WATCHDOG_STATUS_INVALID_ARGUMENT ;
12
+ }
13
+
14
+ watchdog_enable (config -> timeout_ms , true);
15
+
16
+ return WATCHDOG_STATUS_OK ;
17
+ }
18
+
19
+ void hal_watchdog_kick (void )
20
+ {
21
+ watchdog_update ();
22
+ }
23
+
24
+ watchdog_status_t hal_watchdog_stop (void )
25
+ {
26
+ hw_clear_bits (& watchdog_hw -> ctrl , WATCHDOG_CTRL_ENABLE_BITS );
27
+ return WATCHDOG_STATUS_OK ;
28
+ }
29
+
30
+ uint32_t hal_watchdog_get_reload_value (void )
31
+ {
32
+ return (watchdog_hw -> load / 2000U );
33
+ }
34
+
35
+ watchdog_features_t hal_watchdog_get_platform_features (void )
36
+ {
37
+ watchdog_features_t features ;
38
+
39
+ features .max_timeout = 0x7FFFFF ;
40
+ features .update_config = true;
41
+ features .disable_watchdog = true;
42
+ return features ;
43
+
44
+ }
45
+
46
+ #endif // DEVICE_WATCHDOG
Original file line number Diff line number Diff line change 7976
7976
" SERIAL_FC" ,
7977
7977
" SPI" ,
7978
7978
" USTICKER" ,
7979
+ " WATCHDOG" ,
7979
7980
" USBDEVICE"
7980
7981
]
7981
7982
},
You can’t perform that action at this time.
0 commit comments