[Haskell-cafe] [ANN] wiringPi-1.0

Patrick Pelletier code at funwithsoftware.org
Tue Jan 24 03:03:07 UTC 2017


https://hackage.haskell.org/package/wiringPi-1.0
https://github.com/ppelleti/hs-wiringPi

I released wiringPi-0.1.0.0 less than two weeks ago, but already I have 
a new major version, with a breaking change.

wiringPi-0.1.0.0 kept close to the C wiringPi library, which required 
calling a setup function.  There were four different setup functions, 
and the choice of setup function determined the pin numbering scheme, 
which would affect all subsequent functions which used pin numbers.

This sort of far-reaching global state felt very un-Haskell-like, and 
antithetical to modularity.  So, in wiringPi-1.0, the setup function is 
called automatically the first time a wiringPi function is used.  The 
wiringPi binding always configures the underlying C library to use the 
"Broadcom GPIO" pin numbering scheme.  However, the Pin type now has 
three different constructors, to allow a pin to use any of the three 
pin-numbering schemes.  These pin numbers are automatically converted to 
the "Broadcom GPIO" scheme internally. So now you can use any pin 
numbering scheme on a case-by-case basis, without having to make a 
global choice.

About wiringPi:

This is a Haskell binding to the wiringPi library, which allows you to 
interface with the GPIO pins on the Raspberry Pi.  Unlike some other 
solutions for using the Raspberry Pi's GPIO pins, wiringPi provides 
access to more advanced features, such as enabling the internal pull-up 
or pull-down resistors.

--Patrick



More information about the Haskell-Cafe mailing list