diff options
author | Paul Oliver <contact@pauloliver.dev> | 2025-01-27 14:51:28 +0000 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2025-01-29 04:12:57 +0000 |
commit | 9d2f95bb58f856aaf9142426e90e5783c98af8f1 (patch) | |
tree | 9453d5cbed1ae2165e6c8f0824ded00d2372e7bd /hsm-gpio | |
parent | 9310ba7e17f97c4570dce33552b3605155ca5c0c (diff) |
Makes doc-comments cleaner/more elegant
Diffstat (limited to 'hsm-gpio')
-rw-r--r-- | hsm-gpio/Hsm/GPIO.hs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/hsm-gpio/Hsm/GPIO.hs b/hsm-gpio/Hsm/GPIO.hs index 5357167..3c5e8fc 100644 --- a/hsm-gpio/Hsm/GPIO.hs +++ b/hsm-gpio/Hsm/GPIO.hs @@ -24,7 +24,6 @@ import GHC.Generics (Generic) import Hsm.Core.Log (flushLogger) import System.Process (callCommand) --- Monofunctional GPIO pins data GPIO = GPIO5 | GPIO6 @@ -42,10 +41,11 @@ data GPIOEffect key a b type instance DispatchOf (GPIOEffect key) = Static E.WithSideEffects --- Effect state is a mapping function from type `key` to a `Set` of GPIO pins. --- This enables `key`s of any type to control many pins simultaneously. Using --- a function (instead of `Data.Map`) ensures all keys map to pins, given the --- provided function is total. +-- The static representation of this effect is a function that maps a `key` to +-- a `Set` of GPIO pins. This allows a single `key` of any type to control +-- multiple pins simultaneously. By using a function (instead of `Data.Map`), +-- we ensure that the mapping is total, meaning every `key` will map to a +-- corresponding set of pins. newtype instance E.StaticRep (GPIOEffect (key :: Type)) = GPIOEffect (key -> Set GPIO) @@ -56,9 +56,9 @@ stateStr :: IsString a => Bool -> a stateStr True = "on" stateStr False = "off" --- To control the pins, I use a subprocess call to `gpioset`. In the future --- I'd prefer wrapping `libgpiod` directly. It looks like no one has created a --- C wrapper yet, I might do it if I get bored. :) +-- Currently, pin control is done via a subprocess call to `gpioset`. In the +-- future, I'd prefer to wrap `libgpiod` directly. It seems no C wrapper +-- exists yet, but I might create one. gpioset :: Log :> es => Bool -> Set GPIO -> [Word] -> Eff es () gpioset state gpios periods = do localDomain domain $ logTrace_ $ "Calling command: " <> pack command |