Commit Graph

1 Commits

Author SHA1 Message Date
robert-hh
c2e4759cfa mimxrt/modmachine: Implement machine.WDT() and machine.reset_cause().
The API follows that of rp2, stm32, esp32, and the docs.

    wdt=machine.WDT(0, timeout)

        Timeout is given in ms. The valid range is 500 to 128000 (128
        seconds) with 500 ms granularity. Values outside of that range will
        be silently aligned.

    wdt.feed()

        Resets the watchdog timer (feeding).

    wdt.timeout_ms(value)

        Sets a new timeout and feeds the watchdog.

        This is a new, preliminary method which is not yet documented.

    reset_cause = machine.reset_cause()

        Values returned:

        1  Power On reset
        3  Watchdog reset
        5  Software reset: state after calling machine.reset()

More elaborate API functions are supported by the MCU, like an interrupt
called a certain time after feeding.  But for port cosistency that is not
implemented.
2021-10-25 15:43:56 +11:00