public static final class I2CDeviceConfig.Builder extends Object
Builder
class allows for creating and initializing
I2CDeviceConfig
objects. Calls can be chained in the following
manner:
I2CDeviceConfig config = new I2CDeviceConfig.Builder() .setControllerNumber(1) .setAddress(0x300, ADDR_SIZE_10) .setClockFrequency(8000000) .build();
Constructor and Description |
---|
I2CDeviceConfig.Builder()
Creates a new
Builder instance. |
Modifier and Type | Method and Description |
---|---|
I2CDeviceConfig |
build()
Creates a new
I2CDeviceConfig instance initialized with the
values set for each configuration parameters. |
I2CDeviceConfig.Builder |
setAddress(int address,
int addressSize)
Sets the address of the slave device on the bus.
|
I2CDeviceConfig.Builder |
setClockFrequency(int clockFrequency)
Sets the clock frequency of the slave device in Hz (default value is
UNASSIGNED if not set). |
I2CDeviceConfig.Builder |
setControllerName(String controllerName)
Sets the name of the bus the slave device is connected to (default value is
null if not set). |
I2CDeviceConfig.Builder |
setControllerNumber(int controllerNumber)
Sets the number of the bus the slave device is connected to (default
value is
UNASSIGNED if not set). |
I2CDeviceConfig.Builder |
setInputBufferSize(int inputBufferSize)
Sets the requested input buffer size (default value is
UNASSIGNED if not set). |
I2CDeviceConfig.Builder |
setOutputBufferSize(int outputBufferSize)
Sets the requested output buffer size (default value is
UNASSIGNED if not set). |
public I2CDeviceConfig.Builder()
Builder
instance.public I2CDeviceConfig build()
I2CDeviceConfig
instance initialized with the
values set for each configuration parameters. If a configuration
parameter was not explictly set its default value will be used.I2CDeviceConfig
instance.IllegalStateException
- if any of the following is true:
public I2CDeviceConfig.Builder setControllerName(String controllerName)
null
if not set).controllerName
- the name of the bus the slave device is connected to (such as its device
file name on UNIX systems) or null
.Builder
instance.public I2CDeviceConfig.Builder setAddress(int address, int addressSize)
address
- the address of the slave device on the bus (a positive
or zero integer, strictly lesser than 2addressSize
).addressSize
- the address size: I2CDeviceConfig.ADDR_SIZE_7
bits,
I2CDeviceConfig.ADDR_SIZE_10
bits.Builder
instance.IllegalArgumentException
- if any of the following is true:
address
is not in the defined range;addressSize
is not in the defined range;public I2CDeviceConfig.Builder setControllerNumber(int controllerNumber)
UNASSIGNED
if not set).controllerNumber
- the number of the bus the slave device is
connected to (a positive or zero integer) or UNASSIGNED
.Builder
instance.IllegalArgumentException
- if controllerNumber
is not
in the defined range.public I2CDeviceConfig.Builder setInputBufferSize(int inputBufferSize)
UNASSIGNED
if not set).inputBufferSize
- the requested input buffer size in number of
samples (a positive or zero integer) or
UNASSIGNED
.Builder
instance.IllegalArgumentException
- if inputBufferSize
is not in
the defined range.public I2CDeviceConfig.Builder setOutputBufferSize(int outputBufferSize)
UNASSIGNED
if not set).outputBufferSize
- the requested output buffer size in number of
samples (a positive or zero integer) or
UNASSIGNED
.Builder
instance.IllegalArgumentException
- if outputBufferSize
is not
in the defined range.public I2CDeviceConfig.Builder setClockFrequency(int clockFrequency)
UNASSIGNED
if not set).clockFrequency
- the clock frequency of the slave device in Hz
(a positive integer) or UNASSIGNED
.Builder
instance.IllegalArgumentException
- if clockFrequency
is not in
the defined range.