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

Feature/gpiod #322

Merged
merged 58 commits into from
Feb 6, 2024
Merged

Feature/gpiod #322

merged 58 commits into from
Feb 6, 2024

Conversation

alex9849
Copy link
Member

@alex9849 alex9849 commented Feb 3, 2024

This pull requests enables Pi4j to take advantage of the GpioD library, that gets developed together with the linux kernel.

Contents:

  • Added GpioD JNI bridge
  • Added GpioD DigitalOutputProvider (Tested against a RaspberryPi 4 & 5)
  • Added GpioD DigitalInputProvider (Tested against a RaspberryPi 5)
    • Added debouncing

I'm not sure if this will immediately compile in your CI/CD pipeline. It might miss some dependencies that are needed to build the JNI library for gpiod. These are required packets: https://github.com/Pi4J/pi4j-v2/blob/501a50f1594a9bae2ea2cd794d6998db8d801faf/libraries/pi4j-library-gpiod/src/main/native/build-prerequisites.sh

Closes #321

@alex9849
Copy link
Member Author

alex9849 commented Feb 4, 2024

Here the PR for the builder: Pi4J/pi4j-docker#2

@alex9849 alex9849 marked this pull request as draft February 5, 2024 19:50
@alex9849 alex9849 marked this pull request as ready for review February 5, 2024 22:02
@alex9849 alex9849 requested a review from eitch February 6, 2024 08:56
@FDelporte FDelporte self-requested a review February 6, 2024 09:06
Copy link
Member

@FDelporte FDelporte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point, my brain only allows me to do a quick "esthetical" review. Only minor comments...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be easier to keep everything in one gitignore file at the root level of the project?

* @version $Id: $Id
*/
public class GpioChip implements Closeable {
private final long cPtr;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally prefer full variable names... Same remark also for other classes with the same variable.

@Override
protected void finalize() {
if(next == null) {
if(noCoseCurrent) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noCose or noClose?

@@ -52,5 +52,5 @@ chmod +x build.sh
# FOR ARMv6,ARMv7, ARMv8 32-BIT (ARMHF)
# FOR ARMv8 64-BIT (ARM64)
# -------------------------------------------------------------
docker pull pi4j/pi4j-builder-native:2.0
#docker pull pi4j/pi4j-builder-native:2.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to remove unused code instead of commenting it

@@ -55,5 +55,5 @@ chmod +x build.sh
# FOR ARMv6,ARMv7, ARMv8 32-BIT (ARMHF)
# FOR ARMv8 64-BIT (ARM64)
# -------------------------------------------------------------
docker pull pi4j/pi4j-builder-native:2.0
#docker pull pi4j/pi4j-builder-native:2.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

.initial(DigitalState.HIGH)
.build();
DigitalOutput pin = pi4j.create(config);
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

lastEvent.set(System.currentTimeMillis());
});
Thread.sleep(1000 * 60);
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@alex9849
Copy link
Member Author

alex9849 commented Feb 6, 2024

@FDelporte I applied the review comments.

@FDelporte FDelporte merged commit d28e1b5 into Pi4J:develop Feb 6, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New plugin to add support for the new Raspberry Pi 5
3 participants