File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
targets/TARGET_RASPBERRYPI/TARGET_RP2040 Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 4
4
5
5
#if DEVICE_WATCHDOG
6
6
7
- static watchdog_config_t watchdogConfig ;
7
+ static watchdog_config_t watchdogConfig = {
8
+ 0 // timeout_ms
9
+ };
8
10
9
11
watchdog_status_t hal_watchdog_init (const watchdog_config_t * config )
10
12
{
11
- watchdogConfig = * config ;
12
13
// The pico watchdogs accept a maximum value of 0x7fffff
13
14
if ( config -> timeout_ms < 0x1 && config -> timeout_ms > 0x7FFFFF ) {
14
15
return WATCHDOG_STATUS_INVALID_ARGUMENT ;
15
16
}
16
17
18
+ watchdogConfig = * config ;
17
19
watchdog_enable (config -> timeout_ms , true);
18
20
19
21
return WATCHDOG_STATUS_OK ;
@@ -32,9 +34,12 @@ watchdog_status_t hal_watchdog_stop(void)
32
34
33
35
uint32_t hal_watchdog_get_reload_value (void )
34
36
{
35
- uint32_t load_value = watchdogConfig .timeout_ms * 1000 * 2 ;
36
- if (load_value > 0xffffffu ) {
37
- load_value = 0xffffffu ;
37
+ uint32_t load_value = 0 ;
38
+ if ( watchdogConfig .timeout_ms > 0 ) {
39
+ load_value = watchdogConfig .timeout_ms * 1000 * 2 ;
40
+ if (load_value > 0xffffffu ) {
41
+ load_value = 0xffffffu ;
42
+ }
38
43
}
39
44
return load_value ;
40
45
}
You can’t perform that action at this time.
0 commit comments