RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
robotCore.I2CInterface Class Reference

Public Member Functions

int read (byte[] buffer, int offset, int length) throws IOException
void write (byte[] data) throws IOException
int writeRead (byte[] writeData, byte[] buffer, int offset, int length) throws IOException

Detailed Description

Thin wrapper around a single I2C device on bus 1, using Pi4J V4.

Pi4J V4 methods throw unchecked exceptions; this class converts them to IOException so existing callers keep the same error handling they had with Pi4J V1.

Definition at line 16 of file I2CInterface.java.

Member Function Documentation

◆ read()

int robotCore.I2CInterface.read ( byte[] buffer,
int offset,
int length ) throws IOException

Reads bytes from the device.

Parameters
bufferbuffer to read into
offsetoffset in the buffer to start storing data
lengthnumber of bytes to read
Returns
number of bytes read

Definition at line 52 of file I2CInterface.java.

◆ write()

void robotCore.I2CInterface.write ( byte[] data) throws IOException

Writes bytes to the device.

Parameters
databytes to write

Definition at line 70 of file I2CInterface.java.

◆ writeRead()

int robotCore.I2CInterface.writeRead ( byte[] writeData,
byte[] buffer,
int offset,
int length ) throws IOException

Writes bytes to the device and then reads a response, as one combined I2C transaction (repeated start, no stop between the write and the read).

Parameters
writeDatabytes to write first (e.g. a register address or command)
bufferbuffer to read the response into
offsetoffset in the buffer to start storing data
lengthnumber of bytes to read
Returns
number of bytes read

Definition at line 92 of file I2CInterface.java.


The documentation for this class was generated from the following file: