public final class I2CDeviceConfig extends java.lang.Object implements PeripheralConfig<I2CDevice>, PeripheralConfig.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 PeripheralConfig.DEFAULT.
Whether such default settings are supported is platform- as well as peripheral driver-dependent.
An instance of I2CDeviceConfig can be passed to the PeripheralManager.open(PeripheralConfig) or
PeripheralManager.open(Class, PeripheralConfig) method to open the designated I2C slave device with the
specified configuration. A PeripheralConfigInvalidException is thrown when attempting to open a peripheral
device with an invalid or unsupported configuration.PeripheralConfig.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 deviceNumber,
int address,
int addressSize,
int clockFrequency)
Creates a new
I2CDeviceConfig with the specified hardware addressing information and configuration
parameters. |
I2CDeviceConfig(java.lang.String deviceName,
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 |
getDeviceName()
Gets the configured device name (such as to its device file name on UNIX systems).
|
int |
getDeviceNumber()
Gets the configured device number (the device 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 deviceNumber,
int address,
int addressSize,
int clockFrequency)
I2CDeviceConfig with the specified hardware addressing information and configuration
parameters.deviceNumber - the number of the bus the slave device is connected to (a positive or zero integer) or
PeripheralConfig.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 PeripheralConfig.DEFAULT.clockFrequency - the clock frequency of the slave device in Hz (a positive integer) or PeripheralConfig.DEFAULT.java.lang.IllegalArgumentException - if any of the following is true:
deviceNumber 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 deviceName,
int address,
int addressSize,
int clockFrequency)
I2CDeviceConfig with the specified hardware addressing information and configuration
parameters.deviceName - the device name (such as to 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 PeripheralConfig.DEFAULT.clockFrequency - the clock frequency of the slave device in Hz (a positive integer) or PeripheralConfig.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 deviceName is null.public int getAddress()
public int getAddressSize()
ADDR_SIZE_7 bits, ADDR_SIZE_10 bits or PeripheralConfig.DEFAULT.public int getDeviceNumber()
getDeviceNumber in interface PeripheralConfig.HardwareAddressingPeripheralConfig.DEFAULT.public java.lang.String getDeviceName()
getDeviceName in interface PeripheralConfig.HardwareAddressingnull.public int getClockFrequency()
PeripheralConfig.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, 2013, Oracle and/or its affiliates. All rights reserved.
Legal Notices