stianeikeland / go-rpio

:electric_plug: Raspberry Pi GPIO library for go-lang
MIT License
2.16k stars 221 forks source link

Add conversion from physical PIN to BCM notation. #59

Open lexa opened 4 years ago

lexa commented 4 years ago

On Open() detect the board model and configure how physical PINs are mapped to GPIO pin numbers [1].

Model detection is based on content of /sys/firmware/devicetree/base/model [2] .

If you are running a weird or very old system which does not have the file, GetBoardPin() won't work.

[1] https://pinout.xyz/ [2] https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md