From b8a9de206d38f0e047c2f07bca398d6fe53b76a9 Mon Sep 17 00:00:00 2001 From: ebastler Date: Wed, 21 Dec 2022 11:03:50 +0100 Subject: Add Anvil Native keyboard (#19333) Co-authored-by: Drashna Jaelre --- keyboards/teleport/native/iso/info.json | 6 + keyboards/teleport/native/iso/iso.c | 51 ++++++ .../teleport/native/iso/keymaps/default/keymap.c | 98 ++++++++++ .../teleport/native/iso/keymaps/perfmode/config.h | 23 +++ .../teleport/native/iso/keymaps/perfmode/keymap.c | 199 +++++++++++++++++++++ .../teleport/native/iso/keymaps/perfmode/rules.mk | 4 + keyboards/teleport/native/iso/keymaps/via/keymap.c | 98 ++++++++++ keyboards/teleport/native/iso/keymaps/via/rules.mk | 2 + keyboards/teleport/native/iso/rules.mk | 1 + 9 files changed, 482 insertions(+) create mode 100644 keyboards/teleport/native/iso/info.json create mode 100644 keyboards/teleport/native/iso/iso.c create mode 100644 keyboards/teleport/native/iso/keymaps/default/keymap.c create mode 100644 keyboards/teleport/native/iso/keymaps/perfmode/config.h create mode 100644 keyboards/teleport/native/iso/keymaps/perfmode/keymap.c create mode 100644 keyboards/teleport/native/iso/keymaps/perfmode/rules.mk create mode 100644 keyboards/teleport/native/iso/keymaps/via/keymap.c create mode 100644 keyboards/teleport/native/iso/keymaps/via/rules.mk create mode 100644 keyboards/teleport/native/iso/rules.mk (limited to 'keyboards/teleport/native/iso') diff --git a/keyboards/teleport/native/iso/info.json b/keyboards/teleport/native/iso/info.json new file mode 100644 index 0000000000..f475ac773e --- /dev/null +++ b/keyboards/teleport/native/iso/info.json @@ -0,0 +1,6 @@ +{ + "usb": { + "pid": "0x0002" + } +} + diff --git a/keyboards/teleport/native/iso/iso.c b/keyboards/teleport/native/iso/iso.c new file mode 100644 index 0000000000..a30f3c3b53 --- /dev/null +++ b/keyboards/teleport/native/iso/iso.c @@ -0,0 +1,51 @@ +/* Copyright 2021 Moritz Plattner + * + * 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 . + */ + +#include QMK_KEYBOARD_H + +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = { { + // Key Matrix to LED Index + { 0, 2, 4, 6, 8, 10, 12, 14 }, \ + { 1, 3, 5, 7, 9, 11, 13, 15 }, \ + { 16, 18, 20, 22, 24, 26, 28, NO_LED }, \ + { 17, 19, 21, 23, 25, 27, 29, 30 }, \ + { 31, 32, 34, 36, 38, 40, 42, 44 }, \ + { NO_LED, 33, 35, 37, 39, 41, 43, 45 }, \ + { 46, 48, 50, 52, 54, 56, NO_LED, 58 }, \ + { 47, 49, 51, 53, 55, 57, NO_LED, 59 }, \ + { 60, 62, 64, 66, 68, 70, NO_LED, 73 }, \ + { 61, 63, 65, 67, 69, 71, 72, 74 }, \ + { 75, 78, NO_LED, NO_LED, NO_LED, 79, 81, 83 }, \ + { 76, 77, NO_LED, NO_LED, NO_LED, 80, 82, 84 } \ +}, { + // LED Index to Physical Position + { 0,0 }, { 15,0 }, { 30,0 }, { 45,0 }, { 60,0 }, { 75,0 }, { 90,0 }, {105,0 }, {119,0 }, {134,0 }, {149,0 }, {164,0 }, {179,0 }, {194,0 }, {209,0 }, {224,0 }, + { 0,13 }, { 15,13 }, { 30,13 }, { 45,13 }, { 60,13 }, { 75,13 }, { 90,13 }, {105,13 }, {119,13 }, {134,13 }, {149,13 }, {164,13 }, {179,13 }, {202,13 }, {224,13 }, + { 4,26 }, { 22,26 }, { 37,26 }, { 52,26 }, { 67,26 }, { 82,26 }, { 97,26 }, {112,26 }, {127,26 }, {142,26 }, {157,26 }, {172,26 }, {187,26 }, {207,32 }, {224,26 }, + { 6,38 }, { 26,38 }, { 41,38 }, { 56,38 }, { 71,38 }, { 86,38 }, {101,38 }, {116,38 }, {131,38 }, {146,38 }, {161,38 }, {175,38 }, {190,38 }, {224,38 }, + { 2,51 }, { 19,51 }, { 34,51 }, { 49,51 }, { 63,51 }, { 78,51 }, { 93,51 }, {108,51 }, {123,51 }, {138,51 }, {153,51 }, {168,51 }, {189,51 }, {209,51 }, {224,51 }, + { 2,64 }, { 21,64 }, { 39,64 }, { 95,64 }, {149,64 }, {164,64 }, {179,64 }, {194,64 }, {209,64 }, {224,64 } +}, { + // LED Index to Flag + 1, 4, 4, 4, 4, 1, 1, 1, 1, 4, 4, 4, 4, 1, 1, 1, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 4,12, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 9, 12,12,12, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 1, + 1, 9, 1, 4, 1, 1, 1, 4, 4, 4, +} }; +#endif diff --git a/keyboards/teleport/native/iso/keymaps/default/keymap.c b/keyboards/teleport/native/iso/keymaps/default/keymap.c new file mode 100644 index 0000000000..b77e7fa61d --- /dev/null +++ b/keyboards/teleport/native/iso/keymaps/default/keymap.c @@ -0,0 +1,98 @@ +/* Copyright 2023 Moritz Plattner + * + * 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 . + */ +#include QMK_KEYBOARD_H + +enum layers{ + BASE, + GAME, + _FN1 +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [BASE] = LAYOUT_75_iso( /* keymap for layer 0 */ + KC_ESC, 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_F13, KC_PSCR, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_ENT, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_HOME, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN1),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + + [GAME] = LAYOUT_75_iso( /* keymap for layer 1 - GAME disables WIN key and has RGB layer indicators */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [_FN1] = LAYOUT_75_iso( /* keymap for layer 2 */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_RMOD, + RGB_TOG, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_MOD, + KC_TRNS, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MAGIC_TOGGLE_NKRO,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, TG(GAME),KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +/* RGB matrix indicator code +It reads the current matrix color, offsets the hue by 30, +and sets val to either 255 or, if defined, RGB_MATRIX_MAXIMUM_BRIGHTNESS +This is applied to both caps lock, and other indicator keys for layer 1 */ + +bool rgb_matrix_indicators_user(void) { + HSV hsv_ind = {rgb_matrix_get_hue()+30,255,INDICATOR_MAX_BRIGHTNESS}; + RGB rgb_ind = hsv_to_rgb(hsv_ind); + + /* Sets Caps to different color as indicator. If RGB mode is rain, and caps indicator is off, the LED will always be off. + This is to avoid having the LED persist on until the animation randomly refreshes it. */ + if (host_keyboard_led_state().caps_lock) { + rgb_matrix_set_color(CAPS_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + } else if (rgb_matrix_get_mode() == 10) { + rgb_matrix_set_color(CAPS_LED_INDEX, 0, 0, 0); + } + + /* Sets W, A, S, D, LGUI to a different color as layer indicator */ + if(IS_LAYER_ON(1)) { + HSV hsv_ind = {rgb_matrix_get_hue()+30,255,INDICATOR_MAX_BRIGHTNESS}; + RGB rgb_ind = hsv_to_rgb(hsv_ind); + + rgb_matrix_set_color(W_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + rgb_matrix_set_color(A_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + rgb_matrix_set_color(S_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + rgb_matrix_set_color(D_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + rgb_matrix_set_color(WIN_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + } + return true; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + /* If reverting to base layer (no special LED effects) and rain animation is on, set "layer 1" mods back to matrix color to avoid single key persistence*/ + if(!IS_LAYER_ON_STATE(state, 1) && rgb_matrix_get_mode() == 10) { + HSV hsv_mat = rgb_matrix_get_hsv(); + RGB rgb_mat = hsv_to_rgb(hsv_mat); + + rgb_matrix_set_color(W_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); + rgb_matrix_set_color(A_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); + rgb_matrix_set_color(S_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); + rgb_matrix_set_color(D_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); + rgb_matrix_set_color(WIN_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); + } + return state; +} \ No newline at end of file diff --git a/keyboards/teleport/native/iso/keymaps/perfmode/config.h b/keyboards/teleport/native/iso/keymaps/perfmode/config.h new file mode 100644 index 0000000000..a99590cd1c --- /dev/null +++ b/keyboards/teleport/native/iso/keymaps/perfmode/config.h @@ -0,0 +1,23 @@ +/* +Copyright 2022 Moritz Plattner +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 . +*/ + +#pragma once + +/* Use 5 dynamic keymap layers */ +#undef DYNAMIC_KEYMAP_LAYER_COUNT +#define DYNAMIC_KEYMAP_LAYER_COUNT 5 + +/* Increase eeprom size to allow for 5 layers */ +#define WEAR_LEVELING_BACKING_SIZE 16384 +#define WEAR_LEVELING_LOGICAL_SIZE 4096 \ No newline at end of file diff --git a/keyboards/teleport/native/iso/keymaps/perfmode/keymap.c b/keyboards/teleport/native/iso/keymaps/perfmode/keymap.c new file mode 100644 index 0000000000..d451d528e6 --- /dev/null +++ b/keyboards/teleport/native/iso/keymaps/perfmode/keymap.c @@ -0,0 +1,199 @@ +/* Copyright 2023 Moritz Plattner + * + * 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 . + */ +#include QMK_KEYBOARD_H + +enum layers{ + BASE, + GAME, + PERF, + _FN1, + _FN2 +}; + +/* Create a keycode to toggle RGB without writing to eeprom, important to enable/disable the non-eeprom-stored custom lighting on PERF layer */ +enum my_keycodes { + RGB_TOG_NO = SAFE_RANGE, + RGB_M_2, + RGB_M_3, + RGB_M_4, + RGB_M_5, + RGB_M_6, + RGB_M_7, + RGB_M_8, + RGB_M_9, + RGB_M_0 +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case RGB_TOG_NO: + if (record->event.pressed) { + rgb_matrix_toggle_noeeprom(); + } + return false; + case RGB_M_2: + if (record->event.pressed) { + rgb_matrix_mode(RGB_MATRIX_ALPHAS_MODS); + } + return false; + case RGB_M_3: + if (record->event.pressed) { + rgb_matrix_mode(RGB_MATRIX_BREATHING); + } + return false; + case RGB_M_4: + if (record->event.pressed) { + rgb_matrix_mode(RGB_MATRIX_CYCLE_UP_DOWN); + } + return false; + case RGB_M_5: + if (record->event.pressed) { + rgb_matrix_mode(RGB_MATRIX_CYCLE_ALL); + } + return false; + case RGB_M_6: + if (record->event.pressed) { + rgb_matrix_mode(RGB_MATRIX_CYCLE_SPIRAL); + } + return false; + case RGB_M_7: + if (record->event.pressed) { + rgb_matrix_mode(RGB_MATRIX_TYPING_HEATMAP); + } + return false; + case RGB_M_8: + if (record->event.pressed) { + rgb_matrix_mode(RGB_MATRIX_SOLID_REACTIVE); + } + return false; + case RGB_M_9: + if (record->event.pressed) { + rgb_matrix_mode(RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE); + } + return false; + case RGB_M_0: + if (record->event.pressed) { + rgb_matrix_mode(RGB_MATRIX_CUSTOM_SINGLE_COLOR_RAINDROPS); + } + return false; + default: + return true; // Process all other keycodes normally + } +} + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [BASE] = LAYOUT_75_iso( /* keymap for layer 0 */ + KC_ESC, 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_F13, KC_PSCR, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_ENT, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_HOME, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN1),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + + [GAME] = LAYOUT_75_iso( /* keymap for layer 1 - GAME disables WIN key and has RGB layer indicators */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [PERF] = LAYOUT_75_iso( /* keymap for layer 2 - PERF has a static LED display to increase matrix scan rates */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FN2),KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [_FN1] = LAYOUT_75_iso( /* keymap for layer 3 */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, RGB_M_P, RGB_M_2, RGB_M_3, RGB_M_4, RGB_M_5, RGB_M_6, RGB_M_7, RGB_M_8, RGB_M_9, RGB_M_0, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + RGB_TOG, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MAGIC_TOGGLE_NKRO,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, TG(GAME),KC_TRNS, TO(PERF), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [_FN2] = LAYOUT_75_iso( /* keymap for layer 4 */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG_NO,KC_NO, KC_NO, KC_MPRV, KC_MPLY, KC_MNXT, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + RGB_TOG_NO,KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_NO, KC_TRNS, TG(PERF), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +/* RGB matrix indicator code +It reads the current matrix color, offsets the hue by 30, +and sets val to either 255 or, if defined, RGB_MATRIX_MAXIMUM_BRIGHTNESS +This is applied to both caps lock, and other indicator keys for layer 1 */ + +bool rgb_matrix_indicators_user(void) { + /* Layer 2 (perf mode on this keymap) is not supposed to have LED refreshes, hence excluded */ + if (!IS_LAYER_ON(2)) { + HSV hsv_ind = {rgb_matrix_get_hue()+30,255,INDICATOR_MAX_BRIGHTNESS}; + RGB rgb_ind = hsv_to_rgb(hsv_ind); + + /* Sets Caps to different color as indicator. If RGB mode is rain, and caps indicator is off, the LED will always be off. + This is to avoid having the LED persist on until the animation randomly refreshes it. */ + if (host_keyboard_led_state().caps_lock) { + rgb_matrix_set_color(CAPS_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + } else if (rgb_matrix_get_mode() == 10) { + rgb_matrix_set_color(CAPS_LED_INDEX, 0, 0, 0); + } + + /* Sets W, A, S, D, LGUI to a different color as layer indicator */ + if(IS_LAYER_ON(1)) { + HSV hsv_ind = {rgb_matrix_get_hue()+30,255,INDICATOR_MAX_BRIGHTNESS}; + RGB rgb_ind = hsv_to_rgb(hsv_ind); + + rgb_matrix_set_color(W_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + rgb_matrix_set_color(A_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + rgb_matrix_set_color(S_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + rgb_matrix_set_color(D_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + rgb_matrix_set_color(WIN_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + } + } + return true; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + /* Set LEDs to "GAME_MODE" custom animation when entering layer 2 (perf mode), reload matrix from eeprom when exiting */ + if(IS_LAYER_ON_STATE(state, 2)) { + rgb_matrix_mode_noeeprom(RGB_MATRIX_CUSTOM_STATIC_GAME_MODE); + } else { + rgb_matrix_reload_from_eeprom(); + } + + /* If reverting to base layer (no special LED effects) and single color rain is on, set "layer 1" mods back to matrix color to avoid single key persistence */ + if(!IS_LAYER_ON_STATE(state, 2) && !IS_LAYER_ON_STATE(state, 1) && rgb_matrix_get_mode() == 10) { + HSV hsv_mat = rgb_matrix_get_hsv(); + RGB rgb_mat = hsv_to_rgb(hsv_mat); + + rgb_matrix_set_color(W_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); + rgb_matrix_set_color(A_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); + rgb_matrix_set_color(S_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); + rgb_matrix_set_color(D_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); + rgb_matrix_set_color(WIN_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); + } + return state; +} \ No newline at end of file diff --git a/keyboards/teleport/native/iso/keymaps/perfmode/rules.mk b/keyboards/teleport/native/iso/keymaps/perfmode/rules.mk new file mode 100644 index 0000000000..b735c48f20 --- /dev/null +++ b/keyboards/teleport/native/iso/keymaps/perfmode/rules.mk @@ -0,0 +1,4 @@ +DEBOUNCE_TYPE = asym_eager_defer_pk + +VIA_ENABLE = yes + \ No newline at end of file diff --git a/keyboards/teleport/native/iso/keymaps/via/keymap.c b/keyboards/teleport/native/iso/keymaps/via/keymap.c new file mode 100644 index 0000000000..b77e7fa61d --- /dev/null +++ b/keyboards/teleport/native/iso/keymaps/via/keymap.c @@ -0,0 +1,98 @@ +/* Copyright 2023 Moritz Plattner + * + * 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 . + */ +#include QMK_KEYBOARD_H + +enum layers{ + BASE, + GAME, + _FN1 +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [BASE] = LAYOUT_75_iso( /* keymap for layer 0 */ + KC_ESC, 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_F13, KC_PSCR, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_ENT, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_HOME, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN1),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + + [GAME] = LAYOUT_75_iso( /* keymap for layer 1 - GAME disables WIN key and has RGB layer indicators */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [_FN1] = LAYOUT_75_iso( /* keymap for layer 2 */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_RMOD, + RGB_TOG, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_MOD, + KC_TRNS, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MAGIC_TOGGLE_NKRO,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, TG(GAME),KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +/* RGB matrix indicator code +It reads the current matrix color, offsets the hue by 30, +and sets val to either 255 or, if defined, RGB_MATRIX_MAXIMUM_BRIGHTNESS +This is applied to both caps lock, and other indicator keys for layer 1 */ + +bool rgb_matrix_indicators_user(void) { + HSV hsv_ind = {rgb_matrix_get_hue()+30,255,INDICATOR_MAX_BRIGHTNESS}; + RGB rgb_ind = hsv_to_rgb(hsv_ind); + + /* Sets Caps to different color as indicator. If RGB mode is rain, and caps indicator is off, the LED will always be off. + This is to avoid having the LED persist on until the animation randomly refreshes it. */ + if (host_keyboard_led_state().caps_lock) { + rgb_matrix_set_color(CAPS_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + } else if (rgb_matrix_get_mode() == 10) { + rgb_matrix_set_color(CAPS_LED_INDEX, 0, 0, 0); + } + + /* Sets W, A, S, D, LGUI to a different color as layer indicator */ + if(IS_LAYER_ON(1)) { + HSV hsv_ind = {rgb_matrix_get_hue()+30,255,INDICATOR_MAX_BRIGHTNESS}; + RGB rgb_ind = hsv_to_rgb(hsv_ind); + + rgb_matrix_set_color(W_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + rgb_matrix_set_color(A_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + rgb_matrix_set_color(S_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + rgb_matrix_set_color(D_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + rgb_matrix_set_color(WIN_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); + } + return true; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + /* If reverting to base layer (no special LED effects) and rain animation is on, set "layer 1" mods back to matrix color to avoid single key persistence*/ + if(!IS_LAYER_ON_STATE(state, 1) && rgb_matrix_get_mode() == 10) { + HSV hsv_mat = rgb_matrix_get_hsv(); + RGB rgb_mat = hsv_to_rgb(hsv_mat); + + rgb_matrix_set_color(W_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); + rgb_matrix_set_color(A_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); + rgb_matrix_set_color(S_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); + rgb_matrix_set_color(D_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); + rgb_matrix_set_color(WIN_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); + } + return state; +} \ No newline at end of file diff --git a/keyboards/teleport/native/iso/keymaps/via/rules.mk b/keyboards/teleport/native/iso/keymaps/via/rules.mk new file mode 100644 index 0000000000..cc393f0b29 --- /dev/null +++ b/keyboards/teleport/native/iso/keymaps/via/rules.mk @@ -0,0 +1,2 @@ + VIA_ENABLE = yes + \ No newline at end of file diff --git a/keyboards/teleport/native/iso/rules.mk b/keyboards/teleport/native/iso/rules.mk new file mode 100644 index 0000000000..7ff128fa69 --- /dev/null +++ b/keyboards/teleport/native/iso/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank \ No newline at end of file -- cgit v1.2.3