frp-arduino-0.1.0.3: Arduino programming without the hassle of C.

Safe HaskellSafe-Inferred

Arduino.DSL

Contents

Synopsis

Core

type Action a = State DAGState aSource

data Stream a Source

data Output a Source

data LLI a Source

(=:) :: Output a -> Stream a -> Action ()Source

foo :: Output a -> (Stream b -> Stream a) -> Output bSource

Expressions

data Expression a Source

Instances

Bits

data Bit Source

Instances

Bytes

Words

Byte arrays

Tuples

pack6 :: (Expression a1, Expression a2, Expression a3, Expression a4, Expression a5, Expression a6) -> Expression (a1, a2, a3, a4, a5, a6)Source

unpack6 :: Expression (a1, a2, a3, a4, a5, a6) -> (Expression a1, Expression a2, Expression a3, Expression a4, Expression a5, Expression a6)Source

output2 :: Output a1 -> Output a2 -> Output (a1, a2)Source

output6 :: Output a1 -> Output a2 -> Output a3 -> Output a4 -> Output a5 -> Output a6 -> Output (a1, a2, a3, a4, a5, a6)Source

Conditionals

Streams

Mapping

mapS :: (Expression a -> Expression b) -> Stream a -> Stream bSource

Similar to map in Haskell. "S" is for stream.

mapSMany :: (Expression a -> [Expression b]) -> Stream a -> Stream bSource

Contrast with flattenS.

Filtering

Folding

foldpS :: (Expression a -> Expression b -> Expression b) -> Expression b -> Stream a -> Stream bSource

Similar to fold in Haskell. "S" is for stream.

Inspired by Elm's foldp.

Flattering

flattenS :: Stream [a] -> Stream aSource

Contrast with mapSMany.

Delaying

delay :: Stream (a, Word) -> Stream aSource

Needs a tuple created with pack2.

Syntactic sugar

(~>) :: Stream a -> (Stream a -> Stream b) -> Stream bSource

Low Level Instructions (LLI)

The glue between streams and harware.

createOutput :: String -> LLI () -> (LLI a -> LLI ()) -> Output aSource

setBit :: String -> String -> LLI a -> LLI aSource

writeBit :: String -> String -> LLI a -> LLI b -> LLI bSource