Files
loopy_midi_controller/include/pixel_stomp_mux.h
T
ash 07e5cd8994 Rewrite MUX: WS2812C LEDs (NeoPixel) + 74HC165 buttons
PixelStomp MUX uses:
- WS2812C LEDs: one data line via DAT (GPIO 9), NeoPixel protocol
- 74HC165 shift register: LD/CLK/DI for reading 8 button states

Changes:
- Use Adafruit NeoPixel library for LED control
- Proper 74HC165 parallel-load shift-in for buttons
- 8 switches + 8 LEDs (was incorrectly 10)
- Diagnostic commands: dump, ledtest, red, green, blue, read
2026-06-23 13:38:51 +00:00

37 lines
723 B
C++

#pragma once
#include <cstdint>
#include <Adafruit_NeoPixel.h>
class PixelStompMux {
public:
static const uint8_t NUM_BUTTONS = 8;
static const uint8_t NUM_LEDS = 8;
PixelStompMux(uint8_t dat_pin, uint8_t ld_pin, uint8_t clk_pin, uint8_t di_pin);
void begin();
uint8_t read_buttons();
bool is_button_pressed(uint8_t index);
void set_led_color(uint8_t index, uint8_t r, uint8_t g, uint8_t b);
void set_led_brightness(uint8_t brightness);
void clear_all();
void show();
void dump();
private:
uint8_t pin_dat;
uint8_t pin_ld;
uint8_t pin_clk;
uint8_t pin_di;
Adafruit_NeoPixel* strip;
uint8_t last_button_state;
uint8_t shift_in_74hc165();
};