From b2a86d3148af0bd4bf9b1c4c0625e3f76aba579f Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 7 Aug 2020 14:34:18 +0200 Subject: [PATCH] Add WDT functions --- ...ort_legacy_cores.ino => support_cores.ino} | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) rename tasmota/{support_legacy_cores.ino => support_cores.ino} (65%) diff --git a/tasmota/support_legacy_cores.ino b/tasmota/support_cores.ino similarity index 65% rename from tasmota/support_legacy_cores.ino rename to tasmota/support_cores.ino index e9a78e5ee..855768bbf 100644 --- a/tasmota/support_legacy_cores.ino +++ b/tasmota/support_cores.ino @@ -1,5 +1,5 @@ /* - support_legacy_cores.ino - Legacy arduino core support for Tasmota + support_cores.ino - Arduino core support for Tasmota Copyright (C) 2020 Theo Arends @@ -35,3 +35,29 @@ void resetPins() } */ } + +/*********************************************************************************************\ + * Hardware related +\*********************************************************************************************/ + +#ifdef ESP8266 + +void HwWdtDisable(void) { + *((volatile uint32_t*) 0x60000900) &= ~(1); // Hardware WDT OFF +} + +void HwWdtEnable(void) { + *((volatile uint32_t*) 0x60000900) |= 1; // Hardware WDT ON +} + +void WdtDisable(void) { + ESP.wdtDisable(); + HwWdtDisable(); +} + +void WdtEnable(void) { + HwWdtEnable(); + ESP.wdtEnable(0); +} + +#endif // ESP8266