Package com.diozero.api
Class I2CDevice.Builder
java.lang.Object
com.diozero.api.I2CDevice.Builder
- Enclosing class:
- I2CDevice
public static class I2CDevice.Builder extends Object
I2C device builder. Default values:
- controller: 1
- addressSize:
7
- byteOrder:
Big Endian
-
Field Summary
Fields Modifier and Type Field Description static ByteOrder
DEFAULT_BYTE_ORDER
Default toByteOrder.BIG_ENDIAN
-
Constructor Summary
Constructors Modifier Constructor Description protected
Builder(int address)
-
Method Summary
Modifier and Type Method Description I2CDevice
build()
Construct a new I2CDevice instanceI2CDeviceFactoryInterface
getFactory()
I2CDevice.Builder
setAddress(int address)
Set the I2c device addressI2CDevice.Builder
setAddressSize(I2CConstants.AddressSize addressSize)
Set the I2C deviceaddress size
I2CDevice.Builder
setByteOrder(ByteOrder byteOrder)
Set the Defaultbyte order
for this deviceI2CDevice.Builder
setController(int controller)
Set the I2C bus controllerI2CDevice.Builder
setFactory(I2CDeviceFactoryInterface factory)
Set the I2C device factory to use for provisioning I2C device instances
-
Field Details
-
DEFAULT_BYTE_ORDER
Default toByteOrder.BIG_ENDIAN
-
-
Constructor Details
-
Builder
protected Builder(int address)
-
-
Method Details
-
getFactory
-
setFactory
Set the I2C device factory to use for provisioning I2C device instances- Parameters:
factory
- the I2C device factory to use for provisioning I2C device instances- Returns:
- this builder instance
-
setController
Set the I2C bus controller- Parameters:
controller
- the I2C bus controller number (/dev/i2c-<controller>
)- Returns:
- this builder instance
-
setAddress
Set the I2c device address- Parameters:
address
- the I2C device address- Returns:
- this builder instance
-
setAddressSize
Set the I2C deviceaddress size
- Parameters:
addressSize
- the I2C deviceaddress size
- Returns:
- this builder instance
-
setByteOrder
Set the Defaultbyte order
for this device- Parameters:
byteOrder
- thebyte order
that is only used in the additional non-SMBus I2C device utility methods- Returns:
- this builder instance
-
build
Construct a new I2CDevice instance- Returns:
- a new I2C device
-