CPAN Day! Raspberry Pi wiringPi API wrapper released

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 and 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;

Thus far, my module has/can:

  • get Pi board revision
  • do conversions for the three pin numbering schemes (wiringPi, BCM and physical)
  • change pin modes and state
  • enable/disable internal pin pull-up/down resistors
  • utilize Pulse Width Modulation (PWM) on a per-pin basis
  • set/unset pin interrupts for EDGE_FALLING, EDGE_RISING and EDGE_BOTH events. These interrupts are run in separate C threads, and call back to a user defined Perl sub as the handler
  • initialize, manipulate and write data to external LCD screens (useful for sensor data, warnings etc)

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. For now, if you're interested, you can peruse an initial basic howto overview. Note that until v1.00 is released, things may not work as documented (and/or the documentation may be incorrect).

4 Comments

What is wiringPi? When do we use this API?


Hi Steve, WiringPi site seems to be down at present. Just a heads up.

Leave a comment

About Steve Bertrand

user-pic Just Another Perl Hacker