Skip to content

Latest commit

 

History

History
39 lines (23 loc) · 844 Bytes

Notes on I2C driver.md

File metadata and controls

39 lines (23 loc) · 844 Bytes

important definitions:

@ Write a set of bytes then read a set of bytes using the repeated start option

  port I2cWriteRead(

 addr: U32 @< I2C slave device address
 @ Buffer to write data to the i2c device
 ref writeBuffer: Fw.Buffer 
 
 @< Buffer to read back data from the i2c device, must set size     when passing in read buffer
 ref readBuffer: Fw.Buffer 

) -> Drv.I2cStatus

enum I2cStatus {

    I2C_OK = 0 @< Transaction okay

    I2C_ADDRESS_ERR = 1 @< I2C address invalid

    I2C_WRITE_ERR = 2 @< I2C write failed

    I2C_READ_ERR = 3 @< I2C read failed

    I2C_OPEN_ERR = 4 @< I2C driver failed to open device

    I2C_OTHER_ERR = 5 @< Other errors that don't fit

}
port I2c(

addr: U32 @< I2C slave device address

ref serBuffer: Fw.Buffer @< Buffer with data to read/write to/from

) -> Drv.I2cStatus