diff options
author | Paul Oliver <contact@pauloliver.dev> | 2025-02-07 17:10:05 +0000 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2025-02-18 20:35:35 +0000 |
commit | ab4591cb0e074ce98c24645cdb80cb5012aed566 (patch) | |
tree | 98451fa7e042e49ea83f265866754f3f6a3b406f /hsm-bin/Test/Status.hs |
Diffstat (limited to 'hsm-bin/Test/Status.hs')
-rw-r--r-- | hsm-bin/Test/Status.hs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/hsm-bin/Test/Status.hs b/hsm-bin/Test/Status.hs new file mode 100644 index 0000000..bc05eca --- /dev/null +++ b/hsm-bin/Test/Status.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE OverloadedStrings #-} + +import Control.IO.Region (region) +import Control.Monad.Loops (whileJust_) +import Hsm.GPIO (allocateGPIO) +import Hsm.PWM qualified as P +import Hsm.Readline (allocateReadline, readline) +import Hsm.Status (StatusEnv, status, statusEnvDefault) + +newtype Env = Env + { statusEnv :: StatusEnv + } + +main :: IO () +main = + region $ \ioRegion -> do + lineRequest <- allocateGPIO ioRegion "test-status" + pwmHandle <- P.allocatePWM ioRegion + handle <- allocateReadline ioRegion + whileJust_ (readline handle) + $ status lineRequest pwmHandle + $ Env statusEnvDefault |