Only pass console to command on activate
[kaka/cakelight.git] / src / kaka / cakelight / LedController.java
1 package kaka.cakelight;
2
3 import com.pi4j.io.spi.SpiChannel;
4 import com.pi4j.io.spi.SpiDevice;
5 import com.pi4j.io.spi.SpiFactory;
6
7 import java.io.IOException;
8
9 public class LedController {
10     private SpiDevice spi;
11
12     public static void main(String args[]) {
13         new LedController(null);
14     }
15
16     public LedController(Configuration config) {
17         try {
18             spi = SpiFactory.getInstance(SpiChannel.CS0);
19         } catch (IOException e) {
20             e.printStackTrace();
21         }
22     }
23
24     public void onFrame(LedFrame ledFrame) {
25         try {
26             spi.write(ledFrame.getBytes());
27         } catch (IOException e) {
28             e.printStackTrace();
29         }
30     }
31 }