diff options
author | Paul Oliver <contact@pauloliver.dev> | 2025-02-07 17:10:05 +0000 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2025-02-24 20:00:47 +0000 |
commit | c123795a0d9588f40f06dba918bb0130944302ec (patch) | |
tree | 61161cddf1ed08fcb18724bf2a642cfafe94c5a2 /hsm-bin |
Initial
Diffstat (limited to 'hsm-bin')
-rw-r--r-- | hsm-bin/Test/Status.hs | 18 | ||||
-rw-r--r-- | hsm-bin/hsm-bin.cabal | 26 |
2 files changed, 44 insertions, 0 deletions
diff --git a/hsm-bin/Test/Status.hs b/hsm-bin/Test/Status.hs new file mode 100644 index 0000000..62ba4fa --- /dev/null +++ b/hsm-bin/Test/Status.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE OverloadedStrings #-} + +import Control.IO.Region (region) +import Control.Monad.Loops (whileJust_) +import Hsm.GPIO (allocateGPIO) +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" + handle <- allocateReadline ioRegion + whileJust_ (readline handle) $ status lineRequest $ Env statusEnvDefault diff --git a/hsm-bin/hsm-bin.cabal b/hsm-bin/hsm-bin.cabal new file mode 100644 index 0000000..0dc0a81 --- /dev/null +++ b/hsm-bin/hsm-bin.cabal @@ -0,0 +1,26 @@ +cabal-version: 3.4 +author: Paul Oliver +build-type: Simple +maintainer: contact@pauloliver.dev +name: hsm-bin +version: 0.1.0.0 + +common test-executable + build-depends: + , base + , hsm-gpio + , hsm-readline + , io-region + , monad-loops + + ghc-options: -Wall -Wunused-packages + + if !arch(x86_64) + ghc-options: -optl=-mno-fix-cortex-a53-835769 + + default-language: GHC2021 + +executable test-status + import: test-executable + build-depends: hsm-status + main-is: Test/Status.hs |