Dolda2000 GitWeb
/
kaka
/
cakelight.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Register and use commands
[kaka/cakelight.git]
/
src
/
kaka
/
cakelight
/
LedController.java
diff --git
a/src/kaka/cakelight/LedController.java
b/src/kaka/cakelight/LedController.java
index
9a23331
..
559719a
100644
(file)
--- a/
src/kaka/cakelight/LedController.java
+++ b/
src/kaka/cakelight/LedController.java
@@
-7,24
+7,25
@@
import com.pi4j.io.spi.SpiFactory;
import java.io.IOException;
public class LedController {
import java.io.IOException;
public class LedController {
+ private SpiDevice spi;
+
public static void main(String args[]) {
new LedController(null);
}
public LedController(Configuration config) {
try {
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) {
} catch (IOException e) {
e.printStackTrace();
}
}
public void onFrame(LedFrame ledFrame) {
- // TODO
+ try {
+ spi.write(ledFrame.getBytes());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
}
}
}
}