[][src]Function mynewt::hw::hal::hal_i2c_master_write

pub unsafe extern "C" fn hal_i2c_master_write(
    i2c_num: u8,
    pdata: *mut hal_i2c_master_data,
    timeout: u32,
    last_op: u8
) -> c_int

Sends a start condition and writes bytes of data on the i2c bus. This API does NOT issue a stop condition unless last_op is set to 1. You must stop the bus after successful or unsuccessful write attempts. This API is blocking until an error or NaK occurs. Timeout is platform dependent.

  • i2c_num: The number of the I2C device being written to
  • pdata: The data to write to the I2C bus
  • timeout: How long to wait for transaction to complete in ticks
  • last_op: Master should send a STOP at the end to signify end of transaction.

Return: 0 on success, and non-zero error code on failure