Safe Haskell | None |
---|
- data I2cM a
- i2cMode :: I2cM a -> BusPirateM a
- startBit :: I2cM ()
- stopBit :: I2cM ()
- readByte :: I2cM Word8
- ackBit :: I2cM ()
- nackBit :: I2cM ()
- bulkWrite :: ByteString -> I2cM ()
- writeRead :: ByteString -> Int -> I2cM ByteString
- data I2cConfig = I2cConfig {
- i2cPower :: Bool
- i2cPullups :: Bool
- i2cAux :: Bool
- i2cChipSelect :: Bool
- setConfig :: I2cConfig -> I2cM ()
- data I2cSpeed
- = I2c_5kHz
- | I2c_50kHz
- | I2c_100kHz
- | I2c_400kHz
- setSpeed :: I2cSpeed -> I2cM ()
- data I2CAddress
- from7Bit :: Word8 -> I2CAddress
- from8Bit :: Word8 -> I2CAddress
- readAddr :: I2CAddress -> Word8
- writeAddr :: I2CAddress -> Word8
- writeReg :: I2CAddress -> Word8 -> Word8 -> I2cM ()
- readReg :: I2CAddress -> Word8 -> I2cM Word8
- readReg' :: I2CAddress -> Word8 -> Int -> I2cM ByteString
Bus operations
i2cMode :: I2cM a -> BusPirateM aSource
Enter I2C mode and run given action
bulkWrite :: ByteString -> I2cM ()Source
Write some bytes
writeRead :: ByteString -> Int -> I2cM ByteStringSource
Send Start bit, write some bytes, then read some bytes (ACKing each until the last), then send a stop bit
Configuration
I2cConfig | |
|
Device addresses
data I2CAddress Source
An I2C address (shifted 7-bit)
from7Bit :: Word8 -> I2CAddressSource
An I2C address from a unshifted 7-bit address
from8Bit :: Word8 -> I2CAddressSource
An I2C address from a shifted 8-bit address (masking out the read/write bit)
readAddr :: I2CAddress -> Word8Source
writeAddr :: I2CAddress -> Word8Source
Register interface
readReg' :: I2CAddress -> Word8 -> Int -> I2cM ByteStringSource
Perform a read of the given length starting at the given register