Skip to content

Commit

Permalink
Added RaspberryPi 5 support
Browse files Browse the repository at this point in the history
  • Loading branch information
alex9849 committed Feb 7, 2024
1 parent 43c93f7 commit 62b8ce8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</dependency>
<dependency>
<groupId>com.pi4j</groupId>
<artifactId>pi4j-plugin-pigpio</artifactId>
<artifactId>pi4j-plugin-gpiod</artifactId>
<version>${pi4j.version}</version>
</dependency>
<dependency>
Expand Down
16 changes: 6 additions & 10 deletions backend/src/main/java/net/alex9849/cocktailpi/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import com.pi4j.Pi4J;
import com.pi4j.context.Context;
import com.pi4j.context.ContextBuilder;
import com.pi4j.library.pigpio.PiGpio;
import com.pi4j.library.pigpio.impl.PiGpioNativeImpl;
import com.pi4j.plugin.gpiod.provider.gpio.digital.GpioDDigitalInputProvider;
import com.pi4j.plugin.gpiod.provider.gpio.digital.GpioDDigitalOutputProvider;
import com.pi4j.plugin.linuxfs.provider.i2c.LinuxFsI2CProvider;
import com.pi4j.plugin.mock.provider.gpio.digital.MockDigitalInputProvider;
import com.pi4j.plugin.mock.provider.gpio.digital.MockDigitalOutputProvider;
import com.pi4j.plugin.mock.provider.i2c.MockI2CProvider;
Expand Down Expand Up @@ -35,14 +36,9 @@ public Context getGpioController() {
if(gpioController == null) {
ContextBuilder ctxBuilder = Pi4J.newContextBuilder();
if(isRaspberryPi) {
//ctxBuilder.add(LinuxFsI2CProvider.newInstance());
PiGpio piGpio = PiGpioNativeImpl.newInstance();
ctxBuilder.add(PiGpioDigitalInputProvider.newInstance(piGpio));
ctxBuilder.add(PiGpioDigitalOutputProvider.newInstance(piGpio));
ctxBuilder.add(PiGpioSpiProvider.newInstance(piGpio));
ctxBuilder.add(PiGpioSerialProvider.newInstance(piGpio));
ctxBuilder.add(PiGpioI2CProvider.newInstance(piGpio));
ctxBuilder.add(PiGpioPwmProvider.newInstance(piGpio));
ctxBuilder.add(LinuxFsI2CProvider.newInstance());
ctxBuilder.add(GpioDDigitalInputProvider.newInstance());
ctxBuilder.add(GpioDDigitalOutputProvider.newInstance());
} else {
ctxBuilder.add(MockDigitalInputProvider.newInstance());
ctxBuilder.add(MockDigitalOutputProvider.newInstance());
Expand Down
13 changes: 12 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,21 @@

<properties>
<java.version>17</java.version>
<pi4j.version>2.4.0</pi4j.version>
<pi4j.version>2.5.0-SNAPSHOT</pi4j.version>
</properties>

<repositories>
<repository>
<id>oss-snapshots-repo</id>
<name>Sonatype OSS Maven Repository</name>
<url>https://oss.sonatype.org/content/groups/public</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>alex9849</id>
<url>https://nexus.liggesmeyer.net/repository/maven-releases/</url>
Expand Down

0 comments on commit 62b8ce8

Please sign in to comment.