@@ -29,33 +29,14 @@ public class I2CFactory {
2929 */
3030 public static I2CBus getInstance (int busNumber ) throws IOException {
3131
32- /*
33- * String architecture = Platform.getArch(); try { String I2CBusType =
34- * "org.myrobotlab.i2c.I2CBusProxy"; if
35- * (architecture.equals(Platform.ARCH_ARM)) { // raspi I2CBusType =
36- * "com.pi4j.io.i2c.impl.I2CBusImpl"; }
37- *
38- * Object[] param = new Object[0];
39- *
40- * Class<?> c; c = Class.forName(I2CBusType); Class<?>[] paramTypes = new
41- * Class[param.length]; for (int i = 0; i < param.length; ++i) {
42- * paramTypes[i] = param[i].getClass(); } Constructor<?> mc =
43- * c.getConstructor(paramTypes); return (I2CBus) mc.newInstance(param); }
44- * catch (Exception e) { Logging.logException(e); return null; }
45- */
4632 // pi4j's factory calls the implementation directly
4733 // which would not be my first choice - but since it does
4834 // I will do the same here... otherwise I'll need to invoke
4935 // without an interface
5036 Platform platform = Platform .getLocalInstance ();
5137
5238 if (platform .isArm ()) {
53- // raspi
54- // TODO: fix this!!!
55- // log.warn("This probable doesn't work for ARM / RasPI now.. update the
56- // code!");
57- // return I2CBusImpl.getBus(busNumber);
58- // return null;
39+
5940 try {
6041 return provider .getBus (busNumber , DEFAULT_LOCKAQUIRE_TIMEOUT , DEFAULT_LOCKAQUIRE_TIMEOUT_UNITS );
6142 } catch (UnsupportedBusNumberException e ) {
@@ -66,13 +47,6 @@ public static I2CBus getInstance(int busNumber) throws IOException {
6647 } else {
6748 return I2CProxyImpl .getBus (busNumber );
6849 }
69-
70- // return I2CBusImpl.getBus(busNumber);
71- }
72-
73- public static void main (String [] args ) {
74- // TODO Auto-generated method stub
75-
7650 }
7751
7852}
0 commit comments