-public class LedController implements Consumer<LedFrame> {
- @Override
- public void accept(LedFrame ledFrame) {
- // TODO
+import java.io.IOException;
+
+public class LedController {
+ private SpiDevice spi;
+
+ public static void main(String args[]) {
+ new LedController(null);
+ }
+
+ public LedController(Configuration config) {
+ try {
+ spi = SpiFactory.getInstance(SpiChannel.CS0);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void onFrame(LedFrame ledFrame) {
+ try {
+ spi.write(ledFrame.getBytes());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }