Safe Haskell | None |
---|---|
Language | Haskell98 |
Copilot.Arduino.Internals
Description
You should not need to import this module unless you're adding support for a new model of Arduino, or an Arduino library.
Synopsis
- newtype Sketch t = Sketch (Writer [(Spec, Framework)] t)
- data Framework = Framework {}
- type CFragment = String
- class ToFramework t where
- toFramework :: t -> Framework
- type Behavior t = Stream t -> Spec
- data Output t = Output {
- setupOutput :: [CFragment]
- outputCond :: Stream Bool
- outputBehavior :: Stream Bool -> Behavior t
- type Input t = Sketch (Stream t)
- data InputSource t = InputSource {
- defineVar :: [CFragment]
- setupInput :: [CFragment]
- readInput :: [CFragment]
- inputStream :: Stream t
- mkInput :: InputSource t -> Input t
- newtype GPIO = GPIO Int16
- type MicroSeconds = Int16
- sketchFramework :: Framework -> [String] -> [CFragment]
Documentation
An Arduino sketch, implemented using Copilot.
It's best to think of the Sketch
as a description of the state of the
Arduino at any point in time.
Under the hood, the Sketch
is run in a loop. On each iteration, it first
reads all inputs and then updates outputs as needed. While it is a monad,
a Sketch's outputs are not updated in any particular order, because
Copilot does not guarantee any order.
The framework of an Arduino sketch.
Constructors
Framework | |
class ToFramework t where Source #
Methods
toFramework :: t -> Framework Source #
Instances
ToFramework (InputSource t) Source # | |
Defined in Copilot.Arduino.Internals Methods toFramework :: InputSource t -> Framework Source # | |
ToFramework (Output t) Source # | |
Defined in Copilot.Arduino.Internals Methods toFramework :: Output t -> Framework Source # |
Somewhere that a Stream can be directed to, in order to control the Arduino.
Constructors
Output | |
Fields
|
Instances
ToFramework (Output t) Source # | |
Defined in Copilot.Arduino.Internals Methods toFramework :: Output t -> Framework Source # |
type Input t = Sketch (Stream t) Source #
A source of a Stream
of values input from the Arduino.
Runs in the Sketch
monad.
data InputSource t Source #
Constructors
InputSource | |
Fields
|
Instances
ToFramework (InputSource t) Source # | |
Defined in Copilot.Arduino.Internals Methods toFramework :: InputSource t -> Framework Source # |
mkInput :: InputSource t -> Input t Source #
A GPIO pin
For definitions of GPIO pins like pin12
,
load a module such as Copilot.Arduino.Uno, which provides the pins of a
particular board.
type MicroSeconds = Int16 Source #