From 1604a7afbc66902bb54d3882e5b276f5cc70a11f Mon Sep 17 00:00:00 2001 From: Davide Date: Wed, 28 May 2025 19:28:14 +0200 Subject: [PATCH] Update SPI clock frequency in testbench and enhance comments in effect selector for clarity on joystick mode switching --- LAB3/sim/tb_digilent_jstk2.vhd | 2 +- LAB3/src/effect_selector.vhd | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/LAB3/sim/tb_digilent_jstk2.vhd b/LAB3/sim/tb_digilent_jstk2.vhd index 181f2ae..fde276e 100644 --- a/LAB3/sim/tb_digilent_jstk2.vhd +++ b/LAB3/sim/tb_digilent_jstk2.vhd @@ -30,7 +30,7 @@ ARCHITECTURE sim OF tb_digilent_jstk2 IS -- Testbench constants CONSTANT CLKFREQ : INTEGER := 100_000_000; CONSTANT DELAY_US : INTEGER := 25; - CONSTANT SPI_SCLKFREQ : INTEGER := 66_666; + CONSTANT SPI_SCLKFREQ : INTEGER := 5_000; CONSTANT CMDSETLEDRGB : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"84"; -- Component declaration for digilent_jstk2 diff --git a/LAB3/src/effect_selector.vhd b/LAB3/src/effect_selector.vhd index 21eb378..2a853fe 100644 --- a/LAB3/src/effect_selector.vhd +++ b/LAB3/src/effect_selector.vhd @@ -50,17 +50,19 @@ BEGIN balance <= jstck_x; -- Y-axis control depends on selected effect mode + -- Note: When switching between modes, the previous joystick values + -- are preserved in the non-active outputs (volume/lfo_period) IF effect = '1' THEN -- LFO Mode: Y-axis controls Low Frequency Oscillator period -- Used for tremolo, vibrato, or other modulation effects lfo_period <= jstck_y; - -- Volume remains at last set value (not updated in LFO mode) + -- Volume remains at last set value (preserved from previous volume mode) ELSE -- Volume/Balance Mode: Y-axis controls overall volume level -- Traditional audio mixer control mode volume <= jstck_y; - -- LFO period remains at last set value (not updated in volume mode) + -- LFO period remains at last set value (preserved from previous LFO mode) END IF;