diff options
author | Paul Oliver <contact@pauloliver.dev> | 2025-02-26 18:07:58 -0800 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2025-03-06 21:11:49 +0000 |
commit | e586927bdeef9d1d59f464c0fed86977ec9fd6c4 (patch) | |
tree | 56b3fd8ce96e5cec85f92e58a8b683ffd6c55024 /hsm-bin/Test/Drive.hs | |
parent | c123795a0d9588f40f06dba918bb0130944302ec (diff) |
Adds drive service and test app
Diffstat (limited to 'hsm-bin/Test/Drive.hs')
-rw-r--r-- | hsm-bin/Test/Drive.hs | 22 |
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 |