blink1-0.4: Control library for blink(1) LED from ThingM

Safe HaskellNone
LanguageHaskell98

System.Hardware.Blink1

Description

To use any of these functions, you first must open a blink(1) device (providing the Blink interface). Currently System.Hardware.Blink1.Linux and System.Hardware.Blink1.USB are provided.

The functions ending with 2 provide functionality available on the blink(1) mk2, so are only likely to work if getVersion returns ('2',_)

Synopsis

Documentation

data RGB a Source

Constructors

RGB 

Fields

red :: !a
 
green :: !a
 
blue :: !a
 

Instances

Functor RGB 
Read RGB8 
Show RGB8

uses #RRGGBB format

Applicative RGB 
Num a => Num (RGB a) 
(Num a, Ord a, Bounded a) => Monoid (RGB a)

like Sum but clips overflowing values at maxBound

newtype Delay Source

time is measured in centiseconds

Constructors

Delay 

data PatternStep Source

positions are counted 0-11 on mk1, 0-31 on mk2

data LED Source

LEDs are 1-based (0 means "all")

closeBlink1 :: Blink1 b => b -> IO () Source

getColor2 :: Blink1 b => b -> LED -> IO RGB8 Source

query the current color.

setColor :: Blink1 b => b -> RGB8 -> IO () Source

set the given color now

setColor2 :: Blink1 b => b -> Maybe LED -> RGB8 -> IO () Source

Although documented, this does not appear to work correctly.

fadeToColor :: Blink1 b => b -> Delay -> RGB8 -> IO () Source

fadeToColor2 :: Blink1 b => b -> Maybe LED -> Delay -> RGB8 -> IO () Source

setServerDown :: Blink1 b => b -> Bool -> Delay -> IO () Source

enable/disable serverdown mode with the given timeout

setServerDown2 :: Blink1 b => b -> Bool -> Delay -> Bool -> (PatternStep, PatternStep) -> IO () Source

enable/disable serverdown mode with the given timeout, optionally staying on afterwards, over the given pattern range

playPattern :: Blink1 b => b -> Maybe PatternStep -> IO () Source

stop or start playing the sequence at the given position

playPattern2 :: Blink1 b => b -> (PatternStep, PatternStep) -> Word8 -> IO () Source

loop the sequence over a range some number of times.

getPlaying2 :: Blink1 b => b -> IO (Maybe (PatternStep, PatternStep, Word8, Word8)) Source

query the current play state.

setPattern :: Blink1 b => b -> PatternStep -> Delay -> RGB8 -> IO () Source

set the sequence pattern for the given position

savePatterns2 :: Blink1 b => b -> IO () Source

getSerialNum :: Blink1 b => b -> IO Word32 Source

This is only supported on mk1 devices.

setSerialNum :: Blink1 b => b -> Word32 -> IO () Source

This is only supported on mk1 devices.