Skip to main content

Module i2c

Module i2c 

Source
Expand description

I2C device node control contract (/devices/i2c/<name>).

Control commands (kind b'i'), all with a version field first that must equal ABI_VERSION and reserved fields that must be zero:

  • SELECT_ADDRESS (write): 7-bit address, or 10-bit when the controller reports ten_bit support.
  • GET_FREQUENCY (read): configured and maximum frequency.
  • SET_FREQUENCY (write): new frequency, 0 < hz <= max_frequency_hz.
  • WRITE_READ (write): write then read in one transaction with repeated START, against the selected address. Lengths are at most MAX_TRANSFER_LENGTH and at least one of them must be non-zero.

Structs§

FrequencyOutput
Output of GET_FREQUENCY.
GET_FREQUENCY
SELECT_ADDRESS
SET_FREQUENCY
SelectAddressInput
Input of SELECT_ADDRESS.
SetFrequencyInput
Input of SET_FREQUENCY.
WRITE_READ
WriteReadInput
Input of WRITE_READ. Only the first write_length bytes of write are sent.
WriteReadOutput
Output of WRITE_READ. The first read_length bytes of read are valid.

Constants§

ABI_VERSION
Version carried in the first field of every command input and output.
MAX_TRANSFER_LENGTH
Largest write or read length of one WRITE_READ transfer.