Git Product home page Git Product logo

hpi's Introduction

HPi

Library to access the GPIO pins on a Raspberry Pi from Haskell. Works with all Raspberry Pi versions up to and including v4.

===

HPi is a small library to access the GPIO pins on a Raspberry Pi from Haskell. It also includes some functions to use the I2C, SPI, and PWM functionality of the Raspberry Pi, see the haddock documentation for details. It is constructed as a FFI wrapper around the bcm2835 library, which is written in C. Because this library accesses the GPIO pins directly via a memory map, it should be faster than libraries which access the GPIO pins via the /sys/class/gpio interface.

===

In order to compile programs including this library, you will need to have the bcm2835 library installed. It can be found at http://airspayce.com/mikem/bcm2835/index.html. When performing the cabal install for HPi you may need to pass the --extra-lib-dirs and --extra-include-dirs flags if you have installed bcm2835 at a non-standard path. This library has been tested to work with bcm2835 version 1.63. Note that you cannot access the memory map without root privileges, programs should be run with sudo.

===

Questions, bug reports and feature requests are more than welcome!

hpi's People

Contributors

alt-romes avatar dmcclean avatar marckleinebudde avatar wjwh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hpi's Issues

Typeclass for monads that support I2C (and SPI) communication

Would you support splitting out into a separate package:

class MonadI2C m where
  writeI2C :: Address -> ByteString -> m ()
  readI2C :: Address -> Int -> m ByteString
  writeReadI2C :: Address -> ByteString -> Int -> m ByteString

(Or possibly similar types that provide a bit more feedback in the case of errors?)

If that package existed (I can write it up and put it on hackage) and this package provided an instance of it for raspberry pi, then device drivers for I2C slaves could be written without taking a direct dependency on the HPi package but could still be used with it.

(There could be another similar monad for SPI communications.)

Rpi 4

Hi! Is this library compatible with rpi 4?

Consider using looser version constraints for bytestring to allow newer GHC versions to compile this package

In the current version 0.7.0 of this package the dependency to bytestring is constrained to be lower than version 11 (bytestring < 0.11). I want to ask if there is a reason for this. This constraint prevents modern versions of GHC compiling this package. In my project where is use HPi, I created a fork of HPi with the following constraint: bytestring >= 0.9 && < 0.13. This works perfectly for me and I wonder whether it makes sense to change the constraint in the official package as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.