hsI2C: I2C access for Haskell and Linux

[ bsd3, hardware, i2c, library ] [ Propose Tags ]

I2C access for Haskell and Linux

[Skip to Readme]
Versions 0.1.2, 0.1.3
Dependencies base (<4.11), bytestring, unix [details]
License BSD-3-Clause[multiple license files]
Copyright Marc Fontaine
Author Marc Fontaine
Maintainer Marc.Fontaine@gmx.de
Category Hardware, I2C
Source repo head: git clone git://github.com/MarcFontaine/hsI2C
Uploaded by MarcFontaine at Tue Oct 24 15:36:03 UTC 2017
Distributions NixOS:0.1.3
Downloads 384 total (9 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-10-24 [all 1 reports]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees

Readme for hsI2C-0.1.3

[back to package description]

I2C access for Haskell and Linux

I2C interface

This library provides a Haskell interface to I2C buses on Linux via /dev/i2c-[n]. It wraps the libi2c c-library, which is included as c-source, and works with every I2C interface that is supported by the Linux kernel.


PCs and laptops use internal I2C buses to control various hardware functions. Incorrect use of the I2C interface can cause irreversible damage to your PC or laptop. Use this library with an external I2C interface (e.g. USB dongle) and double-check, that the /dev/i2c-[n] file belongs to that external interface.


This library should work with every I2C interface that is supported by the Linux kernel. I test and use this library with an external I2C-Tiny-USB adapter. The I2C-Tiny-USB project consists of an AVR based hardware, an AVR firmware and a Linux kernel driver. The popular USBASP AVR programmers, that are available for ca $2, are compatible with I2C-Tiny-USB hardware. A firmware update is all that is needed to turn a USBASP AVR programmer into an I2C-Tiny-USB interface. (Note that the i2c_tiny_usb Linux kernel driver is broken in Linux 4.9 and Linux 4.11. But it works with this patch.

##Examples The library contains an example for reading barometer and compass data from an IMU (inertial measurement unit). Note that this example DOES NOT WORK unless you have the this specific IMU hardware device connected to your I2C bus.

Haddock documentation