|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface I2CPort
Abstraction for a port that supports I2C sensors.
Field Summary | |
---|---|
static int |
ALWAYS_ACTIVE
Keep the i2c driver active between requests |
static int |
ERR_ABORT
Operation aborted |
static int |
ERR_BUS_BUSY
Bus is busy |
static int |
ERR_BUSY
Port is busy |
static int |
ERR_FAULT
Data error during transaction |
static int |
ERR_INVALID_LENGTH
Read/Write request too large |
static int |
ERR_INVALID_PORT
Invalid port number, or port is not enabled |
static int |
HIGH_SPEED
Use high speed I/O (125KHz) |
static int |
LEGO_MODE
Use Lego compatible i2c protocol (default) |
static int |
MAX_IO
Maximum read/write request length |
static int |
NO_RELEASE
Do not release the i2c bus between requests |
static int |
STANDARD_MODE
Use standard i2c protocol |
Fields inherited from interface lejos.nxt.SensorConstants |
---|
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, GREEN, GREEN_INDEX, MAX_AD_RAW, MAX_TYPE, MIN_TYPE, MODE_ANGLESTEP, MODE_BOOLEAN, MODE_CELSIUS, MODE_FARENHEIT, MODE_PCTFULLSCALE, MODE_PERIODCOUNTER, MODE_RAW, MODE_TRANSITIONCNT, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW |
Method Summary | |
---|---|
void |
i2cDisable()
Disable the device. |
void |
i2cEnable(int mode)
Enable the low level device |
int |
i2cStatus()
Check to see the status of the port/device |
int |
i2cTransaction(int deviceAddress,
byte[] writeBuf,
int writeOffset,
int writeLen,
byte[] readBuf,
int readOffset,
int readLen)
High level i2c interface. |
Methods inherited from interface lejos.nxt.BasicSensorPort |
---|
getMode, getType, setMode, setType, setTypeAndMode |
Field Detail |
---|
static final int STANDARD_MODE
static final int LEGO_MODE
static final int ALWAYS_ACTIVE
static final int NO_RELEASE
static final int HIGH_SPEED
static final int MAX_IO
static final int ERR_INVALID_PORT
static final int ERR_BUSY
static final int ERR_FAULT
static final int ERR_INVALID_LENGTH
static final int ERR_BUS_BUSY
static final int ERR_ABORT
Method Detail |
---|
void i2cEnable(int mode)
mode
- One or more of the mode bits above.void i2cDisable()
int i2cStatus()
int i2cTransaction(int deviceAddress, byte[] writeBuf, int writeOffset, int writeLen, byte[] readBuf, int readOffset, int readLen)
deviceAddress
- The I2C device address.writeBuf
- The buffer containing data to be written to the device.writeOffset
- The offset of the data within the write bufferwriteLen
- The number of bytes to write.readBuf
- The buffer to use for the transaction resultsreadOffset
- Location to write the results toreadLen
- The length of the read
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |