Skip to main content

pamoja_i2c_script_write_read

Function pamoja_i2c_script_write_read 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_i2c_script_write_read( script: *mut PamojaI2cScript, address: u8, bytes: *const u8, len: usize, reply: *const u8, reply_len: usize, ) -> PamojaStatus
Expand description

Adds a step: the driver writes these bytes and then reads the reply in one transaction, the shape of a register read.

§Arguments

  • script - the script.
  • address - the 7-bit address of the part.
  • bytes - the bytes the driver must send first, usually a register address.
  • len - how many.
  • reply - the bytes the part answers with.
  • reply_len - how many.

§Returns

PamojaStatus::Ok, or PamojaStatus::InvalidArgument for a null argument.

§Safety

script must be a live handle or null, bytes must point to len readable bytes, and reply to reply_len.