public class TestI2c extends Object
| Constructor and Description |
|---|
TestI2c()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the connection.
|
void |
open(I2c.ConnType connType,
String ident)
Opens connection to a device.
|
String |
read(int addr,
int reg,
int count)
Reads bytes from 1-byte register number.
|
String |
read2(int addr,
int reg,
int count)
Reads bytes from 2-byte register number.
|
String |
readMult(int addr,
int count)
Reads multiple bytes.
|
String |
readOne(int addr)
Reads one byte.
|
String |
readString(int addr,
int reg,
int count)
Reads string from 1-byte register number.
|
String |
readString2(int addr,
int reg,
int count)
Reads string from 2-byte register number.
|
void |
write(int addr,
int reg,
int... value)
Writes bytes to 1-byte register number.
|
void |
write2(int addr,
int reg,
int... value)
Writes bytes to 2-byte register number.
|
void |
writeOne(int addr,
int value)
Writes one byte.
|
void |
writeString(int addr,
int reg,
String value)
Writes string to 1-byte register number.
|
void |
writeString2(int addr,
int reg,
String value)
Writes string to 2-byte register number.
|
@Command(name="open",
description="Open connection to device")
public void open(@Argument(name="type",description="Connection type")
I2c.ConnType connType,
@Argument(name="ident",description="Identification")
String ident)
throws org.lsst.ccs.drivers.commons.DriverException
connType - The type of connection: ftdi or serialident - The identification: serial no. (ftdi) or port name (serial)org.lsst.ccs.drivers.commons.DriverException@Command(name="close",
description="Close the connection")
public void close()
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(name="writeone",
description="Write one byte")
public void writeOne(@Argument(name="addr",description="I2C bus address")
int addr,
@Argument(name="value",description="Value to write")
int value)
throws org.lsst.ccs.drivers.commons.DriverException
addr - The I2C addressvalue - The value to writeorg.lsst.ccs.drivers.commons.DriverException@Command(name="readone",
description="Read one byte")
public String readOne(@Argument(name="addr",description="I2C bus address")
int addr)
throws org.lsst.ccs.drivers.commons.DriverException
addr - The I2C addressorg.lsst.ccs.drivers.commons.DriverException@Command(name="readmult",
description="Read multiple byte")
public String readMult(@Argument(name="addr",description="I2C bus address")
int addr,
@Argument(name="count",description="Byte count")
int count)
throws org.lsst.ccs.drivers.commons.DriverException
addr - The I2C addresscount - The number of bytes to readorg.lsst.ccs.drivers.commons.DriverException@Command(name="write",
description="Write bytes (1-byte register number)")
public void write(@Argument(name="addr",description="I2C bus address")
int addr,
@Argument(name="reg",description="Register number")
int reg,
@Argument(name="value",description="Value to write")
int... value)
throws org.lsst.ccs.drivers.commons.DriverException
addr - The I2C addressreg - The register numbervalue - The values to writeorg.lsst.ccs.drivers.commons.DriverException@Command(name="writestring",
description="Write string (1-byte register number)")
public void writeString(@Argument(name="addr",description="I2C bus address")
int addr,
@Argument(name="reg",description="Register number")
int reg,
@Argument(name="value",description="String to write")
String value)
throws org.lsst.ccs.drivers.commons.DriverException
addr - The I2C addressreg - The register numbervalue - The string to writeorg.lsst.ccs.drivers.commons.DriverException@Command(name="read",
description="Read bytes (1-byte register number)")
public String read(@Argument(name="addr",description="I2C bus address")
int addr,
@Argument(name="reg",description="Register number")
int reg,
@Argument(name="count",description="Byte count")
int count)
throws org.lsst.ccs.drivers.commons.DriverException
addr - The I2C addressreg - The register numbercount - The number of bytes to readorg.lsst.ccs.drivers.commons.DriverException@Command(name="readstring",
description="Read string (1-byte register number)")
public String readString(@Argument(name="addr",description="I2C bus address")
int addr,
@Argument(name="reg",description="Register number")
int reg,
@Argument(name="count",description="Byte count")
int count)
throws org.lsst.ccs.drivers.commons.DriverException
addr - The I2C addressreg - The register numbercount - The number of bytes to readorg.lsst.ccs.drivers.commons.DriverException@Command(name="write2",
description="Write bytes (2-byte register number)")
public void write2(@Argument(name="addr",description="I2C bus address")
int addr,
@Argument(name="reg",description="Register number")
int reg,
@Argument(name="value",description="Value to write")
int... value)
throws org.lsst.ccs.drivers.commons.DriverException
addr - The I2C addressreg - The register numbervalue - The values to writeorg.lsst.ccs.drivers.commons.DriverException@Command(name="writestring2",
description="Write string (2-byte register number)")
public void writeString2(@Argument(name="addr",description="I2C bus address")
int addr,
@Argument(name="reg",description="Register number")
int reg,
@Argument(name="value",description="String to write")
String value)
throws org.lsst.ccs.drivers.commons.DriverException
addr - The I2C addressreg - The register numbervalue - The string to writeorg.lsst.ccs.drivers.commons.DriverException@Command(name="read2",
description="Read bytes (2-byte register number)")
public String read2(@Argument(name="addr",description="I2C bus address")
int addr,
@Argument(name="reg",description="Register number")
int reg,
@Argument(name="count",description="Byte count")
int count)
throws org.lsst.ccs.drivers.commons.DriverException
addr - The I2C addressreg - The register numbercount - The number of bytes to readorg.lsst.ccs.drivers.commons.DriverException@Command(name="readstring2",
description="Read string (2-byte register number)")
public String readString2(@Argument(name="addr",description="I2C bus address")
int addr,
@Argument(name="reg",description="Register number")
int reg,
@Argument(name="count",description="Byte count")
int count)
throws org.lsst.ccs.drivers.commons.DriverException
addr - The I2C addressreg - The register numbercount - The number of bytes to readorg.lsst.ccs.drivers.commons.DriverExceptionCopyright © 2019 LSST. All rights reserved.