diff options
Diffstat (limited to 'quantum/sequencer')
-rw-r--r-- | quantum/sequencer/sequencer.c | 2 | ||||
-rw-r--r-- | quantum/sequencer/sequencer.h | 16 | ||||
-rw-r--r-- | quantum/sequencer/tests/rules.mk | 2 | ||||
-rw-r--r-- | quantum/sequencer/tests/sequencer_tests.cpp | 22 |
4 files changed, 27 insertions, 15 deletions
diff --git a/quantum/sequencer/sequencer.c b/quantum/sequencer/sequencer.c index 2e92f7b3eb..ff243c870b 100644 --- a/quantum/sequencer/sequencer.c +++ b/quantum/sequencer/sequencer.c @@ -15,6 +15,8 @@ */ #include "sequencer.h" +#include "debug.h" +#include "timer.h" #ifdef MIDI_ENABLE # include "process_midi.h" diff --git a/quantum/sequencer/sequencer.h b/quantum/sequencer/sequencer.h index a8ea16eece..a6498ed413 100644 --- a/quantum/sequencer/sequencer.h +++ b/quantum/sequencer/sequencer.h @@ -17,8 +17,7 @@ #pragma once #include <stdbool.h> -#include "debug.h" -#include "timer.h" +#include <stdint.h> // Maximum number of steps: 256 #ifndef SEQUENCER_STEPS @@ -42,7 +41,18 @@ * Make sure that the items of this enumeration follow the powers of 2, separated by a ternary variant. * Check the implementation of `get_step_duration` for further explanation. */ -typedef enum { SQ_RES_2, SQ_RES_2T, SQ_RES_4, SQ_RES_4T, SQ_RES_8, SQ_RES_8T, SQ_RES_16, SQ_RES_16T, SQ_RES_32, SEQUENCER_RESOLUTIONS } sequencer_resolution_t; +typedef enum { + SQ_RES_2, // + SQ_RES_2T, + SQ_RES_4, + SQ_RES_4T, + SQ_RES_8, + SQ_RES_8T, + SQ_RES_16, + SQ_RES_16T, + SQ_RES_32, + SEQUENCER_RESOLUTIONS +} sequencer_resolution_t; typedef struct { bool enabled; diff --git a/quantum/sequencer/tests/rules.mk b/quantum/sequencer/tests/rules.mk index a3bbd80513..611459e060 100644 --- a/quantum/sequencer/tests/rules.mk +++ b/quantum/sequencer/tests/rules.mk @@ -2,7 +2,7 @@ # - it is consistent with the example that is used as a reference in the Unit Testing article (https://docs.qmk.fm/#/unit_testing?id=adding-tests-for-new-or-existing-features) # - Neither `make test:sequencer` or `make test:SEQUENCER` work when using SCREAMING_SNAKE_CASE -sequencer_DEFS := -DNO_DEBUG -DMIDI_MOCKED +sequencer_DEFS := -DMATRIX_ROWS=1 -DMATRIX_COLS=1 -DNO_DEBUG -DMIDI_MOCKED sequencer_SRC := \ $(QUANTUM_PATH)/sequencer/tests/midi_mock.c \ diff --git a/quantum/sequencer/tests/sequencer_tests.cpp b/quantum/sequencer/tests/sequencer_tests.cpp index 05e58e4111..79ec10cabf 100644 --- a/quantum/sequencer/tests/sequencer_tests.cpp +++ b/quantum/sequencer/tests/sequencer_tests.cpp @@ -371,14 +371,14 @@ void setUpMatrixScanSequencerTest(void) { sequencer_config.resolution = SQ_RES_16; // Configure the notes for each track - sequencer_config.track_notes[0] = MI_C; - sequencer_config.track_notes[1] = MI_D; - sequencer_config.track_notes[2] = MI_E; - sequencer_config.track_notes[3] = MI_F; - sequencer_config.track_notes[4] = MI_G; - sequencer_config.track_notes[5] = MI_A; - sequencer_config.track_notes[6] = MI_B; - sequencer_config.track_notes[7] = MI_C; + sequencer_config.track_notes[0] = QK_MIDI_NOTE_C_0; + sequencer_config.track_notes[1] = QK_MIDI_NOTE_D_0; + sequencer_config.track_notes[2] = QK_MIDI_NOTE_E_0; + sequencer_config.track_notes[3] = QK_MIDI_NOTE_F_0; + sequencer_config.track_notes[4] = QK_MIDI_NOTE_G_0; + sequencer_config.track_notes[5] = QK_MIDI_NOTE_A_0; + sequencer_config.track_notes[6] = QK_MIDI_NOTE_B_0; + sequencer_config.track_notes[7] = QK_MIDI_NOTE_C_0; // Turn on some steps sequencer_config.steps[0] = (1 << 0); @@ -389,7 +389,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldAttackFirstTrackOfFirstStep) setUpMatrixScanSequencerTest(); sequencer_task(); - EXPECT_EQ(last_noteon, MI_C); + EXPECT_EQ(last_noteon, QK_MIDI_NOTE_C_0); EXPECT_EQ(last_noteoff, 0); } @@ -499,7 +499,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldReleaseFirstTrackFirstStep) { sequencer_task(); EXPECT_EQ(last_noteon, 0); - EXPECT_EQ(last_noteoff, MI_C); + EXPECT_EQ(last_noteoff, QK_MIDI_NOTE_C_0); } TEST_F(SequencerTest, TestMatrixScanSequencerShouldEnterPausePhaseAfterRelease) { @@ -565,7 +565,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldProcessSecondTrackOnTime) { advance_time(SEQUENCER_TRACK_THROTTLE); sequencer_task(); - EXPECT_EQ(last_noteon, MI_D); + EXPECT_EQ(last_noteon, QK_MIDI_NOTE_D_0); EXPECT_EQ(last_noteoff, 0); } |