atom-0.1.0: A DSL for embedded hard realtime applications.

Language.Atom.Common

Contents

Description

Common Atom functions.

Synopsis

Timers

data Timer Source

A Timer.

timer :: Name -> Atom TimerSource

Creates a new timer.

startTimer :: Timer -> E Word64 -> Atom ()Source

Starts a Timer. A Timer can be restarted at any time.

timerDone :: Timer -> E BoolSource

True when a timer has completed.

One Shots

oneShotRise :: E Bool -> Atom (E Bool)Source

One-shot on a rising transition.

oneShotFall :: E Bool -> Atom (E Bool)Source

One-shot on a falling transition.

Debouncing

debounce :: Name -> E Word64 -> E Word64 -> Bool -> E Bool -> Atom (E Bool)Source

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 aSource

1-D lookup table. X values out of table range are clipped at end Y values. Input table must be monotonically increasing in X.

Hysteresis

hysteresis :: OrdE a => E a -> E a -> E a -> Atom (E Bool)Source

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