public class MockDevice extends Device
This class is extremely convenient to use for debugging, during development on a desktop PC, or on a Raspberry Pi which does not (yet) have a real device connected to it.
ADDR_GND, ADDR_SCL, ADDR_SDA, ADDR_VCC, CONFIG_AUDIO_INPUT, CONFIG_DISPLAY_MATRIX_1, CONFIG_DISPLAY_MATRIX_1_AND_2, CONFIG_DISPLAY_MATRIX_2, CONFIG_MATRIX_5X11, CONFIG_MATRIX_6X10, CONFIG_MATRIX_7X9, CONFIG_MATRIX_8X8, CONFIG_SOFTWARE_SHUTDOWN, errors, height, REG_BRIGHTNESS_CONFIG, REG_BRIGHTNESS_PWM, REG_CONFIG, REG_MATRIX1_DATA_START, REG_MATRIX2_DATA_START, REG_RESET, REG_UPDATE, shutdownHook, throwErrorCount, warnErrorCount, width| Constructor and Description |
|---|
MockDevice() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeImpl()
Closes the I2C bus and device.
|
static void |
main(String[] args)
The main command-line utility entry point.
|
protected Device |
openImpl(int busNumber,
int address)
Opens the connection to the I2C bus and
to the device at the given address.
|
void |
update()
Updates the display.
|
protected void |
writeImpl(byte register,
byte[] data,
int offset,
int length)
Writes a series of bytes of data starting at the given register.
|
close, closeOnShutdown, configure, displayTestPatterns, getHeight, getWidth, handleError, init, newInstance, newInstance, open, open, reset, setBrightness, setDisplay, setDisplay, setDisplay, setDisplay, update, write, write, writeImplprotected Device openImpl(int busNumber, int address) throws IOException
DeviceopenImpl in class DevicebusNumber - the I2C bus number to useaddress - the I2C device addressIOException - if an error occursprotected void closeImpl()
Device
This method may be called multiple times, or
without a successful call to Device.open(int) before it.
protected void writeImpl(byte register,
byte[] data,
int offset,
int length)
throws IOException
DevicewriteImpl in class Deviceregister - the register to write todata - an array containing the data to writeoffset - the offset within the array of the first byte to writelength - the number of bytes to writeIOException - if an error occurspublic void update()
throws IOException
Deviceupdate in class DeviceIOException - if an error occurspublic static void main(String[] args) throws IOException, InterruptedException
args - the argumentsIOException - if an error occursInterruptedException - if the thread is interruptedCopyright © 2017 freeutils.net. All rights reserved.