Safe Haskell | None |
---|---|
Language | Haskell98 |
Copilot.Arduino.Library.Serial.Device
Description
This module be used to create a new module targeting a specific serial device. See CoPilot.Arduino.Library.Serial and CoPilot.Arduino.Library.Serial.XBee for examples.
Synopsis
- data Base
- class FormatableType t f where
- class ShowableType t where
- data FormatOutput = FormatOutput {
- formatArg :: Maybe Arg
- formatCType :: Maybe String
- formatCLine :: SerialDeviceName -> String -> CLine
- newtype Baud = Baud Int
- newtype SerialDeviceName = SerialDeviceName String
- baudD :: SerialDeviceName -> Int -> Sketch ()
- deviceD :: (IsDigitalIOPin rx, IsDigitalIOPin tx) => SerialDeviceName -> Pin rx -> Pin tx -> Baud -> Sketch ()
- outputD :: SerialDeviceName -> Stream Bool -> [FormatOutput] -> Sketch ()
- char :: Char -> FormatOutput
- str :: String -> FormatOutput
- show :: forall t. (ShowableType t, Typed t) => Stream t -> FormatOutput
- byte :: Stream Int8 -> FormatOutput
- showFormatted :: forall t f. (ShowableType t, Typed t, FormatableType t f) => Stream t -> f -> FormatOutput
- inputD :: SerialDeviceName -> Input Int8
- input'D :: SerialDeviceName -> [Int8] -> Input Int8
- noInput :: Int8
- type family IsDigitalIOPin t where ...
Documentation
class FormatableType t f where Source #
class ShowableType t where Source #
Instances
data FormatOutput Source #
Constructors
FormatOutput | |
Fields
|
deviceD :: (IsDigitalIOPin rx, IsDigitalIOPin tx) => SerialDeviceName -> Pin rx -> Pin tx -> Baud -> Sketch () Source #
Arguments
:: SerialDeviceName | |
-> Stream Bool | This Stream controls when output is sent to the serial port. |
-> [FormatOutput] | |
-> Sketch () |
char :: Char -> FormatOutput Source #
Use this to output a Char
str :: String -> FormatOutput Source #
Use this to output a String
show :: forall t. (ShowableType t, Typed t) => Stream t -> FormatOutput Source #
Use this to show the current value of a Stream.
Numbers will be formatted in decimal. Bool is displayed as 0 and 1.
showFormatted :: forall t f. (ShowableType t, Typed t, FormatableType t f) => Stream t -> f -> FormatOutput Source #
Show the current value of a Stream with control over the formatting.
When used with a Float, provide the number of decimal places to show.
Serial.showFormatted (constant (1.234 :: Float)) 2 -- "1.23"
When used with any Integral type, provide the Base
to display it in
Serial.showFormatted (constant (78 :: Int8)) Serial.HEX -- "4E"
input'D :: SerialDeviceName -> [Int8] -> Input Int8 Source #
The list is used to simulate serial input when interpreting the program.
type family IsDigitalIOPin t where ... Source #
Equations
IsDigitalIOPin t = True ~ If (HasPinCapability DigitalIO t) True (TypeError (Text "This Pin does not support digital IO")) |