Only call LogI2cError() if the passed status is an actual I2C error, otherwise it slows the mouse pointer down.
This commit is contained in:
@@ -5,10 +5,6 @@ i2c_slave_error_counter_t I2cSlaveErrorCounters[MAX_SLAVE_COUNT];
|
||||
|
||||
void LogI2cError(uint8_t slaveId, status_t status)
|
||||
{
|
||||
if (!(kStatus_I2C_Busy <= status && status <= kStatus_I2C_Timeout)) {
|
||||
return;
|
||||
}
|
||||
|
||||
i2c_slave_error_counter_t *i2cSlaveErrorCounter = I2cSlaveErrorCounters + slaveId;
|
||||
uint8_t errorIdx;
|
||||
|
||||
|
||||
@@ -61,7 +61,9 @@ static void slaveSchedulerCallback(I2C_Type *base, i2c_master_handle_t *handle,
|
||||
uhk_slave_t *currentSlave = Slaves + currentSlaveId;
|
||||
|
||||
previousSlave->previousStatus = previousStatus;
|
||||
LogI2cError(previousSlaveId, previousStatus);
|
||||
if (IS_STATUS_I2C_ERROR(previousStatus)) {
|
||||
LogI2cError(previousSlaveId, previousStatus);
|
||||
}
|
||||
|
||||
if (isFirstIteration) {
|
||||
bool wasPreviousSlaveConnected = previousSlave->isConnected;
|
||||
@@ -77,7 +79,9 @@ static void slaveSchedulerCallback(I2C_Type *base, i2c_master_handle_t *handle,
|
||||
}
|
||||
|
||||
status_t currentStatus = currentSlave->update(currentSlave->perDriverId);
|
||||
LogI2cError(currentSlaveId, currentStatus);
|
||||
if (IS_STATUS_I2C_ERROR(currentStatus)) {
|
||||
LogI2cError(currentSlaveId, currentStatus);
|
||||
}
|
||||
isTransferScheduled = currentStatus != kStatus_Uhk_IdleSlave && currentStatus != kStatus_Uhk_NoTransfer;
|
||||
if (isTransferScheduled) {
|
||||
currentSlave->isConnected = true;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#define SLAVE_COUNT (sizeof(Slaves) / sizeof(uhk_slave_t))
|
||||
#define MAX_SLAVE_COUNT 6
|
||||
#define IS_VALID_SLAVE_ID(slaveId) (0 <= slaveId && slaveId <= MAX_SLAVE_COUNT)
|
||||
#define IS_STATUS_I2C_ERROR(status) (kStatus_I2C_Busy <= status && status <= kStatus_I2C_Timeout)
|
||||
|
||||
// Typedefs:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user