From 0f2ae62247662ed7077c1c2cdb0aba621b95b699 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Fri, 21 Apr 2023 17:29:15 -0400 Subject: [PATCH] [+] Light strip --- firmware/src/config.h | 14 ++++++++++++-- firmware/src/main.cpp | 8 ++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/firmware/src/config.h b/firmware/src/config.h index f916d1b..1032a84 100644 --- a/firmware/src/config.h +++ b/firmware/src/config.h @@ -2,7 +2,7 @@ #define FIRMWARE_CONFIG_H // ======================================== -// Pin Configuration +// Main Keyboard Pin Configuration // ======================================== // LED indicator for pulling update @@ -18,11 +18,21 @@ const int MUX_IN[NUM_MUX] = {4, 5, 6, 7, 8}; const int NUM_MUX_SEL = 4; const int MUX_SEL_OUT[NUM_MUX_SEL] = {14, 13, 12, 11}; +// LED Light strip +const int LK_PIN = 2; +const int LK_LIGHTS_PER_METER = 60; +const float LK_NUM_METERS = 2; +const int LK_NUM_LIGHTS = (int) round(LK_LIGHTS_PER_METER * LK_NUM_METERS); + +// ======================================== +// MIDI Panel Pin Configuration +// ======================================== + // 3 1:8 Multiplexers for the midi panel const int P_PINS_PER_MUX = 8; const int P_KEY_MUX_IN = 36; const int P_BUTTON_MUX_IN = 35; // Digital signal inputs for button multiplexers -const int P_KNOB_MUX_IN = 2; // Analog signal inputs for potentiometer +const int P_KNOB_MUX_IN = 10; // Analog signal inputs for potentiometer // Select pins for every multiplexer, each multiplexer has 3 select pins const int P_NUM_MUX_SEL = 3; diff --git a/firmware/src/main.cpp b/firmware/src/main.cpp index d6891f1..e667f31 100644 --- a/firmware/src/main.cpp +++ b/firmware/src/main.cpp @@ -50,6 +50,7 @@ void pinModeSafe(int pin, int mode) Adafruit_NeoPixel p_led_key(4, P_LED_KEY, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel p_led_knob(9, P_LED_KNOB, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel p_led_rotary(9, P_LED_ROTARY, NEO_GRB + NEO_KHZ800); +Adafruit_NeoPixel lk(LK_NUM_LIGHTS, LK_PIN, NEO_GRB + NEO_KHZ800); u64 fps_time_counter = 0; u32 fps_updates = 0; @@ -71,6 +72,7 @@ void setup() { // Initialize pins pinModeSafe(LED_REFRESH, OUTPUT); + pinModeSafe(LK_PIN, OUTPUT); for (int pin: MUX_IN) pinModeSafe(pin, INPUT); for (int pin: MUX_SEL_OUT) pinModeSafe(pin, OUTPUT); for (int pin: P_MUX_SEL_OUT) pinModeSafe(pin, OUTPUT); @@ -245,6 +247,11 @@ void readPanel() } } + for (int i = 0; i < LK_NUM_LIGHTS; i++) + { + lk.setPixelColor(i, Adafruit_NeoPixel::ColorHSV(last_hue + i * hue_interval, 255, brightness)); + } + // for (int i = 0; i < 9; i++) // { // p_led_key.setPixelColor(i, Adafruit_NeoPixel::ColorHSV(last_hue + i * hue_interval, 255, brightness)); @@ -256,6 +263,7 @@ void readPanel() p_led_key.show(); p_led_knob.show(); p_led_rotary.show(); + lk.show(); } [[noreturn]] void loopPanel(void* pvParameters)