h2c: Bindings to Linux I2C with support for repeated-start transactions.

[ library, mit, system ] [ Propose Tags ]

H2C is a high-level binding to the Linux I2C subsystem with support for repeated-start transactions, not just individual reads and writes.

[Skip to Readme]
Versions 1.0.0
Dependencies base (>=4.7 && <5), bytestring, mtl, resourcet [details]
License MIT
Copyright 2017 Edward Amsden
Author Edward Amsden
Maintainer edwardamsden@gmail.com
Category System
Home page https://bitbucket.org/fmapE/h2c
Bug tracker https://bitbucket.org/fmapE/h2c/issues
Source repo head: git clone https://bitbucket.org/fmapE/h2c.git
Uploaded by eamsden at Sat Jul 8 15:36:51 UTC 2017
Distributions LTSHaskell:1.0.0, NixOS:1.0.0, Stackage:1.0.0
Downloads 260 total (11 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2017-07-08 [all 3 reports]
Hackage Matrix CI


  • System
    • IO
      • System.IO.I2C


Maintainer's Corner

For package maintainers and hackage trustees

Readme for h2c-1.0.0

[back to package description]

h2c: Haskell bindings to Linux I2C API

H2C is a binding to the Linux i2c-tools/i2c-dev API. It uses the I2C_RDWR ioctl for repeated-start communications between master and slave.


  • You'll probably have to run as root. Getting regular users direct access to i2c busses on Linux is tricky.
  • The Linux i2c-stub driver that you might think would be useful for testing doesn't support the I2C_RDWR ioctl. This is why, if you try to use it, you'll get the "invalid argument" error.


$ stack haddock --open, find module System.IO.I2C

BE CAREFUL WITH I2C. It can be used to poke at things like your graphics card, fans, &c.

See my library bno055-haskell for examples of h2c in use.