Class I2CTransaction


  • public class I2CTransaction
    extends Object
    Class representing an I2C transaction for carrying out several uninterrupted IO operations.

    Sometimes, only one message per transaction is supported, which defeat the purpose of having transactions.

    • Field Detail

      • MAX_LENGTH

        public static final int MAX_LENGTH
        The maximum number of messages a single transaction can carry out in theory.
        See Also:
        Constant Field Values
      • length

        public final int length
        How many messages this transaction holds.
    • Constructor Detail

      • I2CTransaction

        public I2CTransaction​(int length)
        Creates a new transaction.
        Parameters:
        length - Number of messages.
        Throws:
        IllegalArgumentException - When the request number of messages is higher than what is supported.
        See Also:
        MAX_LENGTH
    • Method Detail

      • getMessage

        public I2CMessage getMessage​(int index)
        Retrieves a message from this transaction for inspection of modification.
        Parameters:
        index - Which one.
        Returns:
        The relevant message.