Skip to main content

I2C Functions

dev.io.i2c - wire path i\i - generated from fwMenuI2C.

i2c_write

Write. Writes data to a specific I2C Address

Wire command: i\i\w

ArgWire type
addresshex8
registerhex8
data_byteshexbytes

Returns: none (Ok/Err only)

dev.io.i2c.i2c_write(address: int, register: int, data_bytes: bytes | bytearray) -> Result
ow_status ow_io_i2c_i2c_write(ow_device* dev, uint8_t address, uint8_t register_, const uint8_t* data_bytes, size_t data_bytes_len);
dev.io().i2c().i2c_write(address: u8, register: u8, data_bytes: &[u8]) -> Result<(), OwError>

The C and Rust signatures above are also the WASM guest signatures - the device API surface is identical; only the transport differs (ow_open_wasm(&dev) in C, OneWili::open() in Rust).

dev.io.i2c.i2c_write(address, register, data_bytes) # check dev.ok

i2c_read

Read. Reads the number from the address

Wire command: i\i\r

Returns: i2crepsone (hexbytes)

dev.io.i2c.i2c_read() -> Result
ow_status ow_io_i2c_i2c_read(ow_device* dev, uint8_t* i2crepsone, size_t i2crepsone_cap, size_t* i2crepsone_len);
dev.io().i2c().i2c_read() -> Result<Vec<u8>, OwError>

The C and Rust signatures above are also the WASM guest signatures - the device API surface is identical; only the transport differs (ow_open_wasm(&dev) in C, OneWili::open() in Rust).

dev.io.i2c.i2c_read() # returns value; check dev.ok

i2c_poll

Poll. Tests all addresses for I2C Response

Wire command: i\i\p

Returns: none (Ok/Err only)

dev.io.i2c.i2c_poll() -> Result
ow_status ow_io_i2c_i2c_poll(ow_device* dev);
dev.io().i2c().i2c_poll() -> Result<(), OwError>

The C and Rust signatures above are also the WASM guest signatures - the device API surface is identical; only the transport differs (ow_open_wasm(&dev) in C, OneWili::open() in Rust).

dev.io.i2c.i2c_poll() # check dev.ok

show_i2c_settings

I2C Settings. Opens the persistent I2C settings menu

Wire command: i\i\s

Returns: none (Ok/Err only)

dev.io.i2c.show_i2c_settings() -> Result
ow_status ow_io_i2c_show_i2c_settings(ow_device* dev);
dev.io().i2c().show_i2c_settings() -> Result<(), OwError>

The C and Rust signatures above are also the WASM guest signatures - the device API surface is identical; only the transport differs (ow_open_wasm(&dev) in C, OneWili::open() in Rust).

dev.io.i2c.show_i2c_settings() # check dev.ok