atom-1.0.7: A DSL for embedded hard realtime applications.ContentsIndex
Language.Atom.Common
Contents
Timers
One Shots
Debouncing
Lookup Tables
Hysteresis
Description
Common Atom functions.
Synopsis
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)
Timers
data Timer
A Timer.
timer :: Name -> Atom Timer
Creates a new timer.
startTimer :: Timer -> E Word64 -> Atom ()
Starts a Timer. A timer can be restarted at any time.
startTimerIf :: Timer -> E Bool -> E Word64 -> Atom ()
Conditionally start a Timer.
timerDone :: Timer -> E Bool
True when a timer has completed.
One Shots
oneShotRise :: E Bool -> Atom (E Bool)
One-shot on a rising transition.
oneShotFall :: E Bool -> Atom (E Bool)
One-shot on a falling transition.
Debouncing
debounce :: Name -> E Word64 -> E Word64 -> Bool -> E Bool -> Atom (E Bool)
Debounces a boolean given an on and off time (ticks) and an initial state.
Lookup Tables
lookupTable :: FloatingE a => [(E a, E a)] -> E a -> E a
1-D lookup table. X values out of table range are clipped at end Y values. Input table must be monotonically increasing in X.
linear :: FloatingE a => (E a, E a) -> (E a, E a) -> E a -> E a
Linear extrapolation and interpolation on a line with 2 points. The two x points must be different to prevent a divide-by-zero.
Hysteresis
hysteresis :: OrdE a => E a -> E a -> E a -> Atom (E Bool)

Hysteresis returns True when the input exceeds max and False when the input is less than min. The state is held when the input is between min and max.

 hysteresis name min max input
Produced by Haddock version 2.7.2