From 10005e9f39409986493dc3865cc64734c9db786e Mon Sep 17 00:00:00 2001 From: 3araht <69518343+3araht@users.noreply.github.com> Date: Fri, 30 Sep 2022 15:13:21 +0900 Subject: [PATCH] Rotary encoder setting is revised to solve a malfunction. (#18227) * Rotary encoder setting is revised to solve a mulfunction. UNUSED_PINS deleted. * Encoder map applied. * ENCODER_MAP_ENABLE moved to keymap level. * Settings in rules.mk moved to info.json. * picture sent to imgur. config.h streamlined. --- keyboards/chromatonemini/chromatonemini.c | 52 ---------- keyboards/chromatonemini/chromatonemini.h | 9 +- keyboards/chromatonemini/config.h | 94 +------------------ keyboards/chromatonemini/info.json | 27 +++++- .../chromatonemini/keymaps/default/keymap.c | 14 ++- .../chromatonemini/keymaps/default/rules.mk | 1 + keyboards/chromatonemini/keymaps/led/keymap.c | 29 ++++-- keyboards/chromatonemini/keymaps/led/rules.mk | 2 + .../chromatonemini/keymaps/party/keymap.c | 30 ++++-- .../chromatonemini/keymaps/party/rules.mk | 2 + keyboards/chromatonemini/keymaps/via/config.h | 4 - keyboards/chromatonemini/keymaps/via/keymap.c | 17 +++- keyboards/chromatonemini/keymaps/via/rules.mk | 2 + keyboards/chromatonemini/readme.md | 2 +- keyboards/chromatonemini/rules.mk | 20 ---- 15 files changed, 106 insertions(+), 199 deletions(-) create mode 100644 keyboards/chromatonemini/keymaps/default/rules.mk delete mode 100644 keyboards/chromatonemini/keymaps/via/config.h diff --git a/keyboards/chromatonemini/chromatonemini.c b/keyboards/chromatonemini/chromatonemini.c index 91caab7980..d7dc33a0e0 100644 --- a/keyboards/chromatonemini/chromatonemini.c +++ b/keyboards/chromatonemini/chromatonemini.c @@ -154,55 +154,3 @@ uint8_t shift_led_indicator_right(uint8_t scale_indicator_col){ } return scale_indicator_col; } - -#ifdef ENCODER_ENABLE -# ifdef ENCODERS -static uint8_t encoder_state[ENCODERS] = {0}; -static keypos_t encoder_cw[ENCODERS] = ENCODERS_CW_KEY; -static keypos_t encoder_ccw[ENCODERS] = ENCODERS_CCW_KEY; -# endif - -void encoder_action_unregister(void) { -# ifdef ENCODERS - for (int index = 0; index < ENCODERS; ++index) { - if (encoder_state[index]) { - keyevent_t encoder_event = (keyevent_t) { - .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], - .pressed = false, - .time = (timer_read() | 1) - }; - encoder_state[index] = 0; - action_exec(encoder_event); - } - } -# endif -} - -void encoder_action_register(uint8_t index, bool clockwise) { -# ifdef ENCODERS - keyevent_t encoder_event = (keyevent_t) { - .key = clockwise ? encoder_cw[index] : encoder_ccw[index], - .pressed = true, - .time = (timer_read() | 1) - }; - encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); -# ifdef CONSOLE_ENABLE - uprintf("encoder_action_register index = %u, clockwise = %u, row = %u, col = %u\n", index, clockwise, encoder_event.key.row, encoder_event.key.col); -# endif - action_exec(encoder_event); -# endif -} - -void matrix_scan_kb(void) { - encoder_action_unregister(); - matrix_scan_user(); -} - -bool encoder_update_kb(uint8_t index, bool clockwise) { - encoder_action_register(index, clockwise); - // don't return user actions, because they are in the keymap - // encoder_update_user(index, clockwise); - return true; -}; - -#endif diff --git a/keyboards/chromatonemini/chromatonemini.h b/keyboards/chromatonemini/chromatonemini.h index 83838be73e..d42ee500ce 100644 --- a/keyboards/chromatonemini/chromatonemini.h +++ b/keyboards/chromatonemini/chromatonemini.h @@ -27,14 +27,14 @@ * represents the switch matrix. */ #define LAYOUT( \ - enc, sustain, ccw, cw, \ + enc, sustain, \ up, \ left, right, k01, k03, k05, k07, k09, k11, k13, k15, k17, k19, k21, k23, k25, k27, k29, k31, k33, k35, k37, \ down, k02, k04, k06, k08, k10, k12, k14, k16, k18, k20, k22, k24, k26, k28, k30, k32, k34, k36 \ ) { \ { enc, down, left, right, up, k01, k02, sustain }, \ - { k03, k04, k05, k06, k07, k08, k09, ccw }, \ - { k10, k11, k12, k13, k14, k15, k16, cw }, \ + { k03, k04, k05, k06, k07, k08, k09, KC_NO }, \ + { k10, k11, k12, k13, k14, k15, k16, KC_NO }, \ { k17, k18, k19, k20, k21, k22, k23, KC_NO }, \ { k24, k25, k26, k27, k28, k29, k30, KC_NO }, \ { k31, k32, k33, k34, k35, k36, k37, KC_NO } \ @@ -117,6 +117,3 @@ extern MidiDevice midi_device; uint8_t shift_led_indicator_left(uint8_t scale_indicator_col); uint8_t shift_led_indicator_right(uint8_t scale_indicator_col); -void encoder_action_unregister(void); - -void encoder_action_register(uint8_t index, bool clockwise); diff --git a/keyboards/chromatonemini/config.h b/keyboards/chromatonemini/config.h index 49b8eef7a8..aa7eeac148 100644 --- a/keyboards/chromatonemini/config.h +++ b/keyboards/chromatonemini/config.h @@ -19,27 +19,6 @@ along with this program. If not, see . #include "config_common.h" -/* key matrix size */ -#define MATRIX_ROWS 6 -#define MATRIX_COLS 8 - -/* - * Keyboard Matrix Assignments - * - * Change this to how you wired your keyboard - * COLS: AVR pins used for columns, left to right - * ROWS: AVR pins used for rows, top to bottom - * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) - * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) - * - */ -#define MATRIX_ROW_PINS { E6, D7, C6, D4, D0, D1 } -#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2, B6 } -#define UNUSED_PINS - -/* COL2ROW, ROW2COL */ -#define DIODE_DIRECTION COL2ROW - /* * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. */ @@ -171,63 +150,6 @@ along with this program. If not, see . # endif // CONSOLE_ENABLE #endif // RGB_MATRIX_ENABLE -/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ -#define DEBOUNCE 5 - -/* define if matrix has ghost (lacks anti-ghosting diodes) */ -//#define MATRIX_HAS_GHOST - -// /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ -// #define LOCKING_SUPPORT_ENABLE -// /* Locking resynchronize hack */ -// #define LOCKING_RESYNC_ENABLE - -/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. - * This is useful for the Windows task manager shortcut (ctrl+shift+esc). - */ -//#define GRAVE_ESC_CTRL_OVERRIDE - -/* - * Force NKRO - * - * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved - * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the - * makefile for this to work.) - * - * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) - * until the next keyboard reset. - * - * NKRO may prevent your keystrokes from being detected in the BIOS, but it is - * fully operational during normal computer usage. - * - * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) - * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by - * bootmagic, NKRO mode will always be enabled until it is toggled again during a - * power-up. - * - */ -//#define FORCE_NKRO - -/* - * Feature disable options - * These options are also useful to firmware size reduction. - */ - -/* disable debug print */ -//#define NO_DEBUG - -/* disable print */ -//#define NO_PRINT - -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT - -/* Bootmagic Lite key configuration */ -//#define BOOTMAGIC_LITE_ROW 0 -//#define BOOTMAGIC_LITE_COLUMN 0 - /* Audio */ #ifdef AUDIO_ENABLE # define AUDIO_PIN B6 // use PB6 = PIN10 as Audio output @@ -262,19 +184,9 @@ along with this program. If not, see . # define MIDI_INITIAL_VELOCITY 117 #endif // MIDI_ENABLE -/* - * Encoder options - */ -#ifdef ENCODER_ENABLE -# define ENCODERS_PAD_A { B5 } -# define ENCODERS_PAD_B { B4 } -# define ENCODER_RESOLUTION 4 -# define TAP_CODE_DELAY 10 - -#define ENCODERS 1 -#define ENCODERS_CW_KEY { {7, 2} } -#define ENCODERS_CCW_KEY { {7, 1} } -#endif // ENCODER_ENABLE +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING /* 2021/01/22 added to shrink firmware size */ // NO_ACTION_TAPPING -1964 bytes, however, this disables Layer mods... diff --git a/keyboards/chromatonemini/info.json b/keyboards/chromatonemini/info.json index 5f77db05ee..7d33f4ed20 100644 --- a/keyboards/chromatonemini/info.json +++ b/keyboards/chromatonemini/info.json @@ -3,6 +3,26 @@ "manufacturer": "3araht", "url": "https://github.com/3araht/chromatonemini", "maintainer": "3araht", + "bootloader": "caterina", + "processor": "atmega32u4", + "features": { + "midi": true, + "extrakey": true, + "encoder": true, + "via": true, + "bootmagic": false, + "console": false, + "mousekey": false, + "nkro": false, + "rgblight": false, + "audio": false + }, + "diode_direction": "COL2ROW", + "matrix_pins": { + "cols": [ "F4", "F5", "F6", "F7", "B1", "B3", "B2", "B6" ], + "rows": [ "E6", "D7", "C6", "D4", "D0", "D1" ] + }, + "debounce": 5, "usb": { "vid": "0xFEED", "pid": "0xF4B4", @@ -13,8 +33,6 @@ "layout": [ {"label":"enc", "x":0.5, "y":0}, {"label":"sustain", "x":1.5, "y":0}, - {"label":"ccw", "x":2.5, "y":0}, - {"label":"cw", "x":3.5, "y":0}, {"label":"up", "x":0.5, "y":1.5}, {"label":"left", "x":0, "y":2.5}, {"label":"right", "x":1, "y":2.5}, @@ -57,5 +75,10 @@ {"label":"k34", "x":19, "y":3.5}, {"label":"k36", "x":20, "y":3.5}] } + }, + "encoder": { + "rotary": [ + { "pin_a": "B5", "pin_b": "B4", "resolution": 4 } + ] } } diff --git a/keyboards/chromatonemini/keymaps/default/keymap.c b/keyboards/chromatonemini/keymaps/default/keymap.c index 102aba930a..4527065c3b 100644 --- a/keyboards/chromatonemini/keymaps/default/keymap.c +++ b/keyboards/chromatonemini/keymaps/default/keymap.c @@ -39,7 +39,7 @@ extern midi_config_t midi_config; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Base */ [_BASE] = LAYOUT( - FN_MUTE, MI_SUS, KC_VOLD, KC_VOLU, + FN_MUTE, MI_SUS, MI_BENDU, MI_TRNSD, MI_TRNSU, MI_C_2, MI_D_2, MI_E_2, MI_Fs_2, MI_Ab_2, MI_Bb_2, MI_C_3, MI_D_3, MI_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5, MI_BENDD, MI_Db_2, MI_Eb_2, MI_F_2, MI_G_2, MI_A_2, MI_B_2, MI_Db_3, MI_Eb_3, MI_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4 @@ -47,20 +47,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* RESERVE */ [_RESERVE] = LAYOUT( - _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), [_FN] = LAYOUT( - _______, XXXXXXX, XXXXXXX, XXXXXXX, + _______, XXXXXXX, MI_VELU, MI_OCTD, MI_OCTU, L_BASE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, VERSION, XXXXXXX, XXXXXXX, MI_VELD, L_RESERVE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, EEP_RST, XXXXXXX, XXXXXXX ) }; +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_RESERVE] = { ENCODER_CCW_CW(_______, _______) }, + [_FN] = { ENCODER_CCW_CW(_______, _______) }, +}; +#endif + // commom codes called from eeconfig_init_user() and keyboard_post_init_user(). void my_init(void){ // Set octave to MI_OCT_1 diff --git a/keyboards/chromatonemini/keymaps/default/rules.mk b/keyboards/chromatonemini/keymaps/default/rules.mk new file mode 100644 index 0000000000..8006608ea9 --- /dev/null +++ b/keyboards/chromatonemini/keymaps/default/rules.mk @@ -0,0 +1 @@ +ENCODER_MAP_ENABLE = yes # replacing ENCODERS_CW_KEY method to this on 2022/08/31. diff --git a/keyboards/chromatonemini/keymaps/led/keymap.c b/keyboards/chromatonemini/keymaps/led/keymap.c index 99da8ed0c9..a68ec2ad38 100644 --- a/keyboards/chromatonemini/keymaps/led/keymap.c +++ b/keyboards/chromatonemini/keymaps/led/keymap.c @@ -215,7 +215,7 @@ static uint8_t key_separator_col = _KEY01; // (_KEY01 .. _KEY37). By defau const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Base */ [_BASE] = LAYOUT( - FN_MUTE, MI_SUS, KC_VOLD, KC_VOLU, + FN_MUTE, MI_SUS, MI_BENDU, SHIFT_L, SHIFT_R, MI_C_2, MI_D_2, MI_E_2, MI_Fs_2, MI_Ab_2, MI_Bb_2, MI_C_3, MI_D_3, MI_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5, MI_BENDD, MI_Db_2, MI_Eb_2, MI_F_2, MI_G_2, MI_A_2, MI_B_2, MI_Db_3, MI_Eb_3, MI_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4 @@ -223,7 +223,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* 1 octave on the left side is ch2, others are ch1 (normal) */ [_SEPALEFTOCT] = LAYOUT( - _______, _______, _______, _______, + _______, _______, _______, SHIFT_L, SHIFT_R, YM_C_2, YM_D_2, YM_E_2, YM_Fs_2, YM_Ab_2, YM_Bb_2, MI_C_3, MI_D_3, MI_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5, _______, YM_Db_2, YM_Eb_2, YM_F_2, YM_G_2, YM_A_2, YM_B_2, MI_Db_3, MI_Eb_3, MI_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4 @@ -231,7 +231,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Half ch2, half ch1 (normal) */ [_SEPAHALF] = LAYOUT( - _______, _______, _______, _______, + _______, _______, _______, SHIFT_L, SHIFT_R, YM_C_2, YM_D_2, YM_E_2, YM_Fs_2, YM_Ab_2, YM_Bb_2, YM_C_3, YM_D_3, YM_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5, _______, YM_Db_2, YM_Eb_2, YM_F_2, YM_G_2, YM_A_2, YM_B_2, YM_Db_3, YM_Eb_3, YM_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4 @@ -239,7 +239,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* 2 octave on the left side is ch2, others are ch1 (normal) */ [_SEPARIGHTOCT] = LAYOUT( - _______, _______, _______, _______, + _______, _______, _______, SHIFT_L, SHIFT_R, YM_C_2, YM_D_2, YM_E_2, YM_Fs_2, YM_Ab_2, YM_Bb_2, YM_C_3, YM_D_3, YM_E_3, YM_Fs_3, YM_Ab_3, YM_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5, _______, YM_Db_2, YM_Eb_2, YM_F_2, YM_G_2, YM_A_2, YM_B_2, YM_Db_3, YM_Eb_3, YM_F_3, YM_G_3, YM_A_3, YM_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4 @@ -247,7 +247,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* TRANS This layer must locate 1 layer below _FN layer. */ [_TRANS] = LAYOUT( - _______, _______, _______, _______, + _______, _______, _______, MI_TRNSD, MI_TRNSU, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ @@ -255,7 +255,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Flip Base SFIFTUP and SHIFT_L are swapped. */ [_FLIPBASE] = LAYOUT( - FN_MUTE, MI_SUS, KC_VOLD, KC_VOLU, + FN_MUTE, MI_SUS, MI_BENDU, SHIFT_L, SHIFT_R, MI_C_5, MI_Bb_4, MI_Ab_4, MI_Fs_4, MI_E_4, MI_D_4, MI_C_4, MI_Bb_3, MI_Ab_3, MI_Fs_3, MI_E_3, MI_D_3, MI_C_3, MI_Bb_2, MI_Ab_2, MI_Fs_2, MI_E_2, MI_D_2, MI_C_2, MI_BENDD, MI_B_4, MI_A_4, MI_G_4, MI_F_4, MI_Eb_4, MI_Db_4, MI_B_3, MI_A_3, MI_G_3, MI_F_3, MI_Eb_3, MI_Db_3, MI_B_2, MI_A_2, MI_G_2, MI_F_2, MI_Eb_2, MI_Db_2 @@ -263,20 +263,33 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Flip Trans This layer must locate 1 layer above _FLIPBASE layer. MI_TRNSU and MI_TRNSD are swapped. */ [_FLIPTRANS] = LAYOUT( - _______, _______, _______, _______, + _______, _______, _______, MI_TRNSU, MI_TRNSD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), [_FN] = LAYOUT( - _______, XXXXXXX, RGB_RMOD, RGB_MOD, + _______, XXXXXXX, MI_VELU, MI_OCTD, MI_OCTU, B_BASE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, B_LEFT, XXXXXXX, XXXXXXX, B_CENTER, XXXXXXX, XXXXXXX, B_RIGHT, XXXXXXX, XXXXXXX, XXXXXXX, VERSION, XXXXXXX, B_FLIP, MI_VELD, TGLINTR, TGLTRNS, TGLCHGR, XXXXXXX, XXXXXXX, RGB_SAD, RGB_SAI, RGB_HUD, RGB_HUI, RGB_SPD, RGB_SPI, RGB_VAD, RGB_VAI, RGB_RMOD, RGB_MOD, EEP_RST, TGLINDI, RGB_TOG ) }; +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_SEPALEFTOCT] = { ENCODER_CCW_CW(_______, _______) }, + [_SEPAHALF] = { ENCODER_CCW_CW(_______, _______) }, + [_SEPARIGHTOCT] = { ENCODER_CCW_CW(_______, _______) }, + [_TRANS] = { ENCODER_CCW_CW(_______, _______) }, + [_FLIPBASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_FLIPTRANS] = { ENCODER_CCW_CW(_______, _______) }, + [_FN] = { ENCODER_CCW_CW(RGB_RMOD, RGB_MOD) }, +}; +#endif + // commom codes called from eeconfig_init_user() and keyboard_post_init_user(). void my_init(void){ // Set octave to MI_OCT_1 diff --git a/keyboards/chromatonemini/keymaps/led/rules.mk b/keyboards/chromatonemini/keymaps/led/rules.mk index 2e67e80675..eb13370b82 100644 --- a/keyboards/chromatonemini/keymaps/led/rules.mk +++ b/keyboards/chromatonemini/keymaps/led/rules.mk @@ -1,3 +1,5 @@ RGB_MATRIX_ENABLE = yes # Use RGB matrix (Don't enable this when RGBLIGHT_ENABLE is used.) RGB_MATRIX_CUSTOM_KB = yes # VIA_ENABLE = no # too many layers to use VIA... + +ENCODER_MAP_ENABLE = yes # replacing ENCODERS_CW_KEY method to this on 2022/08/31. diff --git a/keyboards/chromatonemini/keymaps/party/keymap.c b/keyboards/chromatonemini/keymaps/party/keymap.c index 258bfe55c1..7383b81d8b 100644 --- a/keyboards/chromatonemini/keymaps/party/keymap.c +++ b/keyboards/chromatonemini/keymaps/party/keymap.c @@ -215,7 +215,7 @@ static uint8_t key_separator_col = _KEY01; // (_KEY01 .. _KEY37). By defau const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Base */ [_BASE] = LAYOUT( - FN_MUTE, MI_SUS, KC_VOLD, KC_VOLU, + FN_MUTE, MI_SUS, MI_BENDU, SHIFT_L, SHIFT_R, MI_C_2, MI_D_2, MI_E_2, MI_Fs_2, MI_Ab_2, MI_Bb_2, MI_C_3, MI_D_3, MI_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5, MI_BENDD, MI_Db_2, MI_Eb_2, MI_F_2, MI_G_2, MI_A_2, MI_B_2, MI_Db_3, MI_Eb_3, MI_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4 @@ -223,7 +223,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* 1 octave on the left side is ch2, others are ch1 (normal) */ [_SEPALEFTOCT] = LAYOUT( - _______, _______, _______, _______, + _______, _______, _______, SHIFT_L, SHIFT_R, YM_C_2, YM_D_2, YM_E_2, YM_Fs_2, YM_Ab_2, YM_Bb_2, MI_C_3, MI_D_3, MI_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5, _______, YM_Db_2, YM_Eb_2, YM_F_2, YM_G_2, YM_A_2, YM_B_2, MI_Db_3, MI_Eb_3, MI_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4 @@ -231,7 +231,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Half ch2, half ch1 (normal) */ [_SEPAHALF] = LAYOUT( - _______, _______, _______, _______, + _______, _______, _______, SHIFT_L, SHIFT_R, YM_C_2, YM_D_2, YM_E_2, YM_Fs_2, YM_Ab_2, YM_Bb_2, YM_C_3, YM_D_3, YM_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5, _______, YM_Db_2, YM_Eb_2, YM_F_2, YM_G_2, YM_A_2, YM_B_2, YM_Db_3, YM_Eb_3, YM_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4 @@ -239,7 +239,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* 2 octave on the left side is ch2, others are ch1 (normal) */ [_SEPARIGHTOCT] = LAYOUT( - _______, _______, _______, _______, + _______, _______, _______, SHIFT_L, SHIFT_R, YM_C_2, YM_D_2, YM_E_2, YM_Fs_2, YM_Ab_2, YM_Bb_2, YM_C_3, YM_D_3, YM_E_3, YM_Fs_3, YM_Ab_3, YM_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5, _______, YM_Db_2, YM_Eb_2, YM_F_2, YM_G_2, YM_A_2, YM_B_2, YM_Db_3, YM_Eb_3, YM_F_3, YM_G_3, YM_A_3, YM_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4 @@ -247,7 +247,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* TRANS This layer must locate 1 layer below _FN layer. */ [_TRANS] = LAYOUT( - _______, _______, _______, _______, + _______, _______, _______, MI_TRNSD, MI_TRNSU, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ @@ -255,7 +255,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Flip Base SFIFTUP and SHIFT_L are swapped. */ [_FLIPBASE] = LAYOUT( - FN_MUTE, MI_SUS, KC_VOLD, KC_VOLU, + FN_MUTE, MI_SUS, MI_BENDU, SHIFT_L, SHIFT_R, MI_C_5, MI_Bb_4, MI_Ab_4, MI_Fs_4, MI_E_4, MI_D_4, MI_C_4, MI_Bb_3, MI_Ab_3, MI_Fs_3, MI_E_3, MI_D_3, MI_C_3, MI_Bb_2, MI_Ab_2, MI_Fs_2, MI_E_2, MI_D_2, MI_C_2, MI_BENDD, MI_B_4, MI_A_4, MI_G_4, MI_F_4, MI_Eb_4, MI_Db_4, MI_B_3, MI_A_3, MI_G_3, MI_F_3, MI_Eb_3, MI_Db_3, MI_B_2, MI_A_2, MI_G_2, MI_F_2, MI_Eb_2, MI_Db_2 @@ -263,20 +263,34 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Flip Trans This layer must locate 1 layer above _FLIPBASE layer. MI_TRNSU and MI_TRNSD are swapped. */ [_FLIPTRANS] = LAYOUT( - _______, _______, _______, _______, + _______, _______, _______, MI_TRNSU, MI_TRNSD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), [_FN] = LAYOUT( - _______, XXXXXXX, RGB_RMOD, RGB_MOD, + _______, XXXXXXX, MI_VELU, MI_OCTD, MI_OCTU, B_BASE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, B_LEFT, XXXXXXX, XXXXXXX, B_CENTER, XXXXXXX, XXXXXXX, B_RIGHT, XXXXXXX, XXXXXXX, XXXXXXX, VERSION, XXXXXXX, B_FLIP, MI_VELD, TGLINTR, TGLTRNS, TGLCHGR, XXXXXXX, XXXXXXX, RGB_SAD, RGB_SAI, RGB_HUD, RGB_HUI, RGB_SPD, RGB_SPI, RGB_VAD, RGB_VAI, RGB_RMOD, RGB_MOD, EEP_RST, TGLINDI, RGB_TOG ) }; +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_SEPALEFTOCT] = { ENCODER_CCW_CW(_______, _______) }, + [_SEPAHALF] = { ENCODER_CCW_CW(_______, _______) }, + [_SEPARIGHTOCT] = { ENCODER_CCW_CW(_______, _______) }, + [_TRANS] = { ENCODER_CCW_CW(_______, _______) }, + [_FLIPBASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_FLIPTRANS] = { ENCODER_CCW_CW(_______, _______) }, + [_FN] = { ENCODER_CCW_CW(RGB_RMOD, RGB_MOD) }, +}; +#endif + + // commom codes called from eeconfig_init_user() and keyboard_post_init_user(). void my_init(void){ // Set octave to MI_OCT_1 diff --git a/keyboards/chromatonemini/keymaps/party/rules.mk b/keyboards/chromatonemini/keymaps/party/rules.mk index 2e67e80675..eb13370b82 100644 --- a/keyboards/chromatonemini/keymaps/party/rules.mk +++ b/keyboards/chromatonemini/keymaps/party/rules.mk @@ -1,3 +1,5 @@ RGB_MATRIX_ENABLE = yes # Use RGB matrix (Don't enable this when RGBLIGHT_ENABLE is used.) RGB_MATRIX_CUSTOM_KB = yes # VIA_ENABLE = no # too many layers to use VIA... + +ENCODER_MAP_ENABLE = yes # replacing ENCODERS_CW_KEY method to this on 2022/08/31. diff --git a/keyboards/chromatonemini/keymaps/via/config.h b/keyboards/chromatonemini/keymaps/via/config.h deleted file mode 100644 index b5ee0ac04b..0000000000 --- a/keyboards/chromatonemini/keymaps/via/config.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// How many layers to use with VIA / Remap. -#define DYNAMIC_KEYMAP_LAYER_COUNT 4 // default:4 diff --git a/keyboards/chromatonemini/keymaps/via/keymap.c b/keyboards/chromatonemini/keymaps/via/keymap.c index 08613515db..b4ea6e30fe 100644 --- a/keyboards/chromatonemini/keymaps/via/keymap.c +++ b/keyboards/chromatonemini/keymaps/via/keymap.c @@ -61,7 +61,7 @@ static bool is_trans_mode = false; // By default, shift mode is chosen. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Base */ [_BASE] = LAYOUT( - FN_MUTE, MI_SUS, KC_VOLD, KC_VOLU, + FN_MUTE, MI_SUS, MI_BENDU, SHIFT_L, SHIFT_R, MI_C_2, MI_D_2, MI_E_2, MI_Fs_2, MI_Ab_2, MI_Bb_2, MI_C_3, MI_D_3, MI_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5, MI_BENDD, MI_Db_2, MI_Eb_2, MI_F_2, MI_G_2, MI_A_2, MI_B_2, MI_Db_3, MI_Eb_3, MI_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4 @@ -69,7 +69,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* TRANS This layer must locate 1 layer below _FN layer. */ [_TRANS] = LAYOUT( - _______, _______, _______, _______, + _______, _______, _______, MI_TRNSD, MI_TRNSU, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ @@ -77,20 +77,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* RESERVE */ [_RESERVE] = LAYOUT( - _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), [_FN] = LAYOUT( - _______, XXXXXXX, RGB_RMOD, RGB_MOD, + _______, XXXXXXX, MI_VELU, MI_OCTD, MI_OCTU, B_BASE, DF(_RESERVE), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, VERSION, XXXXXXX, XXXXXXX, MI_VELD, TGLINTR, TGLTRNS, XXXXXXX, XXXXXXX, XXXXXXX, RGB_SAD, RGB_SAI, RGB_HUD, RGB_HUI, RGB_SPD, RGB_SPI, RGB_VAD, RGB_VAI, RGB_RMOD, RGB_MOD, EEP_RST, TGLINDI, RGB_TOG ) }; +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_TRANS] = { ENCODER_CCW_CW(_______, _______) }, + [_RESERVE] = { ENCODER_CCW_CW(_______, _______) }, + [_FN] = { ENCODER_CCW_CW(RGB_RMOD, RGB_MOD) }, +}; +#endif + // commom codes called from eeconfig_init_user() and keyboard_post_init_user(). void my_init(void){ // Set octave to MI_OCT_1 diff --git a/keyboards/chromatonemini/keymaps/via/rules.mk b/keyboards/chromatonemini/keymaps/via/rules.mk index 3de88c90c8..b4d2b42885 100644 --- a/keyboards/chromatonemini/keymaps/via/rules.mk +++ b/keyboards/chromatonemini/keymaps/via/rules.mk @@ -1,3 +1,5 @@ RGB_MATRIX_ENABLE = yes # Use RGB matrix (Don't enable this when RGBLIGHT_ENABLE is used.) RGB_MATRIX_CUSTOM_KB = yes # VIA_ENABLE = yes + +ENCODER_MAP_ENABLE = yes # replacing ENCODERS_CW_KEY method to this on 2022/08/31. diff --git a/keyboards/chromatonemini/readme.md b/keyboards/chromatonemini/readme.md index 4c018d01a9..34ba7e6f14 100644 --- a/keyboards/chromatonemini/readme.md +++ b/keyboards/chromatonemini/readme.md @@ -1,6 +1,6 @@ # chromatonemini -![chromatonemini](https://github.com/3araht/chromatonemini/blob/main/pictures/chromatonemini_toppage.jpg) +![chromatonemini](https://i.imgur.com/SuXzf9Dh.jpg) chromatonemini keyboard is a simple-design Chromatone mini MIDI keyboard that covers 3 octaves (37 notes). diff --git a/keyboards/chromatonemini/rules.mk b/keyboards/chromatonemini/rules.mk index 29cfc35daf..0e94fdb0d7 100644 --- a/keyboards/chromatonemini/rules.mk +++ b/keyboards/chromatonemini/rules.mk @@ -1,22 +1,2 @@ -# MCU name -MCU = atmega32u4 - -# Bootloader selection -BOOTLOADER = caterina - -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite -MOUSEKEY_ENABLE = no # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = no # Enable N-Key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -MIDI_ENABLE = yes # MIDI support -ENCODER_ENABLE = yes # encoder on mute button RGB_MATRIX_DRIVER = WS2812 # LTO_ENABLE = yes