From 7d011237f86fefe1a7d81a6149fa93d2e432c703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Sun, 5 Aug 2018 22:24:34 +0200 Subject: [PATCH] Always use the I2C watchdog for the left half. Remove I2C_WATCHDOG and relevant preprocessor stuff. --- left/src/config.h | 5 ----- left/src/i2c_watchdog.c | 7 ------- 2 files changed, 12 deletions(-) diff --git a/left/src/config.h b/left/src/config.h index 885a1b6..83e512b 100644 --- a/left/src/config.h +++ b/left/src/config.h @@ -3,11 +3,6 @@ // Macros: - #define I2C_WATCHDOG_VALUE_REINIT 1 - #define I2C_WATCHDOG_VALUE_REBOOT 2 - // #define DEBUG_OVER_SPI - #define I2C_WATCHDOG I2C_WATCHDOG_VALUE_REINIT -// #define I2C_WATCHDOG I2C_WATCHDOG_VALUE_REBOOT #endif diff --git a/left/src/i2c_watchdog.c b/left/src/i2c_watchdog.c index 40718a6..5fdb693 100644 --- a/left/src/i2c_watchdog.c +++ b/left/src/i2c_watchdog.c @@ -9,7 +9,6 @@ * See https://community.nxp.com/thread/457893 * Therefore the hardware watchdog timer cannot be used without an extra way to enter bootloader or application mode. */ -#ifdef I2C_WATCHDOG static uint32_t prevWatchdogCounter = 0; static uint32_t I2cWatchdog_RecoveryCounter; /* counter for how many times we had to recover and restart */ @@ -27,16 +26,10 @@ void RunWatchdog(void) if (I2cWatchdog_WatchCounter>10) { /* do not check within the first 1000 ms, as I2C might not be running yet */ if (I2C_Watchdog == prevWatchdogCounter) { // Restart I2C if there hasn't been any interrupt during 100 ms. I2C_Watchdog gets incremented for every I2C transaction I2cWatchdog_RecoveryCounter++; -#if I2C_WATCHDOG == I2C_WATCHDOG_VALUE_REBOOT - NVIC_SystemReset(); -#endif -#if I2C_WATCHDOG == I2C_WATCHDOG_VALUE_REINIT I2C_SlaveDeinit(I2C_BUS_BASEADDR); initI2c(); -#endif } } prevWatchdogCounter = I2C_Watchdog; /* remember previous counter */ } } -#endif