Skip to content

Commit

Permalink
Add WDT functions to RP2040 Helper (#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
brentru authored Sep 22, 2022
1 parent 91b4bdb commit 4e77ee0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cores/rp2040/RP2040Support.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@ class RP2040 {
reboot();
}

void wdt_begin(uint32_t delay_ms) {
watchdog_enable(delay_ms, 1);
}

void wdt_reset() {
watchdog_update();
}

const char *getChipID() {
static char id[PICO_UNIQUE_BOARD_ID_SIZE_BYTES + 1] = { 0 };
if (!id[0]) {
Expand Down
14 changes: 14 additions & 0 deletions docs/rp2040.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ void rp2040.reboot()
~~~~~~~~~~~~~~~~~~~~
Forces a hardware reboot of the Pico.

Hardware Watchdog
_________________

void rp2040.wdt_begin(uint32_t delay_ms)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enables the hardware watchdog timer with a delay value of delay_ms
microseconds. Note that on the RP2040, once this function has called, the
hardware watchdog can _not_ be disabled.

void rp2040.wdt_reset()
~~~~~~~~~~~~~~~~
Reloads the watchdog's counter with the amount of time set by wdt_begin.


Memory Information
------------------

Expand Down

0 comments on commit 4e77ee0

Please sign in to comment.