http://qs1969.pair.com?node_id=1169852

I was going to hold off on announcing my new WiringPi::API distribution until my larger project that depends on it is done, but since it's CPAN day, well...

The module wraps the majority of documented and undocumented functions in wiringPi.

wiringPi is a set of C libraries that allow you to muck with a Raspberry Pi, it's GPIO pins, drive LCDs and many other things.

You can import the C functions directly keeping their original names as is:

use WiringPi::API qw(:wiringPi);
...import the renamed Perl functions:
use WiringPi::API qw(:perl);
...or use the module in the normal OO way:
use WiringPi::API; my $wpi = WiringPi::API->new;

Here's but a few of the features:

My larger project, RPi::WiringPi, which is currently in feature-freeze to give me time to finish unit tests and documentation, will take that much further, and make it much easier to do things. It should hit v1.00 (stable) within the next week. At that time, I'll make another announcement... I do have an initial basic howto written so far that covers some of the basics. Note that this distribution may not be stable until v1.00 is released.

This was also posted here.

Replies are listed 'Best First'.
Re: Raspberry Pi wiringPi API wrapper released
by jmlynesjr (Deacon) on Aug 19, 2016 at 02:25 UTC

    stevieb

    Nice work! Do you have any plans to implement any byte-wide I/O functions.

    James

    There's never enough time to do it right, but always enough time to do it over...

      I do, but I'm working on getting the upper layers to work correctly. First, interrupts are failing miserably which I'll try to sort out today. Second, PWM mode doesn't work in non-root user mode, so I am going to implement software PWM for that run mode (with a user warning). Lastly, I need to rewrite the state mechanisms and cleanup routines, as I don't like when a crash happens that pins stay in an inconsistent state.

      Once all those are done, I'll add more features. I've also got a couple of other XS modules that are specific to sensors (DHT11 hygrometer for example) that I need to brush up a little.

      My goal was to get it far enough to be able to create my indoor grow operations environment control centre (which I've pretty well done), but then I thought I'd take it the whole way so that Perl has an easy-to-use implementation of wiringPi that goes beyond just the core library itself (management of components/pins, safe cleanup etc).

      fwiw, the most recent code is here. DHT11 code is RPi::DHT11::EnvControl.

        stevieb

        Thanks for the update. I look forward to following your progress. For speed reasons, in the chipKIT world bytewise operations are used to interface to TFT color displays.

        James

        There's never enough time to do it right, but always enough time to do it over...

Re: Raspberry Pi wiringPi API wrapper released
by marinersk (Priest) on Sep 28, 2016 at 04:03 UTC

    Nice work. I look forward to stealing your code.

      Cheers, marinersk... have a look at RPi::WiringPi. It's another distribution I wrote that uses the API code, but it's more user-friendly (imho) than using the API directly.