Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add runsOnRaspberryPi #365

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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