Code Monkey home page Code Monkey logo

Comments (3)

Gadgetoid avatar Gadgetoid commented on August 21, 2024

It was a tested first pass and then I asked for the pin labels to be changed 😭

Then I decided that using labels was a bad idea…

“GPIO_” labels were physical IIRC (god only knows why) so if you look up the small numbers on https://pinout.xyz/ and translate them to the “GPIO” numbers it should get you the right pins.

You can also use “pinctrl” (Pi’s weird only-we-can-bypass-gpiod utility) to check the state of pins and set their value. Buttons usually connect a pin to ground so assuming GPIO29 is really GPIO5 “pinctrl 5 ip dh” (I’m doing this by memory from my phone so bear with me) should set that pin up to work with a button. Then run “pinctrl” to dunk the button state, run it again with the button held, tada!

Nuclear option would also be to claim all the pins and just loop through them in Python 🤣

IIRC gpioinfo has a “consumer” column, but I’m not totally sure the I2C and SPI drivers on Pi play nice and actually show up there. Regardless, trying to claim a used pin will usually result in a nice cryptic exception.

We have so many libraries that I did a first pass at Inky, it was all great (afaict!) and moved on to the next thing and the next and as I moved around the great circle of agony I found and reported issues. Changed my mind. Found better ways. And so on- all of that learning needs to be applied here.

Switching to libgpiod erased a great deal of my working knowledge about how to deal with GPIO, so I’m reset back ten years distant and doing a lot of on the fly learning.

Genuinely appreciate any effort you put into tackling this and any problems you find or suggestions you might have. It’s not fun tackling all this in isolation without someone to check I’m not meandering off into some bonkers over complicated distraction.

from inky.

ttreker avatar ttreker commented on August 21, 2024

I am on Chicago time (what zone are you?) I have had some sleepless nights so this time is not a normal time for me to be replying. I just saw your reply above.

Thanks for this info! This looks very helpful! It gives me a lot with which to run.

It sounds like you've have done an amazing job. I scrolled through the Pimoroni repositories! There are a lot of them!

A little background:
I got involved in this helping a friend put together a custom device based on the GitHub repo tvldz/storybook for his grandchild. I have only been working on it for about a week. (Everything has worked pretty well so far on the display side. Given what you have gone through it seems pretty impressive! The Pi with your display has run well.) The upshot is that I got the Pi 5 to help my friend through this project (the Pi 5 was a gift from him for helping him out). So I haven't delved into the Pi until just this last week and when the project is done I am not anticipating continuing with any serious Pi projects (although you never know).

However, I am a low-level guy having started my software career in the 80's in embedded systems where I wrote a lot of embedded assembly and C. (I left professional embedded systems behind in the early 90s.) I am also very comfortable with Linux. I looked into writing a kernel module for the BeagleBone Black about 8 or 9 years ago but that project fizzled out. So kernel experience is not in-depth by any stretch. I know how cryptic and complex kernel-based systems are so I have no doubt about the magnitude of the gpiod battle you have undertaken. Your idea of sorting out the gpiod complexities in abstracted libraries is a good one.

I mention all this to give some context of the degree of help you can expect. I am going to aim to sort out the buttons issue and in the process educate myself on the current state of GPIO development on the Pi 5 on Bookworm under Python (I hate not having a reasonable understanding of how things work). I don't like hacking things together so I'll do my best to come up with a clean, thoughtful buttons framework with perhaps supporting device tree overlays as an approach.

So I think I might be able to contribute a little something here.

Just don't count on me necessarily going far beyond that :)

from inky.

ttreker avatar ttreker commented on August 21, 2024

I got the buttons.py sample code working. Thanks for your help on that. I am going to fork inky and do a pull request with the fixed version (Rasberry Pi 5 anyways.) I augmented your comments a bit to clear things up a bit regarding the pins and gpios.

from inky.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.