diff --git a/Software/Java8/GrovePi-dio/.classpath b/Software/Java8/GrovePi-dio/.classpath deleted file mode 100644 index 6d7587a8..00000000 --- a/Software/Java8/GrovePi-dio/.classpath +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Software/Java8/GrovePi-dio/.project b/Software/Java8/GrovePi-dio/.project deleted file mode 100644 index 441ebdfe..00000000 --- a/Software/Java8/GrovePi-dio/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - GrovePi-dio - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/Software/Java8/GrovePi-dio/.settings/org.eclipse.core.resources.prefs b/Software/Java8/GrovePi-dio/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index abdea9ac..00000000 --- a/Software/Java8/GrovePi-dio/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding/=UTF-8 diff --git a/Software/Java8/GrovePi-dio/.settings/org.eclipse.jdt.core.prefs b/Software/Java8/GrovePi-dio/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 714351ae..00000000 --- a/Software/Java8/GrovePi-dio/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/Software/Java8/GrovePi-dio/.settings/org.eclipse.m2e.core.prefs b/Software/Java8/GrovePi-dio/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1..00000000 --- a/Software/Java8/GrovePi-dio/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/Software/Java8/GrovePi-dio/pom.xml b/Software/Java8/GrovePi-dio/pom.xml deleted file mode 100644 index 0dbb483f..00000000 --- a/Software/Java8/GrovePi-dio/pom.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - 4.0.0 - org.iot.raspberry - GrovePi-dio - 0.1.0-SNAPSHOT - jar - - UTF-8 - 1.8 - 1.8 - - - - org.iot.raspberry - GrovePi-spec - 0.1.0-SNAPSHOT - - - jdk.dio - dio - 1.0 - - - - \ No newline at end of file diff --git a/Software/Java8/GrovePi-dio/src/main/java/org/iot/raspberry/grovepi/dio/GrovePiDio.java b/Software/Java8/GrovePi-dio/src/main/java/org/iot/raspberry/grovepi/dio/GrovePiDio.java deleted file mode 100644 index e6fe3fbc..00000000 --- a/Software/Java8/GrovePi-dio/src/main/java/org/iot/raspberry/grovepi/dio/GrovePiDio.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.iot.raspberry.grovepi.dio; - -import java.io.IOException; -import jdk.dio.DeviceManager; -import jdk.dio.i2cbus.I2CDevice; -import jdk.dio.i2cbus.I2CDeviceConfig; -import org.iot.raspberry.grovepi.GrovePi; -import org.iot.raspberry.grovepi.GrovePiSequence; -import org.iot.raspberry.grovepi.GrovePiSequenceVoid; -import org.iot.raspberry.grovepi.devices.GroveRgbLcd; - -/** - * Create a new GrovePi interface using the Device I/O - * - * @author Eduardo Moranchel - */ -public class GrovePiDio implements GrovePi { - - private final I2CDevice device; - - public GrovePiDio() throws IOException { - final int i2cBus = 1; // Raspberry Pi's I2C bus - final int address = 0x04; // Device address - final int serialClock = 3400000; // 3.4MHz Max clock - final int addressSizeBits = 7; // Device address size in bits - - I2CDeviceConfig config = new I2CDeviceConfig(i2cBus, address, addressSizeBits, serialClock); - device = DeviceManager.open(config); - - } - - @Override - public T exec(GrovePiSequence sequence) throws IOException { - synchronized (this) { - return sequence.execute(new IO(device)); - } - } - - @Override - public void execVoid(GrovePiSequenceVoid sequence) throws IOException { - synchronized (this) { - sequence.execute(new IO(device)); - } - } - - @Override - public void close() { - } - - @Override - public GroveRgbLcd getLCD() throws IOException { - return new GroveRgbLcdDIO(); - } - -} diff --git a/Software/Java8/GrovePi-dio/src/main/java/org/iot/raspberry/grovepi/dio/GroveRgbLcdDIO.java b/Software/Java8/GrovePi-dio/src/main/java/org/iot/raspberry/grovepi/dio/GroveRgbLcdDIO.java deleted file mode 100644 index 92c084fb..00000000 --- a/Software/Java8/GrovePi-dio/src/main/java/org/iot/raspberry/grovepi/dio/GroveRgbLcdDIO.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.iot.raspberry.grovepi.dio; - -import java.io.IOException; -import java.util.logging.Level; -import java.util.logging.Logger; -import jdk.dio.DeviceManager; -import jdk.dio.i2cbus.I2CDevice; -import jdk.dio.i2cbus.I2CDeviceConfig; -import org.iot.raspberry.grovepi.GrovePiSequenceVoid; -import org.iot.raspberry.grovepi.devices.GroveRgbLcd; - -public class GroveRgbLcdDIO extends GroveRgbLcd { - - private final I2CDevice rgb; - private final I2CDevice text; - - public GroveRgbLcdDIO() throws IOException { - final int i2cBus = 1; // Raspberry Pi's I2C bus - final int serialClock = 3400000; // 3.4MHz Max clock - final int addressSizeBits = 7; // Device address size in bits - - this.text = DeviceManager.open(new I2CDeviceConfig(i2cBus, DISPLAY_TEXT_ADDR, addressSizeBits, serialClock)); - - this.rgb = DeviceManager.open(new I2CDeviceConfig(i2cBus, DISPLAY_RGB_ADDR, addressSizeBits, serialClock)); - - init(); - } - - @Override - public void execRGB(GrovePiSequenceVoid sequence) throws IOException { - synchronized (this) { - sequence.execute(new IO(rgb)); - } - } - - @Override - public void execTEXT(GrovePiSequenceVoid sequence) throws IOException { - synchronized (this) { - sequence.execute(new IO(text)); - } - } - - @Override - public void close() { - try { - rgb.close(); - } catch (IOException ex) { - Logger.getLogger("GrovePi").log(Level.SEVERE, null, ex); - } - try { - text.close(); - } catch (IOException ex) { - Logger.getLogger("GrovePi").log(Level.SEVERE, null, ex); - } - } - -} diff --git a/Software/Java8/GrovePi-dio/src/main/java/org/iot/raspberry/grovepi/dio/IO.java b/Software/Java8/GrovePi-dio/src/main/java/org/iot/raspberry/grovepi/dio/IO.java deleted file mode 100644 index 30b57189..00000000 --- a/Software/Java8/GrovePi-dio/src/main/java/org/iot/raspberry/grovepi/dio/IO.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.iot.raspberry.grovepi.dio; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.Arrays; -import java.util.logging.Level; -import java.util.logging.Logger; -import jdk.dio.i2cbus.I2CDevice; -import org.iot.raspberry.grovepi.GroveIO; - -public class IO implements GroveIO { - - private final I2CDevice device; - - public IO(I2CDevice device) { - this.device = device; - } - - // IO - @Override - public void write(int... cmd) throws IOException { - ByteBuffer command = ByteBuffer.allocateDirect(cmd.length); - Arrays.stream(cmd).forEach((c) -> command.put((byte) c)); - command.rewind(); - Logger.getLogger("GrovePi").log(Level.INFO, "[DIO IO write]{0}", Arrays.toString(cmd)); - device.write(command); - } - - @Override - public int read() throws IOException { - final int read = device.read(); - Logger.getLogger("GrovePi").log(Level.INFO, "[DIO IO read]{0}", read); - return read; - } - - @Override - public byte[] read(byte[] buffer) throws IOException { - ByteBuffer bf = ByteBuffer.wrap(buffer); - bf.rewind(); - device.read(bf); - Logger.getLogger("GrovePi").log(Level.INFO, "[DIO IO read]{0}", buffer); - return buffer; - } - -} diff --git a/Software/Java8/examples/nbproject/project.properties b/Software/Java8/examples/nbproject/project.properties index 1ae8434e..bc66577c 100644 --- a/Software/Java8/examples/nbproject/project.properties +++ b/Software/Java8/examples/nbproject/project.properties @@ -29,15 +29,13 @@ dist.jar=${dist.dir}/examples.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= -file.reference.GrovePi-dio-0.1.0-SNAPSHOT.jar=..\\GrovePi-dio\\target\\GrovePi-dio-0.1.0-SNAPSHOT.jar file.reference.GrovePi-pi4j-0.1.0-SNAPSHOT.jar=..\\GrovePi-pi4j\\target\\GrovePi-pi4j-0.1.0-SNAPSHOT.jar file.reference.GrovePi-spec-0.1.0-SNAPSHOT.jar=..\\GrovePi-spec\\target\\GrovePi-spec-0.1.0-SNAPSHOT.jar includes=** jar.compress=false javac.classpath=\ ${file.reference.GrovePi-spec-0.1.0-SNAPSHOT.jar}:\ - ${file.reference.GrovePi-pi4j-0.1.0-SNAPSHOT.jar}:\ - ${file.reference.GrovePi-dio-0.1.0-SNAPSHOT.jar} + ${file.reference.GrovePi-pi4j-0.1.0-SNAPSHOT.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false diff --git a/Software/Java8/examples/src/org/iot/raspberry/examples/Runner.java b/Software/Java8/examples/src/org/iot/raspberry/examples/Runner.java index 7273f268..b336aa3d 100644 --- a/Software/Java8/examples/src/org/iot/raspberry/examples/Runner.java +++ b/Software/Java8/examples/src/org/iot/raspberry/examples/Runner.java @@ -11,7 +11,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.iot.raspberry.grovepi.GrovePi; -import org.iot.raspberry.grovepi.dio.GrovePiDio; import org.iot.raspberry.grovepi.pi4j.GrovePi4J; public class Runner { @@ -38,9 +37,6 @@ public static void main(String[] args) throws Exception { String mode = args[0]; GrovePi grovePi; switch (mode.toLowerCase()) { - case "dio": - grovePi = new GrovePiDio(); - break; case "pi4j": grovePi = new GrovePi4J(); break; diff --git a/Software/Java8/pom.xml b/Software/Java8/pom.xml index 173c14fd..20953df4 100644 --- a/Software/Java8/pom.xml +++ b/Software/Java8/pom.xml @@ -12,6 +12,5 @@ GrovePi-spec GrovePi-pi4j - GrovePi-dio \ No newline at end of file