cork.net.i2c
Class I2CBusMasterFactory

java.lang.Object
  |
  +--cork.net.i2c.I2CBusMasterFactory
All Implemented Interfaces:
Device

public final class I2CBusMasterFactory
extends java.lang.Object
implements Device

The Factory knows how to create copies of the system BusMaster and how to set its properties. To change the properties of the I2C lines, use the properties specified.

There are 4 properties that can be set in JemBuilder to change the configuration of the I2C bus:

cork.i2c.sda.pin.id={integer}
number; one of the port ID numbers to specify the data line. The default is 8198 (B5).
cork.i2c.scl.pin.id={integer}
number; one of the port ID numbers to specify the clock line. The default is 4102 (B4).
cork.i2c.int.pin.id={integer}
number; one of the port ID numbers to specify the interrupt line. The default is 261 (A0).
cork.i2c.bus.timeout={integer}
number; the timeout in milliseconds for the I2C bus. The default is 500.

The list that follows shows the bit ID/interrupt ID for the specified pin:

Version:
0.2.1
Author:
Brill Pappin

Field Summary
static int DEFAULT_BUS_TIMEOUT
          The defualt bus timeout value is: 500 millis.
static int DEFAULT_INTERRUPT_PIN_ID
          The defualt INT (interrupt) pin is InterruptController.GPIOA_BIT0_INTERRUPT
static int DEFAULT_SCL_PIN_ID
          The defualt SCL pin is GpioPin.GPIOB_BIT4
static int DEFAULT_SDA_PIN_ID
          The defualt SDA pin is GpioPin.GPIOB_BIT5
static java.lang.String I2C_BUS_TIMEOUT
          The system property string to use in order the change the timeout for the I2C bus in milliseconds.
static java.lang.String I2C_INT_PIN_ID
          The system property string to use in order the change the INT (interrupt line) pin for the I2C bus.
static java.lang.String I2C_SCL_PIN_ID
          The system property string to use in order the change the SCL pin for the I2C bus.
static java.lang.String I2C_SDA_PIN_ID
          The system property string to use in order the change the SDA pin for the I2C bus.
 
Method Summary
static I2CBusMaster getBusMasterInstance(int compatibility)
          Returns a singleton instance of the bus master for all devices.
 java.lang.String getDeviceDestription()
          Gets the destription attribute of the Device object
 java.lang.String getDeviceName()
          Gets the title attribute of the Device object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

I2C_SDA_PIN_ID

public static final java.lang.String I2C_SDA_PIN_ID
The system property string to use in order the change the SDA pin for the I2C bus.
cork.i2c.sda.pin.id
Since:
0.2.0

I2C_SCL_PIN_ID

public static final java.lang.String I2C_SCL_PIN_ID
The system property string to use in order the change the SCL pin for the I2C bus.
cork.i2c.scl.pin.id
Since:
0.2.0

I2C_INT_PIN_ID

public static final java.lang.String I2C_INT_PIN_ID
The system property string to use in order the change the INT (interrupt line) pin for the I2C bus.
cork.i2c.scl.pin.id
Since:
0.2.0

I2C_BUS_TIMEOUT

public static final java.lang.String I2C_BUS_TIMEOUT
The system property string to use in order the change the timeout for the I2C bus in milliseconds.
cork.i2c.bus.timeout
Since:
0.2.0

DEFAULT_SDA_PIN_ID

public static final int DEFAULT_SDA_PIN_ID
The defualt SDA pin is GpioPin.GPIOB_BIT5
Since:
0.2.0

DEFAULT_SCL_PIN_ID

public static final int DEFAULT_SCL_PIN_ID
The defualt SCL pin is GpioPin.GPIOB_BIT4
Since:
0.2.0

DEFAULT_INTERRUPT_PIN_ID

public static final int DEFAULT_INTERRUPT_PIN_ID
The defualt INT (interrupt) pin is InterruptController.GPIOA_BIT0_INTERRUPT
Since:
0.2.0

DEFAULT_BUS_TIMEOUT

public static final int DEFAULT_BUS_TIMEOUT
The defualt bus timeout value is: 500 millis.
Since:
0.2.0
Method Detail

getBusMasterInstance

public static final I2CBusMaster getBusMasterInstance(int compatibility)
                                               throws DeviceException,
                                                      java.lang.IllegalArgumentException
Returns a singleton instance of the bus master for all devices.
Parameters:
compatibility - Description of Parameter
Returns:
I2CBusMaster the BusMaster instance.
Throws:
java.lang.IllegalArgumentException - if the pins where changed via. the system properties, and there was an error getting the pin ID.
DeviceException - Throws a device exception is the pins being used for the I2C bus are already in use by another application.
Since:
0.2.1

getDeviceName

public java.lang.String getDeviceName()
Gets the title attribute of the Device object
Specified by:
getDeviceName in interface Device
Returns:
The title value
Since:
0.1.0

getDeviceDestription

public java.lang.String getDeviceDestription()
Gets the destription attribute of the Device object
Specified by:
getDeviceDestription in interface Device
Returns:
The destription value
Since:
0.1.0