MyNixOS website logo
Description

I2C access for Haskell and Linux.

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.

Disclaimer

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.

Hardware

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.

Metadata

Version

0.1.3

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows