Add SLAVE_COUNT
This commit is contained in:
@@ -84,7 +84,7 @@ static void slaveSchedulerCallback(I2C_Type *base, i2c_master_handle_t *handle,
|
|||||||
previousSlaveId = currentSlaveId++;
|
previousSlaveId = currentSlaveId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentSlaveId >= (sizeof(Slaves) / sizeof(uhk_slave_t))) {
|
if (currentSlaveId >= SLAVE_COUNT) {
|
||||||
currentSlaveId = 0;
|
currentSlaveId = 0;
|
||||||
}
|
}
|
||||||
} while (!isTransferScheduled);
|
} while (!isTransferScheduled);
|
||||||
@@ -95,7 +95,7 @@ void InitSlaveScheduler(void)
|
|||||||
previousSlaveId = 0;
|
previousSlaveId = 0;
|
||||||
currentSlaveId = 0;
|
currentSlaveId = 0;
|
||||||
|
|
||||||
for (uint8_t i=0; i<sizeof(Slaves) / sizeof(uhk_slave_t); i++) {
|
for (uint8_t i=0; i<SLAVE_COUNT; i++) {
|
||||||
uhk_slave_t *currentSlave = Slaves + i;
|
uhk_slave_t *currentSlave = Slaves + i;
|
||||||
currentSlave->isConnected = false;
|
currentSlave->isConnected = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,10 @@
|
|||||||
#include "fsl_common.h"
|
#include "fsl_common.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
// Macros:
|
||||||
|
|
||||||
|
#define SLAVE_COUNT (sizeof(Slaves) / sizeof(uhk_slave_t))
|
||||||
|
|
||||||
// Typedefs:
|
// Typedefs:
|
||||||
|
|
||||||
typedef enum { // Slaves[] is meant to be indexed with these values
|
typedef enum { // Slaves[] is meant to be indexed with these values
|
||||||
|
|||||||
Reference in New Issue
Block a user