packages feed

mellon-gpio (empty) → 0.7.0.1

raw patch · 7 files changed

+157/−0 lines, 7 filesdep +basedep +hlintdep +hpiosetup-changed

Dependencies added: base, hlint, hpio, mellon-core

Files

+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2016, Drew Hess++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Drew Hess nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,13 @@+# mellon-gpio++`mellon-gpio` adapts the `mellon-core` `Device` type to GPIO, for use+with a `mellon-core` controller.++To use it, simply connect a properly-designed physical access device+(e.g., an electric strike driven by a relay circuit such as the one+shown+[here](http://www.petervis.com/Raspberry_PI/Driving_Relays_with_CMOS_and_TTL_Outputs/Driving_Relays_with_CMOS_and_TTL_Outputs.html))+to an available GPIO pin on the host where the `mellon-core`+application will run.++[![Travis CI build status](https://travis-ci.org/dhess/mellon.svg?branch=v0.7.0)](https://travis-ci.org/dhess/mellon)
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ changelog.md view
@@ -0,0 +1,9 @@+## 0.7.0.1 (2016-06-13)++- Packaging fixes only.++## 0.7.0.0 (2016-06-02)++- Remove the `mellon-web` dependency.+- Port to new `mellon-core` package.+- Update for hpio-0.8.0.1.
+ mellon-gpio.cabal view
@@ -0,0 +1,58 @@+Name:                   mellon-gpio+Version:                0.7.0.1+Cabal-Version:          >= 1.10+Build-Type:             Simple+Author:                 Drew Hess <src@drewhess.com>+Maintainer:             Drew Hess <src@drewhess.com>+Homepage:               https://github.com/dhess/mellon/+Bug-Reports:            https://github.com/dhess/mellon/issues/+Stability:              experimental+License:                BSD3+License-File:           LICENSE+Copyright:              Copyright (c) 2016, Drew Hess+Tested-With:            GHC == 7.10.3, GHC == 8.0.1+Category:               System+Synopsis:               GPIO support for mellon+Description:+  @mellon-gpio@ provides a GPIO-driven @mellon-core@ @Device@.+  Currently, it provides support for Linux @sysfs@-based GPIO.+Extra-Doc-Files:        README.md+Extra-Source-Files:     changelog.md++-- Build hlint test+Flag test-hlint+  Default: True+  Manual: True++Library+  Default-Language:     Haskell2010+  HS-Source-Dirs:       src+  GHC-Options:          -Wall -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates+  If impl(ghc > 8)+    GHC-Options:        -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -fno-warn-redundant-constraints+  Exposed-Modules:      Mellon.Device.GPIO+  Build-Depends:        base        >= 4.8   && < 5+                      , hpio        >= 0.8   && < 1+                      , mellon-core == 0.7.*++Test-Suite hlint+  Type:                 exitcode-stdio-1.0+  Default-Language:     Haskell2010+  Hs-Source-Dirs:       test+  Ghc-Options:          -w -threaded -rtsopts -with-rtsopts=-N+  Main-Is:              hlint.hs+  If !flag(test-hlint)+    Buildable:          False+  Else+    Build-Depends:      base+                      , hlint == 1.9.*++Source-Repository head+  Type:                 git+  Location:             git://github.com/dhess/mellon.git++Source-Repository this+  Type:                 git+  Location:             git://github.com/dhess/mellon.git+  Branch:               v0.7.0+  Tag:                  v0.7.0.1a
+ src/Mellon/Device/GPIO.hs view
@@ -0,0 +1,33 @@+{-|+Module      : Mellon.Device.GPIO+Description : GPIO-driven @mellon-core@ devices+Copyright   : (c) 2016, Drew Hess+License     : BSD3+Maintainer  : Drew Hess <src@drewhess.com>+Stability   : experimental+Portability : non-portable++-}++module Mellon.Device.GPIO+         ( -- * Mellon GPIO device constructors+           sysfsGpioDevice+         ) where++import Mellon.Device (Device(..))+import System.GPIO.Monad (PinValue(..), OutputPin, writeOutputPin)+import System.GPIO.Linux.Sysfs (PinDescriptor, runSysfsGpioIO)++-- | Given an 'OutputPin' on a Linux @sysfs@-based GPIO system, create+-- a @mellon-core@ 'Device' such that, when the+-- 'Mellon.Controller.Controller' locks the device, it drives a 'High'+-- value on the pin, and when it unlocks the device, it drives a 'Low'+-- value.+--+-- Note that the value driven on the pin is its /logical value/. You+-- can invert the signal levels by configuring the active level of the+-- 'OutputPin'.+sysfsGpioDevice :: OutputPin PinDescriptor -> Device PinDescriptor+sysfsGpioDevice p =+  Device (runSysfsGpioIO $ writeOutputPin p Low)+         (runSysfsGpioIO $ writeOutputPin p High)
+ test/hlint.hs view
@@ -0,0 +1,12 @@+module Main where++import Control.Monad (unless)+import Language.Haskell.HLint+import System.Environment+import System.Exit++main :: IO ()+main =+  do args <- getArgs+     hints <- hlint $ ["src", "--cpp-define=HLINT", "--cpp-ansi"] ++ args+     unless (null hints) exitFailure