Skip to content

Commit 4e77ee0

Browse files
authored
Add WDT functions to RP2040 Helper (#862)
1 parent 91b4bdb commit 4e77ee0

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

cores/rp2040/RP2040Support.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,14 @@ class RP2040 {
314314
reboot();
315315
}
316316

317+
void wdt_begin(uint32_t delay_ms) {
318+
watchdog_enable(delay_ms, 1);
319+
}
320+
321+
void wdt_reset() {
322+
watchdog_update();
323+
}
324+
317325
const char *getChipID() {
318326
static char id[PICO_UNIQUE_BOARD_ID_SIZE_BYTES + 1] = { 0 };
319327
if (!id[0]) {

docs/rp2040.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ void rp2040.reboot()
3737
~~~~~~~~~~~~~~~~~~~~
3838
Forces a hardware reboot of the Pico.
3939

40+
Hardware Watchdog
41+
_________________
42+
43+
void rp2040.wdt_begin(uint32_t delay_ms)
44+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45+
Enables the hardware watchdog timer with a delay value of delay_ms
46+
microseconds. Note that on the RP2040, once this function has called, the
47+
hardware watchdog can _not_ be disabled.
48+
49+
void rp2040.wdt_reset()
50+
~~~~~~~~~~~~~~~~
51+
Reloads the watchdog's counter with the amount of time set by wdt_begin.
52+
53+
4054
Memory Information
4155
------------------
4256

0 commit comments

Comments
 (0)