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



Thanks to all for your very useful hints and suggestions.

On gen 14 12:12, Greg Troxel wrote:
> 
> Benny Siegert <bsiegert%gmail.com@localhost> writes:
> 
> > NetBSD uses the gpio(4) device to talk to the GPIO pins:
> > http://man.netbsd.org/gpio.4
> >
> 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.

I never used ioctl(2) and maybe it's not immediate to integrate it with
gpio(4). If you have some piece of code performing even a trivial
operation like turning ON a pin, and you are OK with sharing it, it
would be welcome.

> 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.

The library esists, but I have no clues about its portability. However,
there's also a LUA interface for GPIO pins, shown in gpio(3lua) (which
basically uses ioctl(2) and gpio(4)).

C is not a limitation for me, if Python is not available ATM.

Rocky


Home | Main Index | Thread Index | Old Index