Class I2CBuffer


  • public class I2CBuffer
    extends Object
    Class representing a buffer of bytes for directly reading or writing to a slave device.
    • Field Detail

      • length

        public final int length
        The length of this buffer.
    • Constructor Detail

      • I2CBuffer

        public I2CBuffer​(int length)
        Allocates a buffer.
        Parameters:
        length - The number of bytes.
    • Method Detail

      • get

        public int get​(int index)
        Retrieves the byte at the given position.
        Parameters:
        index - Which byte.
        Returns:
        An unsigned byte.
      • set

        public I2CBuffer set​(int index,
                             int b)
        Sets the byte at the given position.
        Parameters:
        index - Where.
        b - An unsigned byte.
        Returns:
        This instance.
      • clear

        public I2CBuffer clear()
        Fills the buffer with 0.
        Returns:
        This instance.