pi-ssd1306-java
pi-ssd1306-java copied to clipboard
I2C initialize problem
- Field f = this.i2c.getClass().getDeclaredField("fd");
- f.setAccessible(true);
- this.fd = f.getInt(this.i2c);
+ this.fd = I2C.wiringPiI2CSetup(address);
+ if ( this.fd == -1 ){
+ throw new IOException("Unable to open device at address: " + address);
+ }
java.lang.NoSuchFieldException: fd
at java.lang.Class.getDeclaredField(Class.java:2070)
at eu.ondryaso.ssd1306.Display.
try i2c.write() instead ? fd is belong to LinuxFile (from RandomAccessFile) not I2cDevice.