Skip to content

Commit

Permalink
Update watchdog function comment and timeout comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
mondalaci committed Aug 20, 2017
1 parent 894172b commit caf6302
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions right/src/i2c_watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit caf6302

Please sign in to comment.