|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wpi.first.wpilibj.SensorBase
edu.wpi.first.wpilibj.I2C
public class I2C
I2C bus interface class. This class is intended to be used by sensor (and other I2C device) drivers. It probably should not be used directly. It is constructed by calling DigitalModule::GetI2C() on a DigitalModule object.
Field Summary |
---|
Fields inherited from class edu.wpi.first.wpilibj.SensorBase |
---|
kAnalogChannels, kAnalogModules, kDigitalChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond |
Constructor Summary | |
---|---|
I2C(DigitalModule module,
int deviceAddress)
Constructor. |
Method Summary | |
---|---|
boolean |
addressOnly()
Attempt to address a device on the I2C bus. |
void |
broadcast(int registerAddress,
int data)
Send a broadcast write to all devices on the I2C bus. |
void |
free()
Destructor. |
boolean |
read(int registerAddress,
int count,
byte[] buffer)
Execute a read transaction with the device. |
void |
setCompatabilityMode(boolean enable)
SetCompatabilityMode Enables bitwise clock skewing detection. |
boolean |
transaction(byte[] dataToSend,
int sendSize,
byte[] dataReceived,
int receiveSize)
Generic transaction. |
boolean |
verifySensor(int registerAddress,
int count,
byte[] expected)
Verify that a device's registers contain expected values. |
boolean |
write(int registerAddress,
int data)
Execute a write transaction with the device. |
Methods inherited from class edu.wpi.first.wpilibj.SensorBase |
---|
checkAnalogChannel, checkAnalogModule, checkDigitalChannel, checkDigitalModule, checkPWMChannel, checkPWMModule, checkRelayChannel, checkRelayModule, checkSolenoidChannel, checkSolenoidModule, getDefaultAnalogModule, getDefaultDigitalModule, getDefaultSolenoidModule, setDefaultAnalogModule, setDefaultDigitalModule, setDefaultSolenoidModule |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public I2C(DigitalModule module, int deviceAddress)
module
- The Digital Module to which the device is conneted.deviceAddress
- The address of the device on the I2C bus.Method Detail |
---|
public void free()
free
in class SensorBase
public boolean transaction(byte[] dataToSend, int sendSize, byte[] dataReceived, int receiveSize)
dataToSend
- Buffer of data to send as part of the transaction.sendSize
- Number of bytes to send as part of the transaction. [0..6]dataReceived
- Buffer to read data into.receiveSize
- Number of byted to read from the device. [0..7]
public boolean addressOnly()
public boolean write(int registerAddress, int data)
registerAddress
- The address of the register on the device to be written.data
- The byte to write to the register on the device.public boolean read(int registerAddress, int count, byte[] buffer)
registerAddress
- The register to read first in the transaction.count
- The number of bytes to read in the transaction. [1..7]buffer
- A pointer to the array of bytes to store the data read from the device.
public void broadcast(int registerAddress, int data)
registerAddress
- The register to write on all devices on the bus.data
- The value to write to the devices.public void setCompatabilityMode(boolean enable)
enable
- Enable compatability mode for this sensor or not.public boolean verifySensor(int registerAddress, int count, byte[] expected)
registerAddress
- The base register to start reading from the device.count
- The size of the field to be verified.expected
- A buffer containing the values expected from the device.
|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |