public final class I2CDeviceConfig extends java.lang.Object implements PeripheralConfig
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.
DEFAULT| Constructor and Description |
|---|
I2CDeviceConfig(int busNumber,
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 |
|---|---|
int |
getAddress()
Gets the configured address of the I2C slave device.
|
int |
getAddressSize()
Gets the configured address size of the I2C slave device.
|
int |
getBusNumber()
Gets the configured I2C bus number the I2C slave device is connected to.
|
int |
getClockFrequency()
Gets the configured clock frequency (in Hz) supported by the I2C slave device.
|
public I2CDeviceConfig(int busNumber,
int address,
int addressSize,
int clockFrequency)
I2CDeviceConfig with the specified hardware addressing information and configuration
parameters.busNumber - the number of the bus the slave device is connected to (a positive or null integer) or
PeripheralConfig.DEFAULT.address - the address of the slave device on the bus (a positive or null integer).addressSize - the address size: 7 bits, 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:
busNumber 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 int getAddress()
public int getAddressSize()
7 bits or 10 bits or PeripheralConfig.DEFAULT.public int getBusNumber()
PeripheralConfig.DEFAULT.public int getClockFrequency()
PeripheralConfig.DEFAULT.Copyright (c) 2012, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.