Added a draft for an ambient mode
[kaka/cakelight.git] / src / kaka / cakelight / LedController.java
CommitLineData
03b67a73
TW
1package kaka.cakelight;
2
01ee91e7
TW
3import com.pi4j.io.spi.SpiChannel;
4import com.pi4j.io.spi.SpiDevice;
5import com.pi4j.io.spi.SpiFactory;
6
7import java.io.IOException;
8
d182b8cc 9public class LedController {
6b569670
TW
10 private SpiDevice spi;
11
01ee91e7
TW
12 public static void main(String args[]) {
13 new LedController(null);
14 }
15
16 public LedController(Configuration config) {
17 try {
6b569670
TW
18 spi = SpiFactory.getInstance(SpiChannel.CS0);
19// spi.write(
20// (byte)0xff, (byte)0x0, (byte)0x0,
21// (byte)0x00, (byte)0xff, (byte)0x0,
22// (byte)0x0, (byte)0x00, (byte)0xff
23// );
01ee91e7
TW
24 } catch (IOException e) {
25 e.printStackTrace();
26 }
27 }
28
d182b8cc 29 public void onFrame(LedFrame ledFrame) {
6b569670
TW
30 try {
31 spi.write(ledFrame.getBytes());
32 } catch (IOException e) {
33 e.printStackTrace();
34 }
03b67a73
TW
35 }
36}