Package io.helins.linux.i2c
Class I2CBuffer
- java.lang.Object
-
- io.helins.linux.i2c.I2CBuffer
-
public class I2CBuffer extends Object
Class representing a buffer of bytes for directly reading or writing to a slave device.
-
-
Field Summary
Fields Modifier and Type Field Description intlengthThe length of this buffer.
-
Constructor Summary
Constructors Constructor Description I2CBuffer(int length)Allocates a buffer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description I2CBufferclear()Fills the buffer with 0.intget(int index)Retrieves the byte at the given position.I2CBufferset(int index, int b)Sets the byte at the given position.
-
-
-
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.
-
-