aboutsummaryrefslogtreecommitdiff
path: root/hsm-bin/Test/Drive.hs
diff options
context:
space:
mode:
Diffstat (limited to 'hsm-bin/Test/Drive.hs')
-rw-r--r--hsm-bin/Test/Drive.hs22
1 files changed, 22 insertions, 0 deletions
diff --git a/hsm-bin/Test/Drive.hs b/hsm-bin/Test/Drive.hs
new file mode 100644
index 0000000..7a58c11
--- /dev/null
+++ b/hsm-bin/Test/Drive.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+import Control.IO.Region (region)
+import Control.Monad.Loops (whileJust_)
+import Hsm.Drive (DriveEnv, drive, driveEnvDefault)
+import Hsm.GPIO (allocateGPIO)
+import Hsm.PWM (allocatePWM)
+import Hsm.Readline (allocateReadline, readline)
+
+newtype Env = Env
+ { driveEnv :: DriveEnv
+ }
+
+main :: IO ()
+main =
+ region $ \ioRegion -> do
+ lineRequest <- allocateGPIO ioRegion "test-status"
+ pwmHandle <- allocatePWM ioRegion $ const 0
+ handle <- allocateReadline ioRegion
+ whileJust_ (readline handle)
+ $ drive lineRequest pwmHandle
+ $ Env driveEnvDefault