about summary refs log tree commit diff
path: root/LEDs.ino
diff options
context:
space:
mode:
authorJared DeCook <jared@shapingthesilence.com>2022-11-19 17:51:34 -0500
committerZach DeCook <zachdecook@librem.one>2022-11-19 17:51:34 -0500
commit37cb602acfc6e28dbd163071ecc77d1d362ab1f8 (patch)
tree11b110182340fe2097b1a5eb888ed17a7f452354 /LEDs.ino
parent51cd1b7953145134b387ecf6b3606b4257c2b9a7 (diff)
downloadHexBoard-37cb602acfc6e28dbd163071ecc77d1d362ab1f8.tar.gz
v1.1 WIP
Diffstat (limited to 'LEDs.ino')
-rw-r--r--LEDs.ino38
1 files changed, 38 insertions, 0 deletions
diff --git a/LEDs.ino b/LEDs.ino
new file mode 100644
index 0000000..5b72b65
--- /dev/null
+++ b/LEDs.ino
@@ -0,0 +1,38 @@
+void setOctLED() {
+  if (octave <= 0) {
+    strip.setPixelColor(octUpSW, 120, 0, 120);
+    strip.setPixelColor(octDnSW, 0, 0, 0);  // No lower to go.
+  } else if (octave <= 12) {
+    strip.setPixelColor(octUpSW, 0, 0, 120);
+    strip.setPixelColor(octDnSW, 120, 0, 0);
+  } else if (octave <= 24) {
+    strip.setPixelColor(octUpSW, 0, 0, 0);  //No higher to go.
+    strip.setPixelColor(octDnSW, 120, 0, 120);
+  }
+}
+
+void setLayoutLEDs() {
+  for (int i = 0; i < elementCount; i++) {
+    if (currentLayout[i] <= 127) {
+      setLayoutLED(i);
+    }
+  }
+}
+void setLayoutLED(int i) {
+  strip.setPixelColor(i, strip.ColorHSV((currentLayout[i] % 12) * 5006, 255, 120));
+  // black keys darker
+  if (blackKeys) {
+    // LEET programmers stuff
+    switch (currentLayout[i] % 12) {
+      // If it is one of the black keys, fall through to case 10.
+      case 1:
+      case 3:
+      case 6:
+      case 8:
+      // bitshift by 2 (efficient division by four)
+      case 10: strip.setPixelColor(i, strip.ColorHSV((currentLayout[i] % 12) * 5006, 255, 30)); break;
+      // otherwise it was a white key. Do nothing
+      default: break;
+    }
+  }
+}
\ No newline at end of file