Execute DCMD_I2C_SENDRECV devctl()
isendrecv [-a slave] [-x] [-n name] [-r] [-b speed] [-l length] [data ... ]
QNX Neutrino
The isendrecv utility executes a DCMD_I2C_SENDRECV command (see DCMD_I2C_SENDRECV in Customizing a BSP).
The following examples illustrate how to use isendrecv. Note that behavior is device-specific: it's up to the device to interpret the data it receives. For some devices, the first byte might be an address, but this is not guaranteed. You may need to modify the examples for your device. Check your device manual to know what it expects, and how it will behave.
Write one byte with the value 0x2 to an I2C device on bus 3, at address 0x48, using the same bus speed as the most recent transaction. After the data has been sent, read back one byte from the slave device:
isendrecv -a 0x48 -n /dev/i2c3 -l 1 0x2
For some I2C slave devices, this command format could be used to select the slave register at offset 0x2, then read back one byte of register data.
Write two bytes with the values 0x1 for the first byte, then 0x2 for the second byte to an I2C device on bus 3, at address 0x48 and with a bus speed of 400 KHz:
isendrecv -a 0x48 -n /dev/i2c3 -b 400000 0x1 0x2
For some I2C slave devices, this command format could be used to select the slave register at offset 0x1, then write value 0x2 to this register.
Read one byte from an I2C device on bus 3, at address 0x48.
isendrecv -a 0x48 -n /dev/i2c3 -l 1