X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fkaka%2Fcakelight%2FLedController.java;h=9a233316455128f2a6df18b922d8523898e996ea;hb=01ee91e7622bbdf6a940b2d8ca9efc1f133cbe97;hp=9749483cdc9246a98f66ecfdf79729c448ba64b9;hpb=03b67a7377d6d23d517d33e47f338bb7859596ed;p=kaka%2Fcakelight.git diff --git a/src/kaka/cakelight/LedController.java b/src/kaka/cakelight/LedController.java index 9749483..9a23331 100644 --- a/src/kaka/cakelight/LedController.java +++ b/src/kaka/cakelight/LedController.java @@ -1,10 +1,30 @@ package kaka.cakelight; -import java.util.function.Consumer; +import com.pi4j.io.spi.SpiChannel; +import com.pi4j.io.spi.SpiDevice; +import com.pi4j.io.spi.SpiFactory; -public class LedController implements Consumer { - @Override - public void accept(LedFrame ledFrame) { +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 } }