Rename watchdog related variables to be more intuitively named.

This commit is contained in:
László Monda
2017-11-09 20:41:19 +01:00
parent 4aad86947c
commit c2efb5e0d0
7 changed files with 17 additions and 16 deletions

View File

@@ -5,8 +5,8 @@
#include "init_peripherals.h"
static uint32_t prevWatchdogCounter = 0;
uint32_t I2cWatchdog_InnerCounter;
volatile uint32_t I2cWatchdog_OuterCounter;
uint32_t I2cWatchdog_RecoveryCounter;
volatile uint32_t I2cWatchdog_WatchCounter;
void InitI2cWatchdog(void)
{
@@ -22,11 +22,11 @@ void InitI2cWatchdog(void)
void I2C_WATCHDOG_LPTMR_HANDLER(void)
{
TEST_LED_TOGGLE();
I2cWatchdog_OuterCounter++;
I2cWatchdog_WatchCounter++;
if (I2C_Watchdog == prevWatchdogCounter) { // Restart I2C if there hasn't been any interrupt during 100 ms
// NVIC_SystemReset();
I2cWatchdog_InnerCounter++;
I2cWatchdog_RecoveryCounter++;
I2C_SlaveDeinit(I2C_BUS_BASEADDR);
InitI2c();
}

View File

@@ -8,8 +8,8 @@
#include "slave_scheduler.h"
#include "init_peripherals.h"
uint32_t I2cWatchdog_OuterCounter;
uint32_t I2cWatchdog_InnerCounter;
uint32_t I2cWatchdog_WatchCounter;
uint32_t I2cWatchdog_RecoveryCounter;
static uint32_t prevWatchdogCounter;
@@ -18,9 +18,9 @@ static uint32_t prevWatchdogCounter;
// This method relies on a patched KSDK which increments I2C_Watchdog upon I2C transfers.
void PIT_I2C_WATCHDOG_HANDLER(void)
{
I2cWatchdog_OuterCounter++;
I2cWatchdog_WatchCounter++;
if (I2C_Watchdog == prevWatchdogCounter) { // Restart I2C if there haven't been any interrupts recently
I2cWatchdog_InnerCounter++;
I2cWatchdog_RecoveryCounter++;
i2c_master_config_t masterConfig;
I2C_MasterGetDefaultConfig(&masterConfig);
I2C_MasterDeinit(I2C_MAIN_BUS_BASEADDR);

View File

@@ -11,8 +11,8 @@
// Variables:
extern uint32_t I2cWatchdog_InnerCounter;
extern uint32_t I2cWatchdog_OuterCounter;
extern uint32_t I2cWatchdog_RecoveryCounter;
extern uint32_t I2cWatchdog_WatchCounter;
// Functions:

View File

@@ -73,6 +73,7 @@ void LedSlaveDriver_Init(uint8_t ledDriverId) {
LedDisplay_SetText(3, "FTY");
}
status_t LedSlaveDriver_Update(uint8_t ledDriverId) {
status_t status = kStatus_Uhk_IdleSlave;
uint8_t *ledValues = LedDriverValues[ledDriverId];

View File

@@ -8,7 +8,7 @@
#include "i2c.h"
#include "i2c_addresses.h"
uint32_t I2cSchedulerCounter;
uint32_t I2cSlaveScheduler_Counter;
static uint8_t previousSlaveId;
static uint8_t currentSlaveId;
@@ -51,7 +51,7 @@ static void slaveSchedulerCallback(I2C_Type *base, i2c_master_handle_t *handle,
{
bool isFirstIteration = true;
bool isTransferScheduled = false;
I2cSchedulerCounter++;
I2cSlaveScheduler_Counter++;
do {
uhk_slave_t *previousSlave = Slaves + previousSlaveId;

View File

@@ -41,7 +41,7 @@
// Variables:
extern uhk_slave_t Slaves[];
extern uint32_t I2cSchedulerCounter;
extern uint32_t I2cSlaveScheduler_Counter;
// Functions:

View File

@@ -9,9 +9,9 @@ uint8_t DebugBuffer[USB_GENERIC_HID_OUT_BUFFER_LENGTH];
void UsbCommand_GetDebugBuffer(void)
{
SET_DEBUG_BUFFER_UINT32(1, I2C_Watchdog);
SET_DEBUG_BUFFER_UINT32(5, I2cSchedulerCounter);
SET_DEBUG_BUFFER_UINT32(9, I2cWatchdog_OuterCounter);
SET_DEBUG_BUFFER_UINT32(13, I2cWatchdog_InnerCounter);
SET_DEBUG_BUFFER_UINT32(5, I2cSlaveScheduler_Counter);
SET_DEBUG_BUFFER_UINT32(9, I2cWatchdog_WatchCounter);
SET_DEBUG_BUFFER_UINT32(13, I2cWatchdog_RecoveryCounter);
memcpy(GenericHidOutBuffer, DebugBuffer, USB_GENERIC_HID_OUT_BUFFER_LENGTH);