diff options
author | Takeshi Nishio <kkeennnn+github@gmail.com> | 2022-03-10 13:14:53 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-09 20:14:53 -0800 |
commit | 9d0153dc70d0ebc8314946209778b61a88d7d716 (patch) | |
tree | 0b9b11e39e689c2286c69b43620e61cfaff9d03a /keyboards/jones/v1/keymaps | |
parent | 8bcb77cb9ac19cbd140ea7bb07e0231eec65282d (diff) | |
download | qmk_firmware-9d0153dc70d0ebc8314946209778b61a88d7d716.tar.gz qmk_firmware-9d0153dc70d0ebc8314946209778b61a88d7d716.zip |
[keyboard]Add v1 to jones keyboard (#14405)
* Change for latest information.
* Update from v03_1 to v1.
* Add v1 files.
* Remove finished todo comment.
* Fix COLUMN number, from "a" to "9".
* Formatting
* Update keyboards/jones/v1/rules.mk
* Add license header.
https://github.com/qmk/qmk_firmware/pull/14405#discussion_r710752035
* Implement better way to handle keycode for encoder.
Use "action_exec" instead of "tap_code16"
https://github.com/qmk/qmk_firmware/pull/14405#discussion_r710752924
* Move External EEPROM config to keyboard level
* Move the lest of DYNAMIC_KEYMAP config to keyboard level
https://github.com/qmk/qmk_firmware/pull/14405#discussion_r711668094
* Move the rest of DYNAMIC_KEYMAP config to keyboard level
https://github.com/qmk/qmk_firmware/pull/14405#discussion_r711668094
* Update keyboards/jones/v1/rules.mk
* Update keyboards/jones/v1/rules.mk
* Update keyboards/jones/v1/rules.mk
Diffstat (limited to 'keyboards/jones/v1/keymaps')
-rw-r--r-- | keyboards/jones/v1/keymaps/default/keymap.c | 64 | ||||
-rw-r--r-- | keyboards/jones/v1/keymaps/default/readme.md | 10 | ||||
-rw-r--r-- | keyboards/jones/v1/keymaps/via/config.h | 34 | ||||
-rw-r--r-- | keyboards/jones/v1/keymaps/via/keymap.c | 225 | ||||
-rw-r--r-- | keyboards/jones/v1/keymaps/via/readme.md | 35 | ||||
-rw-r--r-- | keyboards/jones/v1/keymaps/via/rules.mk | 2 |
6 files changed, 370 insertions, 0 deletions
diff --git a/keyboards/jones/v1/keymaps/default/keymap.c b/keyboards/jones/v1/keymaps/default/keymap.c new file mode 100644 index 0000000000..d1f952de66 --- /dev/null +++ b/keyboards/jones/v1/keymaps/default/keymap.c @@ -0,0 +1,64 @@ +/* Copyright 2021 Takeshi Nishio + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +// Defines names for use in layer keycodes and the keymap +enum layer_number { + _BASE = 0, + _LOWER, + _RAISE, + _ADJUST, +}; + +// Key Macro +#define SP_LOW LT(_LOWER, KC_SPC) +#define SP_RAI LT(_RAISE, KC_SPC) +#define SP_ADJ LT(_ADJUST, KC_SPC) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_BSLS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_SCLN, KC_QUOT, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, + KC_LSFT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LEFT, KC_RGHT, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_SLSH, + KC_MUTE, KC_LANG2, KC_LGUI, KC_LALT, SP_LOW, SP_RAI, KC_BSPC, SP_RAI,KC_RALT, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT, + KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU + ), + [_LOWER] = LAYOUT( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + KC_ESC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_INS, + _______, _______, _______, _______, _______, _______, _______, _______, KC_GRV, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, + _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, KC_TILD, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, + _______, _______, _______, _______, _______, _______, _______, SP_ADJ,_______, _______, _______, _______, _______, + _______, _______, _______, _______ + ), + [_RAISE] = LAYOUT( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_SCLN, KC_QUOT, + _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_F11, KC_F12, + _______, _______, _______, _______, SP_ADJ, _______, _______, _______,_______, _______, _______, KC_DOWN, KC_UP, + _______, _______, _______, _______ + ), + [_ADJUST] = LAYOUT( + _______, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, + _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUI, RGB_SAI, RGB_VAI, _______, RGB_RMOD, _______, + _______, AU_TOG, CK_TOGG, MU_TOG, MU_MOD, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, RGB_TOG, RGB_MOD, _______, + KC_CAPS, KC_CAPS, CK_RST, CK_DOWN, CK_UP, MUV_DE, MUV_IN, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______,_______, _______, _______, _______, _______, + _______, _______, _______, _______ + ) +}; diff --git a/keyboards/jones/v1/keymaps/default/readme.md b/keyboards/jones/v1/keymaps/default/readme.md new file mode 100644 index 0000000000..453d9e858c --- /dev/null +++ b/keyboards/jones/v1/keymaps/default/readme.md @@ -0,0 +1,10 @@ +# Defalut keymap for Jones + +Simple keymap. + +## Layers + +- Base +- Lower +- Raise +- Adjust diff --git a/keyboards/jones/v1/keymaps/via/config.h b/keyboards/jones/v1/keymaps/via/config.h new file mode 100644 index 0000000000..5d24e1f91a --- /dev/null +++ b/keyboards/jones/v1/keymaps/via/config.h @@ -0,0 +1,34 @@ +/* +Copyright 2021 Takeshi Nishio + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +//------------------------------------------------------------------------------ +// Rotary Encoder +//------------------------------------------------------------------------------ +// Encoder triggers specific key matrix position, +// when turn knob clockwise or counterclockwise. +// This is handy to assign key codes by VIA. + +// Number of endoder +#define ENCODERS 2 + +// Mappings of encoder rotation to key position in key matrix. +// First encoder, Left side : k85, k86 +// Second encoder, Right side : k95, k96 +#define ENCODERS_CW_KEY { { 6, 8 }, { 6, 9 } } +#define ENCODERS_CCW_KEY { { 5, 8 }, { 5, 9 } } diff --git a/keyboards/jones/v1/keymaps/via/keymap.c b/keyboards/jones/v1/keymaps/via/keymap.c new file mode 100644 index 0000000000..7cd1434bbc --- /dev/null +++ b/keyboards/jones/v1/keymaps/via/keymap.c @@ -0,0 +1,225 @@ +/* Copyright 2021 Takeshi Nishio + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H +#include "keymap_jp.h" + +// Defines names for use in layer keycodes and the keymap +enum layer_number { + _BASE1 = 0, + _BASE2, + _BASE3, + _LOWER, + _RAISE, + _ADJUST, +}; + +// Key Macro +#define SP_LOW LT(_LOWER, KC_SPC) +#define SP_RAI LT(_RAISE, KC_SPC) +#define SP_ADJ LT(_ADJUST, KC_SPC) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE1] = LAYOUT( + KC_ESC, JP_1, JP_2, JP_3, JP_4, JP_5, JP_CIRC, JP_YEN, JP_6, JP_7, JP_8, JP_9, JP_0, JP_MINS, KC_BSPC, + KC_TAB, JP_Q, JP_W, JP_E, JP_R, JP_T, JP_AT, JP_LBRC, JP_Y, JP_U, JP_I, JP_O, JP_P, KC_BSPC, + KC_LCTL, JP_A, JP_S, JP_D, JP_F, JP_G, JP_COLN, JP_RBRC, JP_H, JP_J, JP_K, JP_L, JP_SCLN, KC_ENT, + KC_LSFT, KC_LSFT, JP_Z, JP_X, JP_C, JP_V, JP_B, JP_SLSH, JP_BSLS, JP_N, JP_M, JP_COMM, JP_DOT, KC_DOWN, KC_UP, + KC_MUTE, KC_LGUI, KC_LALT, JP_MHEN, SP_LOW, SP_RAI, KC_BSPC, SP_RAI,SP_RAI, JP_HENK, JP_KANA, KC_LEFT, KC_RGHT, + KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU + ), + [_BASE2] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSLS, KC_PAST, KC_PMNS, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, KC_PPLS, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______,_______, KC_P0, KC_PDOT, _______, _______, + _______, _______, _______, _______ + ), + [_BASE3] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______,_______, _______, _______, _______, _______, + _______, _______, _______, _______ + ), + [_LOWER] = LAYOUT( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + _______, JP_EXLM, JP_DQUO, JP_HASH, JP_DLR, JP_PERC, JP_TILD, JP_PIPE, JP_AMPR, JP_QUOT, JP_LPRN, JP_RPRN, JP_EQL, KC_INS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, SP_ADJ, _______, SP_ADJ,SP_ADJ, _______, _______, _______, _______, + _______, _______, _______, _______ + ), + [_RAISE] = LAYOUT( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + KC_ESC, JP_1, JP_2, JP_3, JP_4, JP_5, JP_CIRC, JP_YEN, JP_6, JP_7, JP_8, JP_9, JP_0, KC_DEL, + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, + _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, _______, + _______, _______, _______, _______, SP_ADJ, _______, _______, _______,_______, _______, _______, KC_DOWN, KC_UP, + _______, _______, _______, _______ + ), + [_ADJUST] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, + _______, DF(_BASE1),DF(_BASE2),DF(_BASE3),_______, _______, _______, _______, RGB_HUI, RGB_SAI, RGB_VAI, _______, RGB_RMOD, _______, + _______, AU_TOG, CK_TOGG, MU_TOG, MU_MOD, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, RGB_TOG, RGB_MOD, _______, + KC_CAPS, KC_CAPS, CK_RST, CK_DOWN, CK_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______,_______, _______, _______, _______, _______, + _______, _______, _______, _______ + ), +}; + + +//------------------------------------------------------------------------------ +// RGB Light settings +//------------------------------------------------------------------------------ +#ifdef RGBLIGHT_LAYERS + +// Indicator LED settings +#define JONES_LED_INDICATOR_INDEX 0 // where to start indicator +#define JONES_LED_INDICATOR_COUNT 4 // how many leds used for indicator +#define JONES_LED_INDICATOR_CHANGE_COUNT 1 // how meny leds to change for temporally layer +#define JONES_LED_DIMMER_LEVEL 200 // brightness dimmer + +// for Default layer (= Base layer) +const rgblight_segment_t PROGMEM my_base1_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {JONES_LED_INDICATOR_INDEX , JONES_LED_INDICATOR_COUNT, HSV_WHITE - JONES_LED_DIMMER_LEVEL} +); + +const rgblight_segment_t PROGMEM my_base2_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {JONES_LED_INDICATOR_INDEX , JONES_LED_INDICATOR_COUNT, HSV_BLUE - JONES_LED_DIMMER_LEVEL} +); + +const rgblight_segment_t PROGMEM my_base3_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {JONES_LED_INDICATOR_INDEX , JONES_LED_INDICATOR_COUNT, HSV_YELLOW - JONES_LED_DIMMER_LEVEL} +); + +// for temporal layer +const rgblight_segment_t PROGMEM my_caps_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {JONES_LED_INDICATOR_INDEX + 1 , 1, HSV_MAGENTA - JONES_LED_DIMMER_LEVEL}, + {JONES_LED_INDICATOR_INDEX + 1 + 2 , 1, HSV_MAGENTA - JONES_LED_DIMMER_LEVEL} +); + +const rgblight_segment_t PROGMEM my_lower_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {JONES_LED_INDICATOR_INDEX , JONES_LED_INDICATOR_CHANGE_COUNT, HSV_GREEN - JONES_LED_DIMMER_LEVEL}, + {JONES_LED_INDICATOR_INDEX + 2, JONES_LED_INDICATOR_CHANGE_COUNT, HSV_GREEN - JONES_LED_DIMMER_LEVEL} +); + +const rgblight_segment_t PROGMEM my_raise_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {JONES_LED_INDICATOR_INDEX , JONES_LED_INDICATOR_CHANGE_COUNT, HSV_CYAN - JONES_LED_DIMMER_LEVEL}, + {JONES_LED_INDICATOR_INDEX + 2, JONES_LED_INDICATOR_CHANGE_COUNT, HSV_CYAN - JONES_LED_DIMMER_LEVEL} +); + +const rgblight_segment_t PROGMEM my_adjust_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {JONES_LED_INDICATOR_INDEX , JONES_LED_INDICATOR_CHANGE_COUNT, HSV_RED - JONES_LED_DIMMER_LEVEL}, + {JONES_LED_INDICATOR_INDEX + 2, JONES_LED_INDICATOR_CHANGE_COUNT, HSV_RED - JONES_LED_DIMMER_LEVEL} +); + +// Define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( + my_base1_layer, + my_base2_layer, + my_base3_layer, + my_caps_layer, + my_lower_layer, + my_raise_layer, + my_adjust_layer +); + +// Enabling and disabling lighting layers +layer_state_t layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(4, layer_state_cmp(state, _LOWER)); + rgblight_set_layer_state(5, layer_state_cmp(state, _RAISE)); + rgblight_set_layer_state(6, layer_state_cmp(state, _ADJUST)); + + return state; +} + +// Enabling and disabling lighting layers for default layer +layer_state_t default_layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(0, layer_state_cmp(state, _BASE1)); + rgblight_set_layer_state(1, layer_state_cmp(state, _BASE2)); + rgblight_set_layer_state(2, layer_state_cmp(state, _BASE3)); + + return state; +} + +bool led_update_user(led_t led_state) { + rgblight_set_layer_state(3, IS_HOST_LED_ON(USB_LED_CAPS_LOCK)); + + return true; +} +#endif + + +//------------------------------------------------------------------------------ +// Rotary Encoder +//------------------------------------------------------------------------------ +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; + +void encoder_action_unregister(void) { + 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); + } + } +} + +void encoder_action_register(uint8_t index, bool clockwise) { + 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); + action_exec(encoder_event); +} + +void matrix_scan_kb(void) { + encoder_action_unregister(); + matrix_scan_user(); +} + +bool encoder_update_user(uint8_t index, bool clockwise) { + encoder_action_register(index, clockwise); + return true; +}; + + +//------------------------------------------------------------------------------ +// Keyboard Initialization +//------------------------------------------------------------------------------ +void keyboard_post_init_user(void) { +debug_enable=true; +#ifdef RGB_DI_PIN + #ifdef RGBLIGHT_LAYERS + // Enable the LED layers. + rgblight_layers = my_rgb_layers; + + // prevent RGB light overrides layer indicator. + layer_state_set(default_layer_state); + #endif +#endif + +} diff --git a/keyboards/jones/v1/keymaps/via/readme.md b/keyboards/jones/v1/keymaps/via/readme.md new file mode 100644 index 0000000000..95da48228c --- /dev/null +++ b/keyboards/jones/v1/keymaps/via/readme.md @@ -0,0 +1,35 @@ +# Keymap for Jones with VIA support + +VIA supported basic keymap with external EEPROM. + +## Layout + +Japanese style "Wide" layout. + +## Layers + +- Base #1 +- Base #2 +- Base #3 +- Lower +- Raise +- Adjust + +## External EEPROM + +I2C connected external EEPROM. + +## LED lighting + +4 LEDsfor layer indicator. +2 for Left side and 2 for Right side. + +## Rotary encoder + +Supports up to 2 rotary encoders. +Left bottom and Right bottom. + +## Audio + +Supports monophonic audio. +"Music Mode" and "Audio Click" are enabled. diff --git a/keyboards/jones/v1/keymaps/via/rules.mk b/keyboards/jones/v1/keymaps/via/rules.mk new file mode 100644 index 0000000000..e1d2dc0582 --- /dev/null +++ b/keyboards/jones/v1/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +# Use VIA +VIA_ENABLE = yes |