Added an Ant build file and a small SPI test
[kaka/cakelight.git] / src / kaka / cakelight / LedController.java
index 201644d..9a23331 100644 (file)
@@ -1,6 +1,29 @@
 package kaka.cakelight;
 
+import com.pi4j.io.spi.SpiChannel;
+import com.pi4j.io.spi.SpiDevice;
+import com.pi4j.io.spi.SpiFactory;
+
+import java.io.IOException;
+
 public class LedController {
+    public static void main(String args[]) {
+        new LedController(null);
+    }
+
+    public LedController(Configuration config) {
+        try {
+            SpiDevice spi = SpiFactory.getInstance(SpiChannel.CS0);
+            spi.write(
+                    (byte)0xff, (byte)0x0, (byte)0x0,
+                    (byte)0x00, (byte)0xff, (byte)0x0,
+                    (byte)0x0, (byte)0x00, (byte)0xff
+            );
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
     public void onFrame(LedFrame ledFrame) {
        // TODO
     }