Add MIDI clock-driven LED pulsing

- New MidiClock module: tracks 24 PPQN clock ticks, computes beat phase
  and smooth sine pulse from incoming MIDI Clock (0xF8)
- midi_transport: detect CIN=0xF real-time packets, route 0xF8 to
  MidiClock::tick(), 0xFA/FB to start(), 0xFC to stop()
- led_stub update(): every 20ms, modulates active LED brightness
  using pulse curve (50%-100%), pixel 6 always throbs when clock
  is running even if no loops active
- Aligned set_led_state() all paths to use pad_base_colors
- Removed dead activity flash code
This commit is contained in:
ash
2026-07-02 07:15:53 +00:00
parent 06479f0ca2
commit 5dc10eea87
5 changed files with 118 additions and 17 deletions
-2
View File
@@ -33,8 +33,6 @@ private:
static const uint8_t NUM_LEDS = 10;
LedState led_states[NUM_LEDS];
bool initialized;
uint32_t activity_off_time = 0;
uint8_t saved_r = 0, saved_g = 0, saved_b = 0;
public:
DefaultLedStub();
+19
View File
@@ -0,0 +1,19 @@
#pragma once
#include <cstdint>
class MidiClock {
public:
static void tick();
static void start();
static void stop();
static float get_phase();
static float get_pulse();
static bool is_running();
private:
static uint32_t last_tick_time;
static uint32_t tick_count;
static float tick_interval_ms;
static bool running;
static const uint8_t TICKS_PER_BEAT = 24;
};