diff --git a/libraries/pi4j-library-pigpio/src/main/java/com/pi4j/library/pigpio/impl/PiGpioNativeImpl.java b/libraries/pi4j-library-pigpio/src/main/java/com/pi4j/library/pigpio/impl/PiGpioNativeImpl.java index 79c8fd5e..23ed9e6a 100644 --- a/libraries/pi4j-library-pigpio/src/main/java/com/pi4j/library/pigpio/impl/PiGpioNativeImpl.java +++ b/libraries/pi4j-library-pigpio/src/main/java/com/pi4j/library/pigpio/impl/PiGpioNativeImpl.java @@ -1454,8 +1454,17 @@ public int spiWrite(int handle, byte[] data, int offset, int length) { Objects.checkFromIndexSize(offset, length, data.length); validateHandle(handle); // write data array to SPI bus/channel - int result = PIGPIO.spiWrite(handle, data, offset, length); - logger.trace("[SPI::WRITE] <- HANDLE={}; SUCCESS={}", handle, (result>=0)); + int result = 0; + byte[] someData = Arrays.copyOfRange(data, offset, length); + int chunksize = 4096; + int start = 0; + while (start < someData.length) { + int end = Math.min(someData.length, start + chunksize); + byte[] chunk = Arrays.copyOfRange(someData, start, end); + result += PIGPIO.spiWrite(handle, chunk, 0, chunk.length ); + logger.trace("[SPI::WRITE] <- HANDLE={}; SUCCESS={}", handle, (result>=0)); + start += chunksize; + } validateResult(result, false); return result; } diff --git a/pom.xml b/pom.xml index 0677c805..3391540b 100644 --- a/pom.xml +++ b/pom.xml @@ -274,10 +274,10 @@ 3.1.0 3.3.0 5.1.2 - 3.8.1 + 3.13.0 3.1.2 3.2.1 - 3.2.0 + 3.4.2 3.2.0 3.0.0-M4 3.2.0 @@ -668,7 +668,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M2 + 3.5.0