Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matrix_scan_x -> x_task #13748

Merged
merged 1 commit into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/feature_tap_dance.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The main entry point is `process_tap_dance()`, called from `process_record_quant

This means that you have `TAPPING_TERM` time to tap the key again; you do not have to input all the taps within a single `TAPPING_TERM` timeframe. This allows for longer tap counts, with minimal impact on responsiveness.

Our next stop is `matrix_scan_tap_dance()`. This handles the timeout of tap-dance keys.
Our next stop is `tap_dance_task()`. This handles the timeout of tap-dance keys.

For the sake of flexibility, tap-dance actions can be either a pair of keycodes, or a user function. The latter allows one to handle higher tap counts, or do extra things, like blink the LEDs, fiddle with the backlighting, and so on. This is accomplished by using an union, and some clever macros.

Expand Down
2 changes: 1 addition & 1 deletion docs/ja/feature_tap_dance.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

このことは、あなたは再びキーをタップするまでの時間として `TAPPING_TERM` の時間を持っていることを意味します。そのため、あなたは1つの `TAPPING_TERM` の時間内に全てのタップを行う必要はありません。これにより、キーの反応への影響を最小限に抑えながら、より長いタップ回数を可能にします。

次は `matrix_scan_tap_dance()` です。この関数はタップダンスキーのタイムアウトを制御します。
次は `tap_dance_task()` です。この関数はタップダンスキーのタイムアウトを制御します。

柔軟性のために、タップダンスは、キーコードの組み合わせにも、ユーザー関数にもなることができます。後者は、より高度なタップ回数の制御や、LED を点滅させたり、バックライトをいじったり、等々の制御を可能にします。これは、1つの共用体と、いくつかの賢いマクロによって成し遂げられています。

Expand Down
2 changes: 1 addition & 1 deletion quantum/process_keycode/process_combo.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ bool process_combo(uint16_t keycode, keyrecord_t *record) {
return !is_combo_key;
}

void matrix_scan_combo(void) {
void combo_task(void) {
if (b_combo_enable && is_active && timer && timer_elapsed(timer) > COMBO_TERM) {
/* This disables the combo, meaning key events for this
* combo will be handled by the next processors in the chain
Expand Down
2 changes: 1 addition & 1 deletion quantum/process_keycode/process_combo.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ typedef struct {
#endif

bool process_combo(uint16_t keycode, keyrecord_t *record);
void matrix_scan_combo(void);
void combo_task(void);
void process_combo_event(uint16_t combo_index, bool pressed);

void combo_enable(void);
Expand Down
2 changes: 1 addition & 1 deletion quantum/process_keycode/process_music.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void music_mode_cycle(void) {
# endif
}

void matrix_scan_music(void) {
void music_task(void) {
if (music_sequence_playing) {
if ((music_sequence_timer == 0) || (timer_elapsed(music_sequence_timer) > music_sequence_interval)) {
music_sequence_timer = timer_read();
Expand Down
2 changes: 1 addition & 1 deletion quantum/process_keycode/process_music.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void music_scale_user(void);
void music_all_notes_off(void);
void music_mode_cycle(void);

void matrix_scan_music(void);
void music_task(void);

bool music_mask(uint16_t keycode);
bool music_mask_kb(uint16_t keycode);
Expand Down
2 changes: 1 addition & 1 deletion quantum/process_keycode/process_tap_dance.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
return true;
}

void matrix_scan_tap_dance() {
void tap_dance_task() {
if (highest_td == -1) return;
uint16_t tap_user_defined;

Expand Down
2 changes: 1 addition & 1 deletion quantum/process_keycode/process_tap_dance.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ extern qk_tap_dance_action_t tap_dance_actions[];

void preprocess_tap_dance(uint16_t keycode, keyrecord_t *record);
bool process_tap_dance(uint16_t keycode, keyrecord_t *record);
void matrix_scan_tap_dance(void);
void tap_dance_task(void);
void reset_tap_dance(qk_tap_dance_state_t *state);

void qk_tap_dance_pair_on_each_tap(qk_tap_dance_state_t *state, void *user_data);
Expand Down
8 changes: 4 additions & 4 deletions quantum/quantum.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,23 +411,23 @@ void matrix_scan_quantum() {
#endif

#if defined(AUDIO_ENABLE) && !defined(NO_MUSIC_MODE)
matrix_scan_music();
music_task();
#endif

#ifdef KEY_OVERRIDE_ENABLE
matrix_scan_key_override();
#endif

#ifdef SEQUENCER_ENABLE
matrix_scan_sequencer();
sequencer_task();
#endif

#ifdef TAP_DANCE_ENABLE
matrix_scan_tap_dance();
tap_dance_task();
#endif

#ifdef COMBO_ENABLE
matrix_scan_combo();
combo_task();
#endif

#ifdef LED_MATRIX_ENABLE
Expand Down
4 changes: 0 additions & 4 deletions quantum/quantum.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,6 @@ void set_single_persistent_default_layer(uint8_t default_layer);
#define IS_LAYER_ON_STATE(state, layer) layer_state_cmp(state, layer)
#define IS_LAYER_OFF_STATE(state, layer) !layer_state_cmp(state, layer)

void matrix_init_kb(void);
void matrix_scan_kb(void);
void matrix_init_user(void);
void matrix_scan_user(void);
uint16_t get_record_keycode(keyrecord_t *record, bool update_layer_cache);
uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache);
bool process_action_kb(keyrecord_t *record);
Expand Down
2 changes: 1 addition & 1 deletion quantum/sequencer/sequencer.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void sequencer_phase_pause(void) {
sequencer_internal_state.phase = SEQUENCER_PHASE_ATTACK;
}

void matrix_scan_sequencer(void) {
void sequencer_task(void) {
if (!sequencer_config.enabled) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion quantum/sequencer/sequencer.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ uint16_t sequencer_get_step_duration(void);
uint16_t get_beat_duration(uint8_t tempo);
uint16_t get_step_duration(uint8_t tempo, sequencer_resolution_t resolution);

void matrix_scan_sequencer(void);
void sequencer_task(void);
26 changes: 13 additions & 13 deletions quantum/sequencer/tests/sequencer_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,15 @@ void setUpMatrixScanSequencerTest(void) {
TEST_F(SequencerTest, TestMatrixScanSequencerShouldAttackFirstTrackOfFirstStep) {
setUpMatrixScanSequencerTest();

matrix_scan_sequencer();
sequencer_task();
EXPECT_EQ(last_noteon, MI_C);
EXPECT_EQ(last_noteoff, 0);
}

TEST_F(SequencerTest, TestMatrixScanSequencerShouldAttackSecondTrackAfterFirstTrackOfFirstStep) {
setUpMatrixScanSequencerTest();

matrix_scan_sequencer();
sequencer_task();
EXPECT_EQ(sequencer_internal_state.current_step, 0);
EXPECT_EQ(sequencer_internal_state.current_track, 1);
EXPECT_EQ(sequencer_internal_state.phase, SEQUENCER_PHASE_ATTACK);
Expand All @@ -409,7 +409,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldNotAttackInactiveTrackFirstSt
// Wait some time after the first track has been attacked
advance_time(SEQUENCER_TRACK_THROTTLE);

matrix_scan_sequencer();
sequencer_task();
EXPECT_EQ(last_noteon, 0);
EXPECT_EQ(last_noteoff, 0);
}
Expand All @@ -423,7 +423,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldAttackThirdTrackAfterSecondTr
// Wait some time after the second track has been attacked
advance_time(2 * SEQUENCER_TRACK_THROTTLE);

matrix_scan_sequencer();
sequencer_task();
EXPECT_EQ(sequencer_internal_state.current_step, 0);
EXPECT_EQ(sequencer_internal_state.current_track, 2);
EXPECT_EQ(sequencer_internal_state.phase, SEQUENCER_PHASE_ATTACK);
Expand All @@ -438,7 +438,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldEnterReleasePhaseAfterLastTra
// Wait until all notes have been attacked
advance_time((SEQUENCER_TRACKS - 1) * SEQUENCER_TRACK_THROTTLE);

matrix_scan_sequencer();
sequencer_task();
EXPECT_EQ(last_noteon, 0);
EXPECT_EQ(last_noteoff, 0);
EXPECT_EQ(sequencer_internal_state.current_step, 0);
Expand All @@ -458,7 +458,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldReleaseBackwards) {
// + the release timeout
advance_time(SEQUENCER_PHASE_RELEASE_TIMEOUT);

matrix_scan_sequencer();
sequencer_task();
EXPECT_EQ(sequencer_internal_state.current_step, 0);
EXPECT_EQ(sequencer_internal_state.current_track, SEQUENCER_TRACKS - 2);
EXPECT_EQ(sequencer_internal_state.phase, SEQUENCER_PHASE_RELEASE);
Expand All @@ -476,7 +476,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldNotReleaseInactiveTrackFirstS
// + the release timeout
advance_time(SEQUENCER_PHASE_RELEASE_TIMEOUT);

matrix_scan_sequencer();
sequencer_task();
EXPECT_EQ(last_noteon, 0);
EXPECT_EQ(last_noteoff, 0);
}
Expand All @@ -495,7 +495,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldReleaseFirstTrackFirstStep) {
// + all the other notes have been released
advance_time((SEQUENCER_TRACKS - 1) * SEQUENCER_TRACK_THROTTLE);

matrix_scan_sequencer();
sequencer_task();
EXPECT_EQ(last_noteon, 0);
EXPECT_EQ(last_noteoff, MI_C);
}
Expand All @@ -514,7 +514,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldEnterPausePhaseAfterRelease)
// + all the other notes have been released
advance_time((SEQUENCER_TRACKS - 1) * SEQUENCER_TRACK_THROTTLE);

matrix_scan_sequencer();
sequencer_task();
EXPECT_EQ(sequencer_internal_state.current_step, 0);
EXPECT_EQ(sequencer_internal_state.current_track, 0);
EXPECT_EQ(sequencer_internal_state.phase, SEQUENCER_PHASE_PAUSE);
Expand All @@ -536,7 +536,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldProcessFirstTrackOfSecondStep
// + the step duration (one 16th at tempo=120 lasts 125ms)
advance_time(125);

matrix_scan_sequencer();
sequencer_task();
EXPECT_EQ(sequencer_internal_state.current_step, 1);
EXPECT_EQ(sequencer_internal_state.current_track, 1);
EXPECT_EQ(sequencer_internal_state.phase, SEQUENCER_PHASE_ATTACK);
Expand All @@ -548,7 +548,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldProcessSecondTrackTooEarly) {
sequencer_internal_state.current_step = 2;
sequencer_internal_state.current_track = 1;

matrix_scan_sequencer();
sequencer_task();
EXPECT_EQ(last_noteon, 0);
EXPECT_EQ(last_noteoff, 0);
}
Expand All @@ -562,7 +562,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldProcessSecondTrackOnTime) {
// Wait until first track has been attacked
advance_time(SEQUENCER_TRACK_THROTTLE);

matrix_scan_sequencer();
sequencer_task();
EXPECT_EQ(last_noteon, MI_D);
EXPECT_EQ(last_noteoff, 0);
}
Expand All @@ -583,7 +583,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldLoopOnceSequenceIsOver) {
// + the step duration (one 16th at tempo=120 lasts 125ms)
advance_time(125);

matrix_scan_sequencer();
sequencer_task();
EXPECT_EQ(sequencer_internal_state.current_step, 0);
EXPECT_EQ(sequencer_internal_state.current_track, 1);
EXPECT_EQ(sequencer_internal_state.phase, SEQUENCER_PHASE_ATTACK);
Expand Down