fivdi / onoff

GPIO access and interrupt detection with Node.js
MIT License
1.24k stars 120 forks source link

RPI 5 gpio numbers #199

Open livep2000 opened 3 months ago

livep2000 commented 3 months ago

Recently I burned out my rpi4, just at the moment my highly complicated radio transceiver reached some point of functionality. Ordered a pi5, to discover its not working. After reading and reading this issues tracker give the fairly simple solution.

Just add 571 to the gpio pin number. Proposing something like this to make it fully compatible:

let file = fs.readFileSync("/proc/cpuinfo", "utf8");
let arr = file.split(/\r?\n/);
arr.forEach((line, idx)=> {
    if(line.includes("Pi 5")){
        console.log(line);
        gpio += 571;
        }
});

Imre

SamDecrock commented 1 month ago

I don't think it's Pi5 related but rather the version of Raspbian. On Bullseye it works, on Bookworm it's broken.

nwpray commented 2 weeks ago

I opened a PR to lookup the base address and add that automatically to the address you pass https://github.com/fivdi/onoff/pull/204