Skip to main content

pamoja_i2c_bus_open

Function pamoja_i2c_bus_open 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_i2c_bus_open( path: *const c_char, out_bus: *mut *mut PamojaI2cBus, ) -> PamojaStatus
Expand description

Opens the kernel’s I2C adapter, such as /dev/i2c-1 on a Raspberry Pi.

§Arguments

  • path - the adapter’s device file.
  • out_bus - receives the bus, or null when opening fails.

§Returns

PamojaStatus::Ok with the bus in out_bus; PamojaStatus::Unsupported on any platform but Linux; PamojaStatus::InvalidArgument for a null or non-UTF-8 argument; or PamojaStatus::Io when the file cannot be opened as an adapter, with a last error message that names it.

§Safety

path must be a null-terminated string or null, and out_bus a writable pointer or null.