qmk_firmware/users/mtei/encoder_update_user.c
Takeshi ISHII 33d568e29b
Update mtei's keymap (helix/rev2:five_rows, helix/pico:mtei, helix/rev3_5rows:five_rows) (#16966)
* add users/mtei/key_blocks.h

This change does not alter the binary of the build result.

Moved common macro definitions in the following files to users/mtei/key_blocks.h.
 * keyboards/helix/rev2/keymaps/five_rows/keymap.c
 * keyboards/helix/rev3_5rows/keymaps/five_rows/keymap.c

* remove INIT_HELIX_OLED() in helix:five_rows

This change does not alter the binary of the build result.

* update helix/pico/keymaps/mtei/keymap.c

Changed helix/pico/keymaps/mtei/keymap.c to use users/mtei/key_blocks.h.

This change does not alter the binary of the build result.

* Remove old SSD1306OLED code from users/mtei/oled_display.c

This change does not alter the binary of the build result.

* add options ENABLE_COLEMAK, ENABLE_DVORAK and ENABLE_EUCALYN into five_rows/keymap.c

* add users/mtei/{config.h,rules.mk,user_featues.mk,user_options.mk}

* move layer_names[] from users/mtei/oled_display.c to keymaps/five_rows/keymap.c

* Update keyboards/helix/pico/keymaps/mtei/config.h

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/helix/pico/keymaps/mtei/config.h

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/helix/pico/keymaps/mtei/keymap.c

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/helix/rev2/keymaps/five_rows/config.h

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/helix/rev2/keymaps/five_rows/config.h

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/helix/rev2/keymaps/five_rows/keymap.c

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/helix/rev3_5rows/keymaps/five_rows/config.h

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/helix/rev3_5rows/keymaps/five_rows/config.h

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/helix/rev3_5rows/keymaps/five_rows/keymap.c

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update users/mtei/config.h

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update users/mtei/config.h

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update users/mtei/cpp_map.h

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update users/mtei/cpp_map.h

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update users/mtei/debug_config.h

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update users/mtei/debug_config.h

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update users/mtei/layer_number_util.h

Co-authored-by: Ryan <fauxpark@gmail.com>

Co-authored-by: Ryan <fauxpark@gmail.com>
2022-05-19 02:33:17 +09:00

34 lines
1014 B
C

// Copyright (c) 2022 Takeshi Ishii (mtei@github)
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
/* weak reference */ __attribute__((weak))
int get_encoder_over_count(void);
bool encoder_update_user(uint8_t index, bool clockwise) {
#ifndef ENCODER_DETECT_OVER_SPEED
switch (index) {
/* Left side encoder */
case 0: tap_code(clockwise ? KC_LEFT : KC_RGHT); break;
/* Right side encoder */
case 1: tap_code(clockwise ? KC_DOWN : KC_UP); break;
}
#else
// Is there a get_encoder_over_count() in quantum/encoder.c
if (get_encoder_over_count != NULL) {
int enc_over = get_encoder_over_count();
for (; enc_over > 0; enc_over--) {
tap_code(KC_MINUS);
}
}
switch (index) {
case 0: tap_code(clockwise ? KC_A : KC_B); break;
case 1: tap_code(clockwise ? KC_C : KC_D); break;
case 2: tap_code(clockwise ? KC_E : KC_F); break;
case 3: tap_code(clockwise ? KC_G : KC_H); break;
}
#endif
return true;
}