public final class I2CDeviceConfig extends java.lang.Object implements DeviceConfig<I2CDevice>, DeviceConfig.HardwareAddressing
I2CDeviceConfig class encapsulates the hardware addressing information, and static
and dynamic configuration parameters of an I2C slave device.
Some hardware addressing parameter, and static and dynamic configuration parameters may be set to
DeviceConfig.DEFAULT. Whether such default settings are supported is platform- as well as device
driver-dependent.
An instance of I2CDeviceConfig can be passed to the
DeviceManager.open(DeviceConfig) or
DeviceManager.open(Class, DeviceConfig) method to open the designated I2C slave
device with the specified configuration. A InvalidDeviceConfigException is thrown
when attempting to open a device with an invalid or unsupported configuration.DeviceConfig.HardwareAddressing| Modifier and Type | Field and Description |
|---|---|
static int |
ADDR_SIZE_10
10 bit slave address.
|
static int |
ADDR_SIZE_7
7 bit slave address.
|
DEFAULT| Constructor and Description |
|---|
I2CDeviceConfig(int controllerNumber,
int address,
int addressSize,
int clockFrequency)
Creates a new
I2CDeviceConfig with the specified hardware addressing information and
configuration parameters. |
I2CDeviceConfig(java.lang.String controllerName,
int address,
int addressSize,
int clockFrequency)
Creates a new
I2CDeviceConfig with the specified hardware addressing information and
configuration parameters. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj)
Checks two
I2CDeviceConfig objects for equality. |
int |
getAddress()
Gets the configured address of the I2C slave device.
|
int |
getAddressSize()
Gets the configured address size of the I2C slave device.
|
int |
getClockFrequency()
Gets the configured clock frequency (in Hz) supported by the I2C slave device.
|
java.lang.String |
getControllerName()
Gets the configured controller name (such as its device file name on UNIX systems).
|
int |
getControllerNumber()
Gets the configured controller number (the controller number the I2C bus adapter the I2C slave device
is connected to).
|
int |
hashCode()
Returns the hash code value for this object.
|
public static final int ADDR_SIZE_7
public static final int ADDR_SIZE_10
public I2CDeviceConfig(int controllerNumber,
int address,
int addressSize,
int clockFrequency)
I2CDeviceConfig with the specified hardware addressing information and
configuration parameters.controllerNumber - the number of the bus the slave device is connected to (a positive or zero
integer) or DeviceConfig.DEFAULT.address - the address of the slave device on the bus (a positive or zero integer).addressSize - the address size: ADDR_SIZE_7 bits, ADDR_SIZE_10 bits or
DeviceConfig.DEFAULT.clockFrequency - the clock frequency of the slave device in Hz (a positive integer) or
DeviceConfig.DEFAULT.java.lang.IllegalArgumentException - if any of the following is true:
controllerNumber is not in the defined range;address is not in the defined range;addressSize is not in the defined range;clockFrequency is not in the defined range.public I2CDeviceConfig(java.lang.String controllerName,
int address,
int addressSize,
int clockFrequency)
I2CDeviceConfig with the specified hardware addressing information and
configuration parameters.controllerName - the controller name (such as its device file name on UNIX systems).address - the address of the slave device on the bus (a positive or zero integer).addressSize - the address size: ADDR_SIZE_7 bits, ADDR_SIZE_10 bits or
DeviceConfig.DEFAULT.clockFrequency - the clock frequency of the slave device in Hz (a positive integer) or
DeviceConfig.DEFAULT.java.lang.IllegalArgumentException - if any of the following is true:
address is not in the defined range;addressSize is not in the defined range;clockFrequency is not in the defined range.java.lang.NullPointerException - if controllerName is null.public int getAddress()
public int getAddressSize()
ADDR_SIZE_7 bits, ADDR_SIZE_10 bits or
DeviceConfig.DEFAULT.public int getControllerNumber()
getControllerNumber in interface DeviceConfig.HardwareAddressingDeviceConfig.DEFAULT.public java.lang.String getControllerName()
getControllerName in interface DeviceConfig.HardwareAddressingnull.public int getClockFrequency()
DeviceConfig.DEFAULT.public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
I2CDeviceConfig objects for equality.equals in class java.lang.Objectobj - the object to test for equality with this object.true if obj is a I2CDeviceConfig and has the same hardware
addressing information and configuration parameter values as this
I2CDeviceConfig object.Copyright © 2012, 2014, Oracle and/or its affiliates. All rights reserved.
Legal Notices