{-# LANGUAGE RebindableSyntax #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Copilot.Zephyr (
zephyr,
Sketch,
Pin,
Zephyr,
Behavior,
TypedBehavior(..),
Event,
(@:),
Input,
input,
input',
pullup,
Output,
(=:),
delay,
MilliSeconds(..),
MicroSeconds(..),
IsDigitalIOPin,
IsAnalogInputPin,
IsPWMPin,
blinking,
firstIteration,
frequency,
sketchSpec,
liftB,
liftB2,
whenB,
scheduleB,
ifThenElse,
IfThenElse,
Stream,
module X,
) where
import Language.Copilot as X hiding (Stream, ifThenElse)
import Language.Copilot (Stream)
import Sketch.FRP.Copilot
import Copilot.Zephyr.Internals
import Copilot.Zephyr.Main
import Control.Monad.Writer
import qualified Data.Map as M
import qualified Data.Set as S
pullup :: IsDigitalIOPin t => Pin t -> Sketch ()
pullup :: forall (t :: [PinCapabilities]).
IsDigitalIOPin t =>
Pin t -> Sketch ()
pullup (Pin Zephyr
p) = [(TriggerLimit -> WriterT [SpecItem] Identity (),
TriggerLimit -> GenFramework Zephyr)]
-> Sketch ()
forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell [(\TriggerLimit
_ -> () -> WriterT [SpecItem] Identity ()
forall a. a -> WriterT [SpecItem] Identity a
forall (m :: * -> *) a. Monad m => a -> m a
return (), \TriggerLimit
_ -> GenFramework Zephyr
f)]
where
f :: GenFramework Zephyr
f = (forall ctx. Context ctx => GenFramework ctx
emptyFramework @Zephyr)
{ pinmodes = M.singleton p (S.singleton InputPullupMode)
}