<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jan 27, 2015 at 5:02 PM, Michael Jones <span dir="ltr"><<a href="mailto:mike@proclivis.com" target="_blank">mike@proclivis.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Michal,<br>
<br>
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.<br>
<br>
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.<br>
<br>
I have libraries for I2C, UART, and GPIO, but not published.<br>
<br>
Here is an example of how I deal with ALERTB<br>
<br>
module SMBusAlert (<br>
  alert<br>
) where<br>
<br>
import System.IO<br>
<br>
alert :: IO Bool<br>
alert = do<br>
        writeFile "/sys/class/gpio/export" "340"<br>
        writeFile "/sys/class/gpio/gpio340/direction" "in"<br>
        s <- readFile "/sys/class/gpio/gpio340/value"<br>
        s `seq` writeFile "/sys/class/gpio/unexport" "340"<br>
        if s!!0 == '0' then return True else return False<br>
<div><div class="h5"><br></div></div></blockquote><div><br></div><div>While I do not understand much about what you're doing, I would suggest instead :<br><br></div><div><span style="font-family:monospace,monospace">alert :: IO Bool<br></span></div><div><span style="font-family:monospace,monospace">alert = do<br></span></div><div><span style="font-family:monospace,monospace">    writeGpio "export" "340"<br></span></div><div><span style="font-family:monospace,monospace">    writeGpio "gpio340/direction" "in"<br></span></div><div><span style="font-family:monospace,monospace">    c <- withFile "/sys/class/gpio/gpio340/value" ReadMode getChar<br></span></div><div><span style="font-family:monospace,monospace">    writeGpio "unexport" "340"<br></span></div><div><span style="font-family:monospace,monospace">    return (c == '0') <br></span></div><div><span style="font-family:monospace,monospace">  where<br></span></div><div><span style="font-family:monospace,monospace">    writeGpio p = writeFile ("/sys/class/gpio/" ++ p)</span><br><br></div><div>and maybe writeGpio (or a general gpio transformer) should be part of an utility library since those IO to related files/devices seems to form a large part of your code.<br></div><div>(Also the "if blabla then return True else return False" == "return blabla" is a common mistake)<br><br>-- <br></div><div>Jedaï<br></div></div></div></div>