diff options
author | Paul Oliver <contact@pauloliver.dev> | 2025-09-07 19:23:37 +0000 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2025-09-07 19:49:03 +0000 |
commit | 89aab732dc3d484b99c0761728285bca6f6b1ba0 (patch) | |
tree | e2b4ca6656758dc9f398b9b1de2e6d92670b77df /hsm-pwm/Hsm | |
parent | ef0713cbd90d6b84da7ea67e6dfc1fe5ab5bff86 (diff) |
Diffstat (limited to 'hsm-pwm/Hsm')
-rw-r--r-- | hsm-pwm/Hsm/PWM.hs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/hsm-pwm/Hsm/PWM.hs b/hsm-pwm/Hsm/PWM.hs index 2fd5955..bc31fbc 100644 --- a/hsm-pwm/Hsm/PWM.hs +++ b/hsm-pwm/Hsm/PWM.hs @@ -12,20 +12,21 @@ -- - SysFS Reference: https://forums.raspberrypi.com/viewtopic.php?t=359251 -- - UDEV Setup: https://forums.raspberrypi.com/viewtopic.php?t=316514 module Hsm.PWM - ( PWMChannel(..) + ( PWMChannel (..) , PWM , setCycleDuration , runPWM - ) where + ) +where import Control.Concurrent (threadDelay) import Control.Monad (forM_) import Control.Monad.Loops (untilM_) -import Effectful (Dispatch(Static), DispatchOf, Eff, IOE, (:>), liftIO) -import Effectful.Dispatch.Static (SideEffects(WithSideEffects), StaticRep, evalStaticRep, unsafeEff_) +import Effectful (Dispatch (Static), DispatchOf, Eff, IOE, liftIO, (:>)) +import Effectful.Dispatch.Static (SideEffects (WithSideEffects), StaticRep, evalStaticRep, unsafeEff_) import Effectful.Exception (bracket_) import Hsm.Core.Serial (makeSerial) -import Hsm.Log (Log, Severity(Info, Trace), logMsg) +import Hsm.Log (Log, Severity (Info, Trace), logMsg) import System.FilePath ((</>)) import System.Posix.Files (fileAccess) @@ -35,8 +36,8 @@ data PWM (a :: * -> *) (b :: *) type instance DispatchOf PWM = Static WithSideEffects -newtype instance StaticRep PWM = - PWM () +newtype instance StaticRep PWM + = PWM () chipPath :: FilePath chipPath = "/sys/class/pwm/pwmchip0" |