Repository navigation
Replies: 11 comments 46 replies
|
You are right, there is a bit of "split" between these two repositories, as one originates from the FHNW university based on the CrowPi, and the other one is the efforts done by @taartspi to provide example code for all types of devices... I love your idea, but I'm afraid this would require a lot of work and not sure if someone is available to pick this up. |
|
I like the spirit of your project, but I think it's too ambitious -- at least in the starting stages. So what I'd prefer to do is to set up a new pi4j subproject collecting hardware-specific "drivers" providing feature complete APIs for common hardware. Basically separating out the re-usable parts of existing example projects and making it easy to re-use them. From your project, this could be Adafruit5880.java, Adafruit3787.java etc. with external/high-level dependencies stripped. As we go, we'd ideally simplify the existing examples projects to use these drivers -- or contribute new examples there if we are adding drivers for new devices. This would be dropping the higher level "components" aspect of your project for now. Don't get me wrong -- I don't think it's not useful, but it's hard to provide good high level abstractions, in particular at an early stage with a limited set of examples. And I doubt the lack of high level abstractions is what's stopping beginners. I'd expect that typically, people come here looking for a way to hook up the hardware they have, and it won't be a big problem for them if the API of a particular device is very specific to the hardware -- as long as it's a reasonable Java API (opposed to sending bits through a pipe manually and figuring out after a day of debugging that the byte order is wrong). For us, this separation would provide a clear focus, avoiding getting lost in higher level design, which might be quite hard, given the variance in capabilities. @taartspi: Perhaps a better pilot might be a SCD41 driver (i2c indoor CO2, temperature & humidity), as it would provide something new rather than "just" cleanup -- including a blogging opportunity? |
|
I haven’t had time to work on Robo4J for quite some time, but I believe Miro is still contributing. Perhaps you could contribute to the hardware abstractions there?robo4j/robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi at master · Robo4J/robo4jgithub.comKind regards,Marcus - Excuse me if terse; sent from my phone.On 10 Aug 2025, at 16:14, Stefan Haustein ***@***.***> wrote:
(somehow replied top-level instead of here by accident ¯\_(ツ)_/¯ )
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
|
I'm liking the discussion on this topic, and i really do think we should define a project for such drivers. The example project is really good for that: examples on how to do communicate with a device using pi4j. But a driver project can help define something reusable which could have a clear API and then be imported as a library into one's own project, as opposed to copying the example code from and changing it to ones own liking. I am pretty sure that the target audience is different for two such repositories and thus might attract additional developers. The elephant in the room is the same as always: Who would be willing to write such drivers? Or rather who wants to start it and how? Additionally this would then need a proper release management, which i can take over as part of releasing pi4j. @stefanhaustein i am sure hoping that you would provide an implementation for your pixtend HW. Taking this with the new FFM changes, might give pi4j a little boost. I myself am waiting for FFM before i move my Strolch-PLC code to pi4j version 3, as i currently am still on 1.4. Never got around to upgrading and was always eyeing FFM... |
|
The example repo devices are each a module that can be pulled into an app but no consistent interface across io-types and the driver repo can solve that After its completion i can review how future device examples are implemented to allow use as an individual module and within the driver And i agree with Roberts point these repos serve different audiences |
|
Hi, I have developed a device library on top of PI4J that breaks down to I2C, SPI and 1-wire and then sensors, storage, displays etc. The point of the library is to auto detect I2C devices and then load them for use or use the sensor directly. It has a very simple rest api server that can be used to display or write to devices and read registers etc. It is used to integrate devices directly into our messaging server. its all open and you can take what you want or expand it. Each device has the hardware layer exposed by a corresponding API and then a controller layer that can be used to provide unified access to the device. https://github.com/Maps-Messaging/device_integration If interested let me know Matt |
|
I agree with a lot of the topics discussed here. Historically, drivers have been removed from the core-repo as they require specific tests and all the hardware to be able to do so. But as there is a lot of similar requests for a driver-library, we could indeed start it as a separate project. This would - in the end - eventually make these repos no longer needed (and could be archived) if we focus on the driver repo:
In my opinion, this could be the best approach to organize this:
Main bottleneck: who is "the lead" for this repo? Or will this organically grow? We have seen in the Pi4J core project that people come and go, but there are a few main contributors who can maintain the repository's stability. Should we assume the same will happen for the driver repo? Anyway, we can move this project forward quickly! I can prepare an empty Maven project and start the repository. Then it's up to you all in this discussion to contribute your implementations and find a common "best approach" to structuring the code. |
|
Hmm... for some weird reason i'm not getting github mails anymore, so missed that this discussion continued... If we don't want to push the example project to maven central, then it should be a separate repository, as this would otherwise complicate the maven repo imho. I very much like the document from @stefanhaustein and think this should govern the new driver's document. One addendum, which is probably clear to all participants: Should all go over PRs. I am quite happy on how this is going and new contributors are showing up and have a good feeling about this. I see that we have a lot of different devices and that many potential contributors have implemented the same device, so i am looking forward to a good discussion on having great quality drivers for these devices. About the releases: I'll do the same as i do for pi4j-core and a release is a short step and i can do it whenever necessary. Frank can/could do it too. In future we can discuss adding additional developers for release management. It should also always coincide with documentation on the pi4j website and social media notifications, so that we can ride this new wave of momentum. |
|
Dear Pi4J enthusiasts: do your magic! |
|
Should any tests be included in com.pi4j.drivers ? |
|
For each driver - should the repo also contain a datasheet ? |

Uh oh!
There was an error while loading. Please reload this page.
I feel like pi4j needs a new top level repository, pi4j-extensions. This repository would contain reusable device drivers and components. Basically promoting much of what is already written in pi4j-example-devices AND pi4j-example-components.
It would define interfaces like:
DualState ( on, off )
TriState ( on, off, held )
ColorDisplay
MonoDisplay
LinearPosition
Pixel
Components:
PixelColor used as input to set color of Pixel or Displays
SimpleButton implements TriState
SimpleSwitch implements DualState
ST7789 implements ColorDisplay
Adafruit5880 implements LinearPosition, TriState, Pixel
Both pi4j-example-devices AND pi4j-example-components would still exist. These projects now depend on pi4j-extensions. These projects would still define the logging framework, assets, launchers and executables.
All reactions