From caf630204da3485ac8e44eae7636843425402cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Sun, 20 Aug 2017 16:43:58 +0200 Subject: [PATCH] Update watchdog function comment and timeout comment. --- right/src/i2c_watchdog.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/right/src/i2c_watchdog.c b/right/src/i2c_watchdog.c index bea9c03..70e6ae3 100644 --- a/right/src/i2c_watchdog.c +++ b/right/src/i2c_watchdog.c @@ -13,12 +13,13 @@ static uint32_t prevWatchdogCounter = 0; uint32_t I2C_WatchdogInnerCounter; uint32_t I2C_WatchdogOuterCounter; -// This function is designed to restart and reinstall the I2C handler -// when a disconnection of the left side makes the master I2C bus unresponsive. +// This function restarts and reinstalls the I2C handler when the I2C bus gets unresponsive +// by a misbehaving I2C slave, or by disconnecting the left keyboard half or an add-on module. +// This method relies on a patched KSDK which increments I2C_Watchdog upon I2C transfers. void PIT_I2C_WATCHDOG_HANDLER(void) { I2C_WatchdogOuterCounter++; - if (I2C_Watchdog == prevWatchdogCounter) { // Restart I2C if there hasn't be any interrupt during 1 sec + if (I2C_Watchdog == prevWatchdogCounter) { // Restart I2C if there hasn't be any interrupt during 100 ms I2C_WatchdogInnerCounter++; i2c_master_config_t masterConfig; I2C_MasterGetDefaultConfig(&masterConfig);