diff options
| author | Paul Oliver <contact@pauloliver.dev> | 2025-12-17 02:26:07 +0000 |
|---|---|---|
| committer | Paul Oliver <contact@pauloliver.dev> | 2025-12-20 23:35:27 +0000 |
| commit | 7d7fa4816a1744d860c74a45003eda6cd71ec42a (patch) | |
| tree | 45142351d64b68985c0394bf16c8ea8ba29ef979 /hsm-ina226/Test | |
| parent | 459d2c5630e1296807bbf23fd4360fb4d4f5bbe7 (diff) | |
Diffstat (limited to 'hsm-ina226/Test')
| -rw-r--r-- | hsm-ina226/Test/INA226.hs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/hsm-ina226/Test/INA226.hs b/hsm-ina226/Test/INA226.hs new file mode 100644 index 0000000..71f8f45 --- /dev/null +++ b/hsm-ina226/Test/INA226.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE TemplateHaskell #-} + +import Control.Concurrent (threadDelay) +import Control.Monad (forever) +import Data.Function ((&)) +import Effectful (liftIO, runEff) +import Hsm.Core.App (bootstrapApp) +import Hsm.I2C (runI2C) +import Hsm.INA226 (readINA226State, runINA226) +import Hsm.Log (Severity (Info), logMsg, runLogsOpt) +import Hsm.Log.Options (makeLoggerOptionParser) +-- Import full module for cleaner `-ddump-splices` output +-- Avoids package/module qualifiers in generated code +import Options.Applicative + +type Logs = '["i2c", "ina226"] + +$(makeLoggerOptionParser @Logs "Options" "parser" 'Info) + +main :: IO () +main = + bootstrapApp parser "Launch INA226 Monitoring Test Application" $ \opts -> + forever (liftIO (threadDelay 1000000) >> readINA226State >>= logMsg @"ina226" Info . show) + & runINA226 + & runI2C + & runLogsOpt @Options @Logs opts + & runEff |
