1 package kaka.cakelight.mode;
3 import kaka.cakelight.Configuration;
4 import kaka.cakelight.LedFrame;
6 import java.util.function.Consumer;
8 public abstract class Mode {
9 private Consumer<LedFrame> frameListener;
11 public abstract void enter(Configuration config);
12 public abstract void exit();
14 public void setFrameListener(Consumer<LedFrame> listener) {
15 frameListener = listener;
18 public void updateWithFrame(LedFrame frame) {
19 assert frameListener != null;
20 frameListener.accept(frame);