Skip to main content

SPI Functions

dev.io.spi - wire path i\e - generated from fwMenuSPI.

s_pi_write​

Write and Read. Writes data to SPI and returns response data

Write and Read (SPI)​

Performs a full-duplex SPI transaction: writes the supplied bytes on MOSI while simultaneously capturing the bytes returned on MISO, then prints the received bytes.

Usage​

Enter one or more data bytes as hexadecimal values separated by spaces.

w 9F
w 03 00 00 00
w AB CD EF
Behavior​
  • Chip Select is asserted automatically (driven low before the transfer, high after).
  • The transfer length equals the number of input bytes; MISO is captured for every clocked byte.
  • Uses the currently configured SPI baud rate, mode, and CS pin from the SPI settings.
Arguments​
  • dataBytes — one or more hex bytes to clock out (e.g. 9F, 03 00 00 00).
Returns​
  • success — true if the transfer completed, false on invalid input or bus error.
  • Response bytes are printed as space-separated hex.
Example​

Reading a SPI flash JEDEC ID:

w 9F 00 00 00

Response bytes 2–4 contain the manufacturer / device ID.

Wire command: i\e\w

ArgWire type
data_byteshexbytes

Returns: spi_response (hexbytes)

dev.io.spi.s_pi_write(data_bytes: bytes | bytearray) -> Result
ow_status ow_io_spi_s_pi_write(ow_device* dev, const uint8_t* data_bytes, size_t data_bytes_len, uint8_t* spi_response, size_t spi_response_cap, size_t* spi_response_len);
dev.io().spi().s_pi_write(data_bytes: &[u8]) -> 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.spi.s_pi_write(data_bytes) # returns value; check dev.ok

show_spi_settings​

SPI Settings. Opens the persistent SPI settings menu

Wire command: i\e\s

Returns: none (Ok/Err only)

dev.io.spi.show_spi_settings() -> Result
ow_status ow_io_spi_show_spi_settings(ow_device* dev);
dev.io().spi().show_spi_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.spi.show_spi_settings() # check dev.ok