Merge pull request #4083 from microDev1/watchdog-rp
RP2040: Support for WatchDog
This commit is contained in:
commit
17cf03c8e4
9
Makefile
9
Makefile
@ -40,17 +40,18 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(BASEOPTS)
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(BASEOPTS)
|
||||
|
||||
TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/cxd56 ports/esp32s2 ports/mimxrt10xx ports/nrf ports/stm py shared-bindings shared-module supervisor
|
||||
TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/cxd56 ports/esp32s2 ports/mimxrt10xx ports/nrf ports/raspberrypi ports/stm py shared-bindings shared-module supervisor
|
||||
# Paths to exclude from TRANSLATE_SOURCES
|
||||
# Each must be preceded by "-path"; if any wildcards, enclose in quotes.
|
||||
# Separate by "-o" (Find's "or" operand)
|
||||
TRANSLATE_SOURCES_EXC = -path "ports/*/build-*" \
|
||||
-o -path "ports/*/build" \
|
||||
-o -path ports/esp32s2/esp-idf \
|
||||
-o -path ports/cxd56/spresense-exported-sdk \
|
||||
-o -path ports/stm/st_driver \
|
||||
-o -path ports/atmel-samd/asf4 \
|
||||
-o -path ports/cxd56/spresense-exported-sdk \
|
||||
-o -path ports/esp32s2/esp-idf \
|
||||
-o -path ports/mimxrt10xx/sdk \
|
||||
-o -path ports/raspberrypi/sdk \
|
||||
-o -path ports/stm/st_driver \
|
||||
-o -path lib/tinyusb \
|
||||
-o -path lib/lwip \
|
||||
|
||||
|
@ -339,6 +339,10 @@ msgstr ""
|
||||
msgid "All event channels in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
msgid "All state machines in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c
|
||||
msgid "All sync event channels in use"
|
||||
msgstr ""
|
||||
@ -387,6 +391,7 @@ msgstr ""
|
||||
#: ports/cxd56/common-hal/analogio/AnalogOut.c
|
||||
#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c
|
||||
#: ports/nrf/common-hal/analogio/AnalogOut.c
|
||||
#: ports/raspberrypi/common-hal/analogio/AnalogOut.c
|
||||
msgid "AnalogOut functionality not supported"
|
||||
msgstr ""
|
||||
|
||||
@ -586,6 +591,7 @@ msgstr ""
|
||||
#: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c
|
||||
#: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c
|
||||
#: ports/nrf/common-hal/digitalio/DigitalInOut.c
|
||||
#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c
|
||||
msgid "Cannot get pull while in output mode"
|
||||
msgstr ""
|
||||
|
||||
@ -863,7 +869,8 @@ msgstr ""
|
||||
msgid "Error: Failure to bind"
|
||||
msgstr ""
|
||||
|
||||
#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c
|
||||
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c
|
||||
#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c
|
||||
#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c
|
||||
#: shared-bindings/neopixel_write/__init__.c
|
||||
#: shared-bindings/terminalio/Terminal.c
|
||||
@ -1045,6 +1052,10 @@ msgstr ""
|
||||
msgid "I2C Init Error"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/busio/I2C.c
|
||||
msgid "I2C peripheral in use"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiobusio/I2SOut.c
|
||||
msgid "I2SOut not available"
|
||||
msgstr ""
|
||||
@ -1068,6 +1079,10 @@ msgstr ""
|
||||
msgid "Incorrect buffer size"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
|
||||
msgid "Init program size invalid"
|
||||
msgstr ""
|
||||
|
||||
#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c
|
||||
msgid "Initialization failed due to lack of memory"
|
||||
msgstr ""
|
||||
@ -1080,6 +1095,31 @@ msgstr ""
|
||||
msgid "Input/output error"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
#, c-format
|
||||
msgid "Instruction %d jumps on pin"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
#, c-format
|
||||
msgid "Instruction %d shifts in more bits than pin count"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
#, c-format
|
||||
msgid "Instruction %d shifts out more bits than pin count"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
#, c-format
|
||||
msgid "Instruction %d uses extra pin"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
#, c-format
|
||||
msgid "Instruction %d waits on input outside of count"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/_bleio/__init__.c
|
||||
msgid "Insufficient authentication"
|
||||
msgstr ""
|
||||
@ -1131,7 +1171,7 @@ msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/pwmio/PWMOut.c
|
||||
#: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c
|
||||
#: shared-bindings/pwmio/PWMOut.c
|
||||
#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c
|
||||
msgid "Invalid PWM frequency"
|
||||
msgstr ""
|
||||
|
||||
@ -1225,6 +1265,8 @@ msgstr ""
|
||||
#: ports/mimxrt10xx/common-hal/busio/I2C.c
|
||||
#: ports/mimxrt10xx/common-hal/busio/SPI.c
|
||||
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c
|
||||
#: ports/raspberrypi/common-hal/busio/I2C.c
|
||||
#: ports/raspberrypi/common-hal/busio/SPI.c
|
||||
msgid "Invalid pins"
|
||||
msgstr ""
|
||||
|
||||
@ -1346,6 +1388,36 @@ msgstr ""
|
||||
msgid "Missing MISO or MOSI Pin"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
#, c-format
|
||||
msgid "Missing first_in_pin. Instruction %d reads pin(s)"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
#, c-format
|
||||
msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
#, c-format
|
||||
msgid "Missing first_in_pin. Instruction %d waits based on pin"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
#, c-format
|
||||
msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
#, c-format
|
||||
msgid "Missing first_out_pin. Instruction %d writes pin(s)"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
#, c-format
|
||||
msgid "Missing first_set_pin. Instruction %d sets pin(s)"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/displayio/Group.c
|
||||
msgid "Must be a %q subclass."
|
||||
msgstr ""
|
||||
@ -1399,14 +1471,14 @@ msgstr ""
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c
|
||||
#: ports/esp32s2/common-hal/busio/UART.c
|
||||
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
|
||||
#: ports/stm/common-hal/busio/UART.c
|
||||
#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
|
||||
msgid "No RX pin"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c
|
||||
#: ports/esp32s2/common-hal/busio/UART.c
|
||||
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
|
||||
#: ports/stm/common-hal/busio/UART.c
|
||||
#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
|
||||
msgid "No TX pin"
|
||||
msgstr ""
|
||||
|
||||
@ -1463,6 +1535,10 @@ msgstr ""
|
||||
msgid "No network with that ssid"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
msgid "No out in program"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/touchio/TouchIn.c
|
||||
msgid "No pulldown on pin; 1Mohm recommended"
|
||||
msgstr ""
|
||||
@ -1518,6 +1594,10 @@ msgstr ""
|
||||
msgid "Only 8 or 16 bit mono with "
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
msgid "Only IN/OUT of up to 8 supported"
|
||||
msgstr ""
|
||||
|
||||
#: ports/esp32s2/common-hal/wifi/__init__.c
|
||||
msgid "Only IPv4 addresses supported"
|
||||
msgstr ""
|
||||
@ -1590,6 +1670,7 @@ msgid ""
|
||||
msgstr ""
|
||||
|
||||
#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
|
||||
#: ports/raspberrypi/common-hal/displayio/ParallelBus.c
|
||||
#: ports/stm/common-hal/displayio/ParallelBus.c
|
||||
msgid "ParallelBus not yet supported"
|
||||
msgstr ""
|
||||
@ -1602,11 +1683,20 @@ msgstr ""
|
||||
msgid "Permission denied"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
|
||||
msgid "Pin count must be at least 1"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
msgid "Pin count too large"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/analogio/AnalogIn.c
|
||||
#: ports/cxd56/common-hal/analogio/AnalogIn.c
|
||||
#: ports/esp32s2/common-hal/analogio/AnalogIn.c
|
||||
#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
|
||||
#: ports/nrf/common-hal/analogio/AnalogIn.c
|
||||
#: ports/raspberrypi/common-hal/analogio/AnalogIn.c
|
||||
#: ports/stm/common-hal/analogio/AnalogIn.c
|
||||
msgid "Pin does not have ADC capabilities"
|
||||
msgstr ""
|
||||
@ -1667,10 +1757,34 @@ msgstr ""
|
||||
msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
msgid "Program does IN without loading ISR"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
msgid "Program does OUT without loading OSR"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
|
||||
msgid "Program must contain at least one 16-bit instruction."
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
|
||||
msgid "Program size invalid"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
|
||||
msgid "Program too large"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/digitalio/DigitalInOut.c
|
||||
msgid "Pull not used when direction is output."
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c
|
||||
msgid "RAISE mode is not implemented"
|
||||
msgstr ""
|
||||
|
||||
#: ports/stm/common-hal/os/__init__.c
|
||||
msgid "RNG DeInit Error"
|
||||
msgstr ""
|
||||
@ -1753,6 +1867,7 @@ msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
|
||||
#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
|
||||
#: ports/raspberrypi/common-hal/busio/I2C.c
|
||||
msgid "SDA or SCL needs a pull up"
|
||||
msgstr ""
|
||||
|
||||
@ -1774,6 +1889,10 @@ msgstr ""
|
||||
msgid "SPI Re-initialization error"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/busio/SPI.c
|
||||
msgid "SPI peripheral in use"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr ""
|
||||
@ -1804,6 +1923,14 @@ msgstr ""
|
||||
msgid "Server side context cannot have hostname"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
|
||||
msgid "Set pin count must be between 1 and 5"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
|
||||
msgid "Side set pin count must be between 1 and 5"
|
||||
msgstr ""
|
||||
|
||||
#: ports/cxd56/common-hal/camera/Camera.c
|
||||
msgid "Size not supported"
|
||||
msgstr ""
|
||||
@ -1968,6 +2095,10 @@ msgstr ""
|
||||
msgid "UART Re-init error"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/busio/UART.c
|
||||
msgid "UART not yet supported"
|
||||
msgstr ""
|
||||
|
||||
#: ports/stm/common-hal/busio/UART.c
|
||||
msgid "UART write error"
|
||||
msgstr ""
|
||||
@ -2072,7 +2203,8 @@ msgid ""
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c
|
||||
#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c
|
||||
#: ports/esp32s2/common-hal/busio/UART.c
|
||||
#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c
|
||||
msgid "Unsupported baudrate"
|
||||
msgstr ""
|
||||
|
||||
@ -2123,6 +2255,7 @@ msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/watchdog/WatchDogTimer.c
|
||||
#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c
|
||||
msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET"
|
||||
msgstr ""
|
||||
|
||||
@ -3521,6 +3654,14 @@ msgstr ""
|
||||
msgid "pressing both buttons at start up.\n"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
|
||||
msgid "pull_threshold must be between 1 and 32"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
|
||||
msgid "push_threshold must be between 1 and 32"
|
||||
msgstr ""
|
||||
|
||||
#: extmod/modutimeq.c
|
||||
msgid "queue overflow"
|
||||
msgstr ""
|
||||
@ -3724,6 +3865,7 @@ msgstr ""
|
||||
|
||||
#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c
|
||||
#: ports/nrf/common-hal/watchdog/WatchDogTimer.c
|
||||
#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c
|
||||
msgid "timeout duration exceeded the maximum supported value"
|
||||
msgstr ""
|
||||
|
||||
|
@ -112,6 +112,17 @@ const nvm_bytearray_obj_t common_hal_mcu_nvm_obj = {
|
||||
};
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_WATCHDOG
|
||||
// The singleton watchdog.WatchDogTimer object.
|
||||
watchdog_watchdogtimer_obj_t common_hal_mcu_watchdogtimer_obj = {
|
||||
.base = {
|
||||
.type = &watchdog_watchdogtimer_type,
|
||||
},
|
||||
.timeout = 0.0f,
|
||||
.mode = WATCHDOGMODE_NONE,
|
||||
};
|
||||
#endif
|
||||
|
||||
// This maps MCU pin names to pin objects.
|
||||
const mp_rom_map_elem_t mcu_pin_global_dict_table[TOTAL_GPIO_COUNT] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_GPIO0), MP_ROM_PTR(&pin_GPIO0) },
|
||||
|
1
ports/raspberrypi/common-hal/watchdog/WatchDogMode.c
Normal file
1
ports/raspberrypi/common-hal/watchdog/WatchDogMode.c
Normal file
@ -0,0 +1 @@
|
||||
// No watchdog module functions.
|
83
ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c
Normal file
83
ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 microDev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "py/runtime.h"
|
||||
#include "common-hal/watchdog/WatchDogTimer.h"
|
||||
|
||||
#include "shared-bindings/watchdog/__init__.h"
|
||||
#include "shared-bindings/microcontroller/__init__.h"
|
||||
|
||||
#include "src/rp2_common/hardware_watchdog/include/hardware/watchdog.h"
|
||||
|
||||
void common_hal_watchdog_feed(watchdog_watchdogtimer_obj_t *self) {
|
||||
watchdog_update();
|
||||
}
|
||||
|
||||
void common_hal_watchdog_deinit(watchdog_watchdogtimer_obj_t *self) {
|
||||
if (self->mode == WATCHDOGMODE_RESET) {
|
||||
mp_raise_RuntimeError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET"));
|
||||
} else {
|
||||
self->mode = WATCHDOGMODE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void watchdog_reset(void) {
|
||||
common_hal_watchdog_deinit(&common_hal_mcu_watchdogtimer_obj);
|
||||
}
|
||||
*/
|
||||
|
||||
mp_float_t common_hal_watchdog_get_timeout(watchdog_watchdogtimer_obj_t *self) {
|
||||
return self->timeout;
|
||||
}
|
||||
|
||||
void common_hal_watchdog_set_timeout(watchdog_watchdogtimer_obj_t *self, mp_float_t new_timeout) {
|
||||
// max timeout is 8.388607 sec
|
||||
// this is rounded down to 8.388 sec
|
||||
uint64_t timeout = new_timeout * 1000;
|
||||
if (timeout > 8388) {
|
||||
mp_raise_ValueError(translate("timeout duration exceeded the maximum supported value"));
|
||||
}
|
||||
if ((uint16_t)self->timeout != timeout) {
|
||||
watchdog_enable(timeout, false);
|
||||
self->timeout = new_timeout;
|
||||
}
|
||||
}
|
||||
|
||||
watchdog_watchdogmode_t common_hal_watchdog_get_mode(watchdog_watchdogtimer_obj_t *self) {
|
||||
return self->mode;
|
||||
}
|
||||
|
||||
void common_hal_watchdog_set_mode(watchdog_watchdogtimer_obj_t *self, watchdog_watchdogmode_t new_mode) {
|
||||
if (self->mode != new_mode) {
|
||||
if (new_mode == WATCHDOGMODE_RAISE) {
|
||||
mp_raise_NotImplementedError(translate("RAISE mode is not implemented"));
|
||||
} else if (new_mode == WATCHDOGMODE_NONE) {
|
||||
common_hal_watchdog_deinit(self);
|
||||
}
|
||||
self->mode = new_mode;
|
||||
}
|
||||
}
|
43
ports/raspberrypi/common-hal/watchdog/WatchDogTimer.h
Normal file
43
ports/raspberrypi/common-hal/watchdog/WatchDogTimer.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 microDev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_WATCHDOG_WATCHDOGTIMER_H
|
||||
#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_WATCHDOG_WATCHDOGTIMER_H
|
||||
|
||||
#include "py/obj.h"
|
||||
#include "shared-bindings/watchdog/WatchDogMode.h"
|
||||
#include "shared-bindings/watchdog/WatchDogTimer.h"
|
||||
|
||||
struct _watchdog_watchdogtimer_obj_t {
|
||||
mp_obj_base_t base;
|
||||
mp_float_t timeout;
|
||||
watchdog_watchdogmode_t mode;
|
||||
};
|
||||
|
||||
// This needs to be called in order to disable the watchdog
|
||||
// void watchdog_reset(void);
|
||||
|
||||
#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_WATCHDOG_WATCHDOGTIMER_H
|
1
ports/raspberrypi/common-hal/watchdog/__init__.c
Normal file
1
ports/raspberrypi/common-hal/watchdog/__init__.c
Normal file
@ -0,0 +1 @@
|
||||
// No watchdog module functions.
|
@ -36,6 +36,7 @@ CIRCUITPY_NVM = 0
|
||||
CIRCUITPY_PULSEIO = 0 # Use PIO interally
|
||||
CIRCUITPY_ROTARYIO = 0 # Use PIO interally
|
||||
CIRCUITPY_RTC = 0
|
||||
CIRCUITPY_WATCHDOG = 1
|
||||
|
||||
# Things that are unsupported by the hardware.
|
||||
CIRCUITPY_AUDIOIO = 0
|
||||
|
Loading…
Reference in New Issue
Block a user