From b578f253653e1c378b13a6f5f09e2a6720347d8b Mon Sep 17 00:00:00 2001 From: Enoch Date: Tue, 23 Jun 2026 00:05:00 -0500 Subject: [PATCH 1/5] add in splash screen and main ui --- images/Keyboard-Keyboard-Spritesheet.raw | Bin 0 -> 2048 bytes keyboard_keyboard/code/src/constants.rs | 33 +++--- keyboard_keyboard/code/src/display.rs | 20 ---- keyboard_keyboard/code/src/display/mod.rs | 8 ++ keyboard_keyboard/code/src/display/screens.rs | 104 ++++++++++++++++++ keyboard_keyboard/code/src/main.rs | 99 +++++++++++------ keyboard_keyboard/code/src/types.rs | 22 ++++ 7 files changed, 220 insertions(+), 66 deletions(-) create mode 100644 images/Keyboard-Keyboard-Spritesheet.raw delete mode 100644 keyboard_keyboard/code/src/display.rs create mode 100644 keyboard_keyboard/code/src/display/mod.rs create mode 100644 keyboard_keyboard/code/src/display/screens.rs diff --git a/images/Keyboard-Keyboard-Spritesheet.raw b/images/Keyboard-Keyboard-Spritesheet.raw new file mode 100644 index 0000000000000000000000000000000000000000..431def0b8a621c587ea77298d98666c7aa4f3e9a GIT binary patch literal 2048 zcmeHH&ubG=5T3ZT8=M>?%nu6$QZtJ+@dpND3`d8f5FPSQ_ZT zK&|MZ(2IBw#Q(rVBj#A7haMENwTIknY_V>d%^T-sn>5Kk;H3lad-Kh&H#_gK03D)X zi#PyA3q=ONlz=w{hUjRXvXll-s~ZJVZ~{4b0%VWvhjF2l6CELM$9h6rWxqU;FIbW- zrk!pj_}fwr?w@ckn>P0m~$Rd~#SXVg_q#!l#@k(G|a0 z`c^dNvY3&!t)pbpq)ZMHiLvk1&A#d!8Xvkzp{w9}+Cc~pm?i=?8lF=2j8Gla+ zr6No5(6*aD9rp&NhlU@Ho^yHd3k39V|3QPp0$9ng@Au+m*H1@ZO@>cdje0;gl?1U_ zpSJ^@{dRs2k7@Z{pwdfk41R$9a)fU*!nX$BDl3wPNUGIOK-}jaL`I5r!sQ@SW29O_ zomWA===vM;YWVpfG<9g?^B%aUTHVnG#rd)#K97{|7_OOA&i^D1`J()2wRC=Yw!xQ2 qFRhj)muDOCuP0uZKW7Su(TJ-v8=RNh|08bgV?3U~@dW (&'static str, i8) { + (NOTE_NAMES[(midi % 12) as usize], (midi / 12) as i8 - 1) +} diff --git a/keyboard_keyboard/code/src/display/screens.rs b/keyboard_keyboard/code/src/display/screens.rs new file mode 100644 index 0000000..882ba43 --- /dev/null +++ b/keyboard_keyboard/code/src/display/screens.rs @@ -0,0 +1,104 @@ +use crate::display::note_name; +use crate::types::{DisplayState, LastEvent, LcdDisplay}; +use core::fmt::Write; +use embedded_graphics::{ + image::{Image, ImageRawBE}, + mono_font::{ + ascii::{FONT_10X20, FONT_6X9}, + MonoTextStyle, + }, + pixelcolor::BinaryColor, + prelude::*, + primitives::Rectangle, + text::{Alignment, Text}, +}; +use heapless::String; + +const SPRITE_ATLAS: &[u8] = + include_bytes!("../../../../images/Keyboard-Keyboard-Spritesheet.raw"); + +pub fn draw_splash(disp: &mut LcdDisplay) { + disp.clear(); + let atlas = ImageRawBE::::new(SPRITE_ATLAS, 128); + let splash = atlas.sub_image(&Rectangle::new(Point::new(0, 0), Size::new(128, 32))); + Image::new(&splash, Point::new(0, 0)).draw(disp).ok(); + disp.flush().ok(); +} + +pub fn draw_main(disp: &mut LcdDisplay, state: &DisplayState) { + disp.clear(); + + let atlas = ImageRawBE::::new(SPRITE_ATLAS, 128); + + // Background from atlas rows 32–63 + let bg = atlas.sub_image(&Rectangle::new(Point::new(0, 32), Size::new(128, 32))); + Image::new(&bg, Point::new(0, 0)).draw(disp).ok(); + + // All text is Off (dark on the light background) + let center = Point::new(64, 16); + let off = BinaryColor::Off; + + // Small label above center: note name+octave ("C4") or CC number ("CC 12") + let mut label: String<16> = String::new(); + // Large value in center: MIDI note number ("60") or CC value ("127") + let mut number: String<8> = String::new(); + + match state.last_event { + Some(LastEvent::Note { note }) => { + let (name, oct) = note_name(note); + write!(label, "{}{}", name, oct).ok(); + write!(number, "{}", note).ok(); + } + Some(LastEvent::Cc { num, value }) => { + write!(label, "CC {}", num).ok(); + write!(number, "{}", value).ok(); + } + Some(LastEvent::Clear) | None => {} + } + + if !label.is_empty() { + Text::with_alignment( + label.as_str(), + center + Point::new(0, -8), + MonoTextStyle::new(&FONT_6X9, off), + Alignment::Center, + ) + .draw(disp) + .ok(); + } + + if !number.is_empty() { + Text::with_alignment( + number.as_str(), + center + Point::new(0, 12), + MonoTextStyle::new(&FONT_10X20, off), + Alignment::Center, + ) + .draw(disp) + .ok(); + } + + // Keys channel — top-left + let mut keys_ch: String<4> = String::new(); + write!(keys_ch, "{}", state.melody_channel + 1).ok(); + Text::with_alignment( + keys_ch.as_str(), + center + Point::new(-42, -9), + MonoTextStyle::new(&FONT_6X9, off), + Alignment::Center, + ) + .draw(disp) + .ok(); + + // Drums channel — top-right, always 10 + Text::with_alignment( + "10", + center + Point::new(54, -9), + MonoTextStyle::new(&FONT_6X9, off), + Alignment::Center, + ) + .draw(disp) + .ok(); + + disp.flush().ok(); +} diff --git a/keyboard_keyboard/code/src/main.rs b/keyboard_keyboard/code/src/main.rs index 3fdba60..486bb32 100644 --- a/keyboard_keyboard/code/src/main.rs +++ b/keyboard_keyboard/code/src/main.rs @@ -25,7 +25,7 @@ mod app { }; use crate::midi::MidiSender; use crate::switch::{ChannelFilter, SwitchEvent, SwitchState}; - use crate::types::LcdDisplay; + use crate::types::{DisplayState, LastEvent, LcdDisplay}; use libdaisy::gpio::*; use libdaisy::logger; @@ -60,6 +60,7 @@ mod app { baselines: [u16; NUM_SWITCHES], event_queue: heapless::spsc::Queue<(usize, SwitchEvent), 64>, midi_tx_flag: bool, + display_state: DisplayState, } // ── Local resources ─────────────────────────────────────────────────────── @@ -310,7 +311,7 @@ mod app { ) .into_buffered_graphics_mode(), ); - display_init::spawn().ok(); + display_update::spawn().ok(); set_mux_channel(0, &mut s0, &mut s1, &mut s2); info!( @@ -325,6 +326,7 @@ mod app { baselines, event_queue: heapless::spsc::Queue::new(), midi_tx_flag: false, + display_state: DisplayState::new(), }, Local { audio: system.audio, @@ -367,18 +369,25 @@ mod app { } // Priority 1 — below process_events so a slow display never blocks key events. - #[task(local = [display], priority = 1)] - fn display_init(ctx: display_init::Context) { + // First spawn: init hardware + show splash. Subsequent spawns: redraw main screen. + #[task(local = [display, initialized: bool = false], shared = [display_state], priority = 1, capacity = 2)] + fn display_update(mut ctx: display_update::Context) { let Some(disp) = ctx.local.display.as_mut() else { return; }; - match disp.init() { - Ok(()) => { - crate::display::draw_startup(disp); - info!("display ok"); + if !*ctx.local.initialized { + match disp.init() { + Ok(()) => { + *ctx.local.initialized = true; + crate::display::draw_splash(disp); + info!("display ok"); + } + Err(_) => warn!("display not found"), } - Err(_) => warn!("display not found"), + return; } + let state = ctx.shared.display_state.lock(|s| *s); + crate::display::draw_main(disp, &state); } #[task(binds = DMA1_STR1, priority = 8, local = [audio])] @@ -443,6 +452,9 @@ mod app { ctx.shared.switch_states.lock(|states| { for (switch_idx, &(mux, ch)) in SWITCH_MAP.iter().enumerate() { + if DISABLED_SWITCHES.contains(&switch_idx) { + continue; + } let raw = ctx.local.mux_raw[mux as usize][ch as usize]; let filtered = ctx.local.filters[switch_idx].feed(raw); @@ -509,27 +521,27 @@ mod app { } // ── Vibrato → CC1 (dead zone + rate-limited) ────────────────────────── - if now % VIBRATO_INTERVAL_MS == 0 { - let max_delta = vib_filt_a - .abs_diff(baselines[VIBRATO_A]) - .max(vib_filt_b.abs_diff(baselines[VIBRATO_B])) - .saturating_sub(VIBRATO_DEAD_ZONE); - let cc_val = - ((max_delta.min(VIBRATO_MAX_DELTA) as u32 * 127 / VIBRATO_MAX_DELTA as u32) as u8) - .min(127); - if cc_val.abs_diff(*ctx.local.last_vibrato_cc) >= VIBRATO_HYSTERESIS { - *ctx.local.last_vibrato_cc = cc_val; - pending - .push(( - 0, - SwitchEvent::PotChange { - cc: 1, - value: cc_val, - }, - )) - .ok(); - } - } + // if now % VIBRATO_INTERVAL_MS == 0 { + // let max_delta = vib_filt_a + // .abs_diff(baselines[VIBRATO_A]) + // .max(vib_filt_b.abs_diff(baselines[VIBRATO_B])) + // .saturating_sub(VIBRATO_DEAD_ZONE); + // let cc_val = + // ((max_delta.min(VIBRATO_MAX_DELTA) as u32 * 127 / VIBRATO_MAX_DELTA as u32) as u8) + // .min(127); + // if cc_val.abs_diff(*ctx.local.last_vibrato_cc) >= VIBRATO_HYSTERESIS { + // *ctx.local.last_vibrato_cc = cc_val; + // pending + // .push(( + // 0, + // SwitchEvent::PotChange { + // cc: 1, + // value: cc_val, + // }, + // )) + // .ok(); + // } + // } // ── Pot scan (100 Hz) ───────────────────────────────────────────────── if now % POT_SCAN_MS == 0 { @@ -537,7 +549,8 @@ mod app { set_mux_channel(mux_ch as usize, ctx.local.s0, ctx.local.s1, ctx.local.s2); set_decoder(dec_idx, ctx.local.enb_a, ctx.local.enb_b, ctx.local.enb_c); cortex_m::asm::delay(480 * 5); - let cc_val = (ctx.local.adc.read(ctx.local.adc_pin_a11).unwrap_or(0u32) >> 5) as u8; + let raw = ctx.local.adc.read(ctx.local.adc_pin_a11).unwrap_or(0u32); + let cc_val = (POT_ADC_MAX.saturating_sub(raw) * 127 / POT_ADC_MAX).min(127) as u8; if cc_val.abs_diff(ctx.local.pot_last_cc[pot_idx]) >= POT_CC_HYSTERESIS { ctx.local.pot_last_cc[pot_idx] = cc_val; pending @@ -589,13 +602,16 @@ mod app { // ── MIDI output ─────────────────────────────────────────────────────────── #[task( - shared = [event_queue, midi_tx_flag], + shared = [event_queue, midi_tx_flag, display_state], local = [midi_sender, melody_channel], priority = 2, capacity = 32 )] fn process_events(mut ctx: process_events::Context) { let mut did_send = false; + let mut new_display_event: Option = None; + let mut melody_changed = false; + ctx.shared.event_queue.lock(|queue| { while let Some((switch_idx, event)) = queue.dequeue() { if switch_idx == SETTINGS_CHAN1 || switch_idx == SETTINGS_CHAN2 { @@ -603,6 +619,7 @@ mod app { *ctx.local.melody_channel = if switch_idx == SETTINGS_CHAN1 { 0 } else { 1 }; info!("melody ch → {}", *ctx.local.melody_channel + 1); + melody_changed = true; } continue; } @@ -630,14 +647,17 @@ mod app { velocity ); ctx.local.midi_sender.note_on(note, velocity); + new_display_event = Some(LastEvent::Note { note }); } SwitchEvent::NoteOff => { info!("NoteOff HE{} ch={} note={}", he, channel + 1, note); ctx.local.midi_sender.note_off(note, 0); + new_display_event = Some(LastEvent::Clear); } SwitchEvent::PotChange { cc, value } => { info!("CC{} = {}", cc, value); ctx.local.midi_sender.control_change(cc, value); + new_display_event = Some(LastEvent::Cc { num: cc, value }); } SwitchEvent::PitchBend { value } => { info!("PitchBend value={}", value); @@ -647,6 +667,21 @@ mod app { did_send = true; } }); + + if new_display_event.is_some() || melody_changed { + ctx.shared.display_state.lock(|s| { + match new_display_event { + Some(LastEvent::Clear) => s.last_event = None, + Some(ev) => s.last_event = Some(ev), + None => {} + } + if melody_changed { + s.melody_channel = *ctx.local.melody_channel; + } + }); + display_update::spawn().ok(); + } + if did_send { ctx.shared.midi_tx_flag.lock(|f| *f = true); } diff --git a/keyboard_keyboard/code/src/types.rs b/keyboard_keyboard/code/src/types.rs index 5600f7e..25784cd 100644 --- a/keyboard_keyboard/code/src/types.rs +++ b/keyboard_keyboard/code/src/types.rs @@ -10,3 +10,25 @@ pub type LcdDisplay = Ssd1306< DisplaySize128x32, BufferedGraphicsMode, >; + +#[derive(Clone, Copy)] +pub enum LastEvent { + Note { note: u8 }, + Cc { num: u8, value: u8 }, + Clear, +} + +#[derive(Clone, Copy)] +pub struct DisplayState { + pub last_event: Option, + pub melody_channel: u8, +} + +impl DisplayState { + pub const fn new() -> Self { + Self { + last_event: None, + melody_channel: 0, + } + } +} From 76039531d08e7be5d40df6666725db25c4e7e6de Mon Sep 17 00:00:00 2001 From: Enoch Date: Tue, 23 Jun 2026 00:05:46 -0500 Subject: [PATCH 2/5] oosp --- keyboard_keyboard/code/src/constants.rs | 8 ++--- keyboard_keyboard/code/src/main.rs | 42 ++++++++++++------------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/keyboard_keyboard/code/src/constants.rs b/keyboard_keyboard/code/src/constants.rs index d29d3a7..e68951c 100644 --- a/keyboard_keyboard/code/src/constants.rs +++ b/keyboard_keyboard/code/src/constants.rs @@ -10,7 +10,6 @@ pub const FIRST_DELTA: u16 = 150; pub const SECOND_DELTA: u16 = 250; pub const RELEASE_DELTA: u16 = 100; pub const DEBOUNCE_TICKS: u8 = 3; -pub const RETRIGGER_LOCKOUT_MS: u32 = 250; // after NoteOff, ignore re-triggers for this long pub const FILTER_SIZE: usize = 4; pub const FILTER_SHIFT: u32 = 2; @@ -18,12 +17,9 @@ pub const FILTER_SHIFT: u32 = 2; pub const VELOCITY_WINDOW_MS: u32 = 80; pub const CALIBRATION_SAMPLES: usize = 64; -pub const DIAG_LOGGING: bool = false; +pub const DIAG_LOGGING: bool = false; // set true to see raw ADC / calibration logs pub const LOG_INTERVAL_MS: u32 = 500; -pub const LOG_SWITCH: usize = 89; // HE90 - -// ── Disabled switches (sensors not yet connected — floating inputs) ─────────── -pub const DISABLED_SWITCHES: &[usize] = &[89]; // HE90 +pub const LOG_SWITCH: usize = 0; // HE1 — first switch // ── Settings buttons ────────────────────────────────────────────────────────── pub const SETTINGS_CHAN1: usize = 72; // HE73 → melody MIDI ch 1 diff --git a/keyboard_keyboard/code/src/main.rs b/keyboard_keyboard/code/src/main.rs index 486bb32..c4661c7 100644 --- a/keyboard_keyboard/code/src/main.rs +++ b/keyboard_keyboard/code/src/main.rs @@ -521,27 +521,27 @@ mod app { } // ── Vibrato → CC1 (dead zone + rate-limited) ────────────────────────── - // if now % VIBRATO_INTERVAL_MS == 0 { - // let max_delta = vib_filt_a - // .abs_diff(baselines[VIBRATO_A]) - // .max(vib_filt_b.abs_diff(baselines[VIBRATO_B])) - // .saturating_sub(VIBRATO_DEAD_ZONE); - // let cc_val = - // ((max_delta.min(VIBRATO_MAX_DELTA) as u32 * 127 / VIBRATO_MAX_DELTA as u32) as u8) - // .min(127); - // if cc_val.abs_diff(*ctx.local.last_vibrato_cc) >= VIBRATO_HYSTERESIS { - // *ctx.local.last_vibrato_cc = cc_val; - // pending - // .push(( - // 0, - // SwitchEvent::PotChange { - // cc: 1, - // value: cc_val, - // }, - // )) - // .ok(); - // } - // } + if now % VIBRATO_INTERVAL_MS == 0 { + let max_delta = vib_filt_a + .abs_diff(baselines[VIBRATO_A]) + .max(vib_filt_b.abs_diff(baselines[VIBRATO_B])) + .saturating_sub(VIBRATO_DEAD_ZONE); + let cc_val = + ((max_delta.min(VIBRATO_MAX_DELTA) as u32 * 127 / VIBRATO_MAX_DELTA as u32) as u8) + .min(127); + if cc_val.abs_diff(*ctx.local.last_vibrato_cc) >= VIBRATO_HYSTERESIS { + *ctx.local.last_vibrato_cc = cc_val; + pending + .push(( + 0, + SwitchEvent::PotChange { + cc: 1, + value: cc_val, + }, + )) + .ok(); + } + } // ── Pot scan (100 Hz) ───────────────────────────────────────────────── if now % POT_SCAN_MS == 0 { From 43fabcd25340067243c5a28284e009caf8265d33 Mon Sep 17 00:00:00 2001 From: Enoch Date: Tue, 23 Jun 2026 00:10:33 -0500 Subject: [PATCH 3/5] I put a lot of work in the splash. I wanna see it --- keyboard_keyboard/code/src/constants.rs | 2 ++ keyboard_keyboard/code/src/main.rs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/keyboard_keyboard/code/src/constants.rs b/keyboard_keyboard/code/src/constants.rs index e68951c..38dcb04 100644 --- a/keyboard_keyboard/code/src/constants.rs +++ b/keyboard_keyboard/code/src/constants.rs @@ -17,6 +17,8 @@ pub const FILTER_SHIFT: u32 = 2; pub const VELOCITY_WINDOW_MS: u32 = 80; pub const CALIBRATION_SAMPLES: usize = 64; +pub const SPLASH_DURATION_MS: u32 = 8000; + pub const DIAG_LOGGING: bool = false; // set true to see raw ADC / calibration logs pub const LOG_INTERVAL_MS: u32 = 500; pub const LOG_SWITCH: usize = 0; // HE1 — first switch diff --git a/keyboard_keyboard/code/src/main.rs b/keyboard_keyboard/code/src/main.rs index c4661c7..b4ba416 100644 --- a/keyboard_keyboard/code/src/main.rs +++ b/keyboard_keyboard/code/src/main.rs @@ -416,6 +416,10 @@ mod app { info!("tick={}", now); } + if now == SPLASH_DURATION_MS { + display_update::spawn().ok(); + } + let baselines = ctx.shared.baselines.lock(|b| *b); let mut pending: heapless::Vec<(usize, SwitchEvent), 32> = heapless::Vec::new(); From 764c36e2eae7f04859f6623f1c3f924afbb2d778 Mon Sep 17 00:00:00 2001 From: Enoch Date: Tue, 23 Jun 2026 00:22:39 -0500 Subject: [PATCH 4/5] forcing you all to look at my splash --- keyboard_keyboard/code/src/constants.rs | 2 +- keyboard_keyboard/code/src/main.rs | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/keyboard_keyboard/code/src/constants.rs b/keyboard_keyboard/code/src/constants.rs index 38dcb04..dd11b48 100644 --- a/keyboard_keyboard/code/src/constants.rs +++ b/keyboard_keyboard/code/src/constants.rs @@ -17,7 +17,7 @@ pub const FILTER_SHIFT: u32 = 2; pub const VELOCITY_WINDOW_MS: u32 = 80; pub const CALIBRATION_SAMPLES: usize = 64; -pub const SPLASH_DURATION_MS: u32 = 8000; +pub const SPLASH_DURATION_MS: u32 = 3000; pub const DIAG_LOGGING: bool = false; // set true to see raw ADC / calibration logs pub const LOG_INTERVAL_MS: u32 = 500; diff --git a/keyboard_keyboard/code/src/main.rs b/keyboard_keyboard/code/src/main.rs index b4ba416..5a30cfa 100644 --- a/keyboard_keyboard/code/src/main.rs +++ b/keyboard_keyboard/code/src/main.rs @@ -61,6 +61,7 @@ mod app { event_queue: heapless::spsc::Queue<(usize, SwitchEvent), 64>, midi_tx_flag: bool, display_state: DisplayState, + splash_done: bool, } // ── Local resources ─────────────────────────────────────────────────────── @@ -327,6 +328,7 @@ mod app { event_queue: heapless::spsc::Queue::new(), midi_tx_flag: false, display_state: DisplayState::new(), + splash_done: false, }, Local { audio: system.audio, @@ -401,7 +403,7 @@ mod app { local = [timer2, adc, adc_pins, enb_a, enb_b, enb_c, adc_pin_a9, adc_pin_a10, adc_pin_a11, pot_last_cc, s0, s1, s2, mux_raw, filters, last_pitch_bend, last_vibrato_cc, led1, led2, led3, midi_rx, led1_off_at, led2_off_at], - shared = [tick_ms, switch_states, baselines, event_queue, midi_tx_flag], + shared = [tick_ms, switch_states, baselines, event_queue, midi_tx_flag, splash_done], priority = 15 )] fn timer_handler(mut ctx: timer_handler::Context) { @@ -417,6 +419,7 @@ mod app { } if now == SPLASH_DURATION_MS { + ctx.shared.splash_done.lock(|d| *d = true); display_update::spawn().ok(); } @@ -456,9 +459,6 @@ mod app { ctx.shared.switch_states.lock(|states| { for (switch_idx, &(mux, ch)) in SWITCH_MAP.iter().enumerate() { - if DISABLED_SWITCHES.contains(&switch_idx) { - continue; - } let raw = ctx.local.mux_raw[mux as usize][ch as usize]; let filtered = ctx.local.filters[switch_idx].feed(raw); @@ -606,7 +606,7 @@ mod app { // ── MIDI output ─────────────────────────────────────────────────────────── #[task( - shared = [event_queue, midi_tx_flag, display_state], + shared = [event_queue, midi_tx_flag, display_state, splash_done], local = [midi_sender, melody_channel], priority = 2, capacity = 32 @@ -672,7 +672,8 @@ mod app { } }); - if new_display_event.is_some() || melody_changed { + let done = ctx.shared.splash_done.lock(|d| *d); + if (new_display_event.is_some() || melody_changed) && done { ctx.shared.display_state.lock(|s| { match new_display_event { Some(LastEvent::Clear) => s.last_event = None, From a60f659c269acb021c1a167024506d909494f92f Mon Sep 17 00:00:00 2001 From: Enoch Date: Tue, 23 Jun 2026 09:40:30 -0500 Subject: [PATCH 5/5] format --- keyboard_keyboard/code/src/constants.rs | 4 ++-- keyboard_keyboard/code/src/display/mod.rs | 4 +++- keyboard_keyboard/code/src/display/screens.rs | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/keyboard_keyboard/code/src/constants.rs b/keyboard_keyboard/code/src/constants.rs index dd11b48..1ec6a9e 100644 --- a/keyboard_keyboard/code/src/constants.rs +++ b/keyboard_keyboard/code/src/constants.rs @@ -56,8 +56,8 @@ pub const NUM_POTS: usize = 12; pub const POT_SCAN_MS: u32 = 10; pub const POT_CC_HYSTERESIS: u8 = 2; pub const POT_ADC_MAX: u32 = 3776; // physical ceiling — pots don't reach full ADC range -// (decoder_idx, mux_channel, CC_number) -// decoder_idx 4 = AM14 (Y4), 5 = AM15 (Y5) — both read via Daisy28 / A11 + // (decoder_idx, mux_channel, CC_number) + // decoder_idx 4 = AM14 (Y4), 5 = AM15 (Y5) — both read via Daisy28 / A11 #[rustfmt::skip] pub const POT_MAP: [(u8, u8, u8); NUM_POTS] = [ (4, 4, 7), // RV1 AM14 X4 → CC7 (volume) diff --git a/keyboard_keyboard/code/src/display/mod.rs b/keyboard_keyboard/code/src/display/mod.rs index 6e1b2e1..d22f171 100644 --- a/keyboard_keyboard/code/src/display/mod.rs +++ b/keyboard_keyboard/code/src/display/mod.rs @@ -1,7 +1,9 @@ pub mod screens; pub use screens::{draw_main, draw_splash}; -const NOTE_NAMES: [&str; 12] = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"]; +const NOTE_NAMES: [&str; 12] = [ + "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", +]; pub fn note_name(midi: u8) -> (&'static str, i8) { (NOTE_NAMES[(midi % 12) as usize], (midi / 12) as i8 - 1) diff --git a/keyboard_keyboard/code/src/display/screens.rs b/keyboard_keyboard/code/src/display/screens.rs index 882ba43..b4e32cb 100644 --- a/keyboard_keyboard/code/src/display/screens.rs +++ b/keyboard_keyboard/code/src/display/screens.rs @@ -14,8 +14,7 @@ use embedded_graphics::{ }; use heapless::String; -const SPRITE_ATLAS: &[u8] = - include_bytes!("../../../../images/Keyboard-Keyboard-Spritesheet.raw"); +const SPRITE_ATLAS: &[u8] = include_bytes!("../../../../images/Keyboard-Keyboard-Spritesheet.raw"); pub fn draw_splash(disp: &mut LcdDisplay) { disp.clear();