Add expression pedal support on GPIO5 (CC 4)
This commit is contained in:
+11
-1
@@ -10,6 +10,7 @@
|
||||
#include "led_stub.h"
|
||||
#include "switch_stub.h"
|
||||
#include "app_task.h"
|
||||
#include "expression_pedal.h"
|
||||
|
||||
PixelStompMux mux(12, 10, 11, 9);
|
||||
|
||||
@@ -18,6 +19,7 @@ DefaultSwitchStub switch_driver;
|
||||
UsbMidiTransport midi_transport;
|
||||
|
||||
AppTask controller(&led_driver, &switch_driver, &midi_transport);
|
||||
ExpressionPedal exp_pedal(5);
|
||||
|
||||
TaskHandle_t midi_task_handle = NULL;
|
||||
|
||||
@@ -26,6 +28,7 @@ void midi_task(void* parameter) {
|
||||
|
||||
while (true) {
|
||||
midi_transport.update();
|
||||
exp_pedal.update(midi_transport);
|
||||
vTaskDelay(1);
|
||||
}
|
||||
}
|
||||
@@ -83,6 +86,9 @@ void handle_serial_command(const String& cmd) {
|
||||
mux.set_led_color(1, 255, 255, 255);
|
||||
mux.show();
|
||||
Serial.println("[CMD] Pixel 1 WHITE (max brightness)");
|
||||
} else if (cmd == "exp") {
|
||||
uint16_t raw = analogRead(5);
|
||||
Serial.printf("[CMD] EXP GPIO5 ADC=%d MIDI=%d\n", raw, exp_pedal.get_value());
|
||||
} else if (cmd == "usb") {
|
||||
Serial.printf("[CMD] USB mounted: %s\n", TinyUSBDevice.mounted() ? "YES" : "NO");
|
||||
Serial.printf("[CMD] USB ready: %s\n", TinyUSBDevice.ready() ? "YES" : "NO");
|
||||
@@ -126,6 +132,7 @@ void handle_serial_command(const String& cmd) {
|
||||
Serial.println(" read - raw button read");
|
||||
Serial.println(" red/green/blue - solid colour");
|
||||
Serial.println(" pixel0/pixel1 - single pixel test");
|
||||
Serial.println(" exp - expression pedal ADC/MIDI value");
|
||||
Serial.println(" usb - USB connection status and descriptor info");
|
||||
Serial.println(" gpiotest - raw GPIO pin diagnostic");
|
||||
Serial.println(" rawled - bit-bang WS2812 (no library)");
|
||||
@@ -328,7 +335,7 @@ void setup() {
|
||||
|
||||
Serial.println("=================================");
|
||||
Serial.println(" Loopy MIDI Controller v0.1");
|
||||
Serial.println(" Phase 1: USB MIDI");
|
||||
Serial.println(" Phase 1: USB MIDI + Expression Pedal");
|
||||
Serial.println(" Board: ESP32-S3-WROOM-1");
|
||||
Serial.println("=================================");
|
||||
|
||||
@@ -346,6 +353,9 @@ void setup() {
|
||||
Serial.println("[INIT] Initializing USB MIDI...");
|
||||
midi_transport.begin();
|
||||
|
||||
Serial.println("[INIT] Initializing Expression Pedal...");
|
||||
exp_pedal.begin();
|
||||
|
||||
Serial.println("[INIT] Registering MIDI callbacks...");
|
||||
controller.begin();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user