[+] Light strip

This commit is contained in:
Hykilpikonna
2023-04-21 17:29:15 -04:00
parent 5103d75c51
commit 0f2ae62247
2 changed files with 20 additions and 2 deletions
+12 -2
View File
@@ -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;
+8
View File
@@ -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)