import java.io.IOException;
public class LedController {
+ private SpiDevice spi;
+
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
- );
+ spi = SpiFactory.getInstance(SpiChannel.CS0);
} catch (IOException e) {
e.printStackTrace();
}
}
public void onFrame(LedFrame ledFrame) {
- // TODO
+ try {
+ spi.write(ledFrame.getBytes());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
}
}