Skip to content

Commit

Permalink
Now able to write more data that is needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
mores committed Sep 16, 2024
1 parent 98fecbc commit 20d71f2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@
<maven-antrun-plugin.version>3.1.0</maven-antrun-plugin.version>
<maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
<maven-bundle-plugin.version>5.1.2</maven-bundle-plugin.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
<maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>
<maven-gpg-plugin.version>3.2.1</maven-gpg-plugin.version>
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
<maven-release-plugin.version>3.0.0-M4</maven-release-plugin.version>
<maven-resource-plugin.version>3.2.0</maven-resource-plugin.version>
Expand Down Expand Up @@ -668,7 +668,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
<version>3.5.0</version>
</plugin>

<!-- Deploy to Maven plugin -->
Expand Down

0 comments on commit 20d71f2

Please sign in to comment.