something
This commit is contained in:
@ -125,7 +125,6 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int numDevices = sizeof(devices) / sizeof(struct device);
|
|
||||||
for (int i = 0; i < numDevices; i++) {
|
for (int i = 0; i < numDevices; i++) {
|
||||||
setI2CAddress(devices[i].address);
|
setI2CAddress(devices[i].address);
|
||||||
i2cResponse = i2c_smbus_read_byte_data(i2c, 0);
|
i2cResponse = i2c_smbus_read_byte_data(i2c, 0);
|
||||||
@ -139,10 +138,13 @@ int main() {
|
|||||||
sendI2CInit(devices[i]);
|
sendI2CInit(devices[i]);
|
||||||
} else if (i2cResponse == DATA_STOP_BYTE) {
|
} else if (i2cResponse == DATA_STOP_BYTE) {
|
||||||
// expect no forther data from device
|
// expect no forther data from device
|
||||||
|
usleep(50 * 1000);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
// real data
|
// real data
|
||||||
_log("data: 0x%02x\n", i2cResponse);
|
_log("data: 0x%02x\n", i2cResponse);
|
||||||
|
/*
|
||||||
|
XXX: put data into cache and handle with another core / loop / fork / whatever
|
||||||
if (i2cResponse & TRIGGER_BIT_1) {
|
if (i2cResponse & TRIGGER_BIT_1) {
|
||||||
if (i2cResponse & HIGH_BIT_1) {
|
if (i2cResponse & HIGH_BIT_1) {
|
||||||
sendI2CData(devices[i], TRIGGER_BIT_1, "+1+", 3);
|
sendI2CData(devices[i], TRIGGER_BIT_1, "+1+", 3);
|
||||||
@ -158,9 +160,9 @@ int main() {
|
|||||||
sendI2CData(devices[i], TRIGGER_BIT_2, "-2-", 3);
|
sendI2CData(devices[i], TRIGGER_BIT_2, "-2-", 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
usleep(10 * 1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
close(i2c);
|
close(i2c);
|
||||||
|
Reference in New Issue
Block a user