From 9d2f95bb58f856aaf9142426e90e5783c98af8f1 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Mon, 27 Jan 2025 14:51:28 +0000 Subject: Makes doc-comments cleaner/more elegant --- hsm-gpio/Hsm/GPIO.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'hsm-gpio/Hsm/GPIO.hs') 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 -- cgit v1.2.1