fivdi / onoff

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

RPI 5 gpio numbers #199

Open livep2000 opened 7 months ago

livep2000 commented 7 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 6 months 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 5 months 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