Skip to content

Commit 0bb5b77

Browse files
committed
IO: Add a 100ms timeout to I2C to allow communication with Arduino
Note this currently does not include the compiled binary for linux-arm64
1 parent 41a52e7 commit 0bb5b77

File tree

1 file changed

+3
-0
lines changed
  • java/libraries/io/src/native

1 file changed

+3
-0
lines changed

java/libraries/io/src/native/impl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_transferI2c
323323
packets.nmsgs++;
324324
}
325325

326+
// set the timeout to 100ms - this helps slow devices such as the
327+
// Arduino Uno to keep up
328+
ioctl(handle, I2C_TIMEOUT, 10);
326329
int ret = ioctl(handle, I2C_RDWR, &packets);
327330
if (ret < 0) {
328331
ret = -errno;

0 commit comments

Comments
 (0)