1 package kaka.cakelight;
3 public class CakeLight {
4 private Configuration config;
6 private LedController ledController;
8 public CakeLight(Configuration config, LedController ledController) {
10 this.ledController = ledController;
11 Color.calculateGammaCorrection(config.gamma);
14 public void setMode(Mode mode) {
17 mode.setFrameListener(ledController::onFrame);
21 public void cleanup() {
22 if (this.mode != null) {
27 public void startLoop() {
28 Console.start(this, config);
30 // FrameGrabber grabber = FrameGrabber.from(config);
32 // Frame frame = grabber.grabFrame();
34 // for (int i = 0; i < 100; i++) {
35 // time += timeIt("frame", () -> grabber.grabFrame());
37 // System.out.println("time = " + time);
39 // byte[] data = frame.getData();
40 // saveFile(data, "/home/kaka/test.img");
43 public void turnOff() {
45 ledController.onFrame(LedFrame.from(config));