diff --git a/right/src/slave_scheduler.c b/right/src/slave_scheduler.c index a3613da..20ad644 100644 --- a/right/src/slave_scheduler.c +++ b/right/src/slave_scheduler.c @@ -84,7 +84,7 @@ static void slaveSchedulerCallback(I2C_Type *base, i2c_master_handle_t *handle, previousSlaveId = currentSlaveId++; } - if (currentSlaveId >= (sizeof(Slaves) / sizeof(uhk_slave_t))) { + if (currentSlaveId >= SLAVE_COUNT) { currentSlaveId = 0; } } while (!isTransferScheduled); @@ -95,7 +95,7 @@ void InitSlaveScheduler(void) previousSlaveId = 0; currentSlaveId = 0; - for (uint8_t i=0; iisConnected = false; } diff --git a/right/src/slave_scheduler.h b/right/src/slave_scheduler.h index cd667a3..e02599d 100644 --- a/right/src/slave_scheduler.h +++ b/right/src/slave_scheduler.h @@ -6,6 +6,10 @@ #include "fsl_common.h" #include "config.h" +// Macros: + + #define SLAVE_COUNT (sizeof(Slaves) / sizeof(uhk_slave_t)) + // Typedefs: typedef enum { // Slaves[] is meant to be indexed with these values