Skip to content

Commit

Permalink
Merge pull request #365 from Pi4J/feature/runsOnRaspberryPi
Browse files Browse the repository at this point in the history
Add runsOnRaspberryPi
  • Loading branch information
eitch authored Jun 25, 2024
2 parents 4878aee + d532f68 commit 7152cda
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.pi4j.library.gpiod.internal;

import com.pi4j.boardinfo.definition.BoardModel;
import com.pi4j.boardinfo.util.BoardInfoHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -36,7 +35,7 @@ public GpioDContext() {
}

public synchronized void initialize() {
if (BoardInfoHelper.current().getBoardModel() == BoardModel.UNKNOWN) {
if (!BoardInfoHelper.runningOnRaspberryPi()) {
logger.warn("Can't initialize GpioD context, board model is unknown");
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
* #L%
*/

import com.pi4j.boardinfo.definition.BoardModel;
import com.pi4j.boardinfo.util.BoardInfoHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -256,7 +255,7 @@ public static void loadLibraryFromClasspath(String path) throws IOException {
}

// Finally, load the library
if (BoardInfoHelper.current().getBoardModel() == BoardModel.UNKNOWN) {
if (!BoardInfoHelper.runningOnRaspberryPi()) {
logger.warn("Can't load the library, board model is unknown");
} else {
System.load(target.toAbsolutePath().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public static boolean usesRP1() {
return instance.boardInfo.getBoardModel() == BoardModel.MODEL_5_B;
}

public static boolean runningOnRaspberryPi() {
return instance.boardInfo.getBoardModel() != BoardModel.UNKNOWN;
}

public static boolean is32bit() {
return !is64bit();
}
Expand Down

0 comments on commit 7152cda

Please sign in to comment.