Added support for APA102 LED strips
[kaka/cakelight.git] / src / kaka / cakelight / Configuration.java
index 86ade8e..21c2072 100644 (file)
@@ -98,14 +98,27 @@ public class Configuration {
     public class LedConfiguration {
         public int cols;
         public int rows;
+        public LedType type;
 
         private LedConfiguration(Properties prop) {
             cols = Integer.parseInt(get(prop, "leds.cols"));
             rows = Integer.parseInt(get(prop, "leds.rows"));
+            switch (get(prop, "leds.type", "").toUpperCase()) {
+                case "WS2801":
+                    type = LedType.WS2801;
+                    break;
+                case "APA102":
+                default:
+                    type = LedType.APA102;
+            }
         }
 
         public int getCount() {
             return cols * 2 + rows * 2;
         }
     }
+
+    public enum LedType {
+        WS2801, APA102
+    }
 }