NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: GPIO programs for Raspberry Pi in Python and C



Benny Siegert <bsiegert%gmail.com@localhost> writes:

> On Thu, Jan 14, 2021 at 3:19 PM Rocky Hotas <rockyhotas%firemail.cc@localhost> wrote:
>> As an alternative, are there some C libraries available for NetBSD, to
>> manage the GPIO pins?
>
> NetBSD uses the gpio(4) device to talk to the GPIO pins:
> http://man.netbsd.org/gpio.4
>
> So your program opens /dev/gpio and uses ioctl to do things. This
> should be relatively straightforward in C (or perhaps in Go).

It is really straightforward in C.  I wrote a program to watch a pin and
do things, and all the complexity was in writing rate limiting.

As for python, if there is a python library for gpio pins and it has
some semblance of portability, it should be  relatively easy to add
#ifdef NetBSD and do the read/write the NetBSD way.   If it's written as
if there is only one operating system in the world, it's probably a bit
harder.

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index