Commit | Line | Data |
---|---|---|
03b67a73 TW |
1 | package kaka.cakelight; |
2 | ||
01ee91e7 TW |
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 | ||
d182b8cc | 9 | public 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 | 18 | spi = SpiFactory.getInstance(SpiChannel.CS0); |
01ee91e7 TW |
19 | } catch (IOException e) { |
20 | e.printStackTrace(); | |
21 | } | |
22 | } | |
23 | ||
d182b8cc | 24 | public void onFrame(LedFrame ledFrame) { |
6b569670 TW |
25 | try { |
26 | spi.write(ledFrame.getBytes()); | |
27 | } catch (IOException e) { | |
28 | e.printStackTrace(); | |
29 | } | |
03b67a73 TW |
30 | } |
31 | } |