pi-ssd1306-java icon indicating copy to clipboard operation
pi-ssd1306-java copied to clipboard

I2C initialize problem

Open narise77 opened this issue 9 years ago • 2 comments

-        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);
+      }

narise77 avatar Jan 05 '17 09:01 narise77

java.lang.NoSuchFieldException: fd at java.lang.Class.getDeclaredField(Class.java:2070) at eu.ondryaso.ssd1306.Display.(Display.java:72) at eu.ondryaso.ssd1306.Display.(Display.java:106)

mkattner avatar Jul 09 '18 08:07 mkattner

try i2c.write() instead ? fd is belong to LinuxFile (from RandomAccessFile) not I2cDevice.

ShisanXing avatar May 20 '22 06:05 ShisanXing