Copyright | (c) 2013 Tom Hawkins & Lee Pike |
---|---|
Safe Haskell | None |
Language | Haskell98 |
Common Atom functions
- data Timer
- timer :: Name -> Atom Timer
- startTimer :: Timer -> E Word64 -> Atom ()
- startTimerIf :: Timer -> E Bool -> E Word64 -> Atom ()
- timerDone :: Timer -> E Bool
- oneShotRise :: E Bool -> Atom (E Bool)
- oneShotFall :: E Bool -> Atom (E Bool)
- debounce :: Name -> E Word64 -> E Word64 -> Bool -> E Bool -> Atom (E Bool)
- lookupTable :: FloatingE a => [(E a, E a)] -> E a -> E a
- linear :: FloatingE a => (E a, E a) -> (E a, E a) -> E a -> E a
- hysteresis :: OrdE a => E a -> E a -> E a -> Atom (E Bool)
- data Channel a = Channel a (V Bool)
- channel :: a -> Atom (Channel a)
- writeChannel :: Channel a -> Atom ()
- readChannel :: Channel a -> Atom a
Timers
Starts a Timer. A timer can be restarted at any time.
:: Timer | Timer to start conditionally |
-> E Bool | Condition for starting the timer |
-> E Word64 | Number of ticks the timer shall run |
-> Atom () |
Conditionally start a Timer.
One Shots
Debouncing
:: Name | Name of the resulting atom |
-> E Word64 | On time in ticks |
-> E Word64 | Off time in ticks |
-> Bool | Initial value |
-> E Bool | The boolean to debounce |
-> Atom (E Bool) | Resulting debounced boolean |
Debounces a boolean given an on and off time (ticks) and an initial state.
Lookup Tables
1-D lookup table. x
values out of table range are clipped at end y
values. Input table must be monotonically increasing in x
.
:: FloatingE a | |
=> (E a, E a) | First point, (x1, y1) |
-> (E a, E a) | Second point, (x2, y2) |
-> E a | Input |
-> E a | Interpolated/extrapolated |
Linear extrapolation and interpolation on a line with 2 points.
The two x
points must be different to prevent a divide-by-zero.
Hysteresis
Channels
A channel is a uni-directional communication link that ensures one read for every write.
writeChannel :: Channel a -> Atom () Source