[Haskell-beginners] GPIO/I2C/PWM and Haskell

Michael Jones mike at proclivis.com
Tue Jan 27 16:02:07 UTC 2015


Michal,

I am doing similar things (not arial) on a MinnowBoardMax. Did not want to deal with ARM and Haskell. But if you make that work, I think it would be worth publishing how you did it. I struggled to build a cross compiler for ARM and gave up.

As for MinnowBoardMax, I am running Ubuntu with a 3.18.1 kernel and a solid state drive. A little heavy on the weight when you consider the batteries required to run a 5W system.

I have libraries for I2C, UART, and GPIO, but not published.

Here is an example of how I deal with ALERTB

module SMBusAlert (
  alert
) where

import System.IO

alert :: IO Bool
alert = do
  	writeFile "/sys/class/gpio/export" "340"
	writeFile "/sys/class/gpio/gpio340/direction" "in"
	s <- readFile "/sys/class/gpio/gpio340/value"
	s `seq` writeFile "/sys/class/gpio/unexport" "340"
	if s!!0 == '0' then return True else return False


On Jan 27, 2015, at 7:45 AM, Michal Kawalec <michal at bazzle.me> wrote:

> Hey list,
> 
> I got myself a Beaglebone and will use it to stabilize and fly a drone
> with Haskell. The ghc support seems good enough (text doesn't compile,
> everything else does), but I have a question about inputs/outputs.
> 
> They are all set through sysfs, and I think a wrapper over it would be
> easiest and most straightforward to have. The operation of most pins
> goes along the lines of 'activate a pin -> do some stuff -> turn it
> off'. Is there some particular mechanism/library you would suggest me to
> look into to handle that? Any thoughts or own experience with doing
> similar things with Haskell?
> 
> 
> Any tips will be appreciated:)
> Michal
> 
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners




More information about the Beginners mailing list