bus-pirate-0.6.2: Haskell interface to the Bus Pirate binary interface

Safe HaskellNone
LanguageHaskell2010

System.Hardware.BusPirate.I2C

Contents

Synopsis

Types

i2cMode :: I2cM a -> BusPirateM a Source

Enter I2C mode and run given action

Bus operations

startBit :: I2cM () Source

Send a start bit

stopBit :: I2cM () Source

Send a stop bit

readByte :: I2cM Word8 Source

Read a byte

ackBit :: I2cM () Source

Send an ACK

nackBit :: I2cM () Source

Send a NACK

bulkWrite :: ByteString -> I2cM () Source

Write some bytes

Configuration

setConfig :: PeripheralConfig -> I2cM () Source

Set Bus Pirate peripheral configuration bits

setSpeed :: I2cSpeed -> I2cM () Source

Set I2C bus speed

Device addresses

data I2CAddress Source

An I2C address (shifted 7-bit)

from7Bit :: Word8 -> I2CAddress Source

An I2C address from a unshifted 7-bit address

from8Bit :: Word8 -> I2CAddress Source

An I2C address from a shifted 8-bit address (masking out the read/write bit)

Register interface

writeReg :: I2CAddress -> Word8 -> Word8 -> I2cM () Source

Perform a write to the given register

readReg :: I2CAddress -> Word8 -> I2cM Word8 Source

Read the given register

readReg' :: I2CAddress -> Word8 -> Int -> I2cM ByteString Source

Perform a read of the given length starting at the given register