diff options
| author | ebastler <[email protected]> | 2022-12-21 11:03:50 +0100 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2022-12-21 21:03:50 +1100 | 
| commit | b8a9de206d38f0e047c2f07bca398d6fe53b76a9 (patch) | |
| tree | dc963a9603fd9dec74a6fab18c0ca3589a11e911 | |
| parent | c0e54737ad98aedf06ab45d29a2639a97985d56c (diff) | |
| download | qmk_firmware-b8a9de206d38f0e047c2f07bca398d6fe53b76a9.tar.gz qmk_firmware-b8a9de206d38f0e047c2f07bca398d6fe53b76a9.zip | |
Add Anvil Native keyboard (#19333)
Co-authored-by: Drashna Jaelre <[email protected]>
25 files changed, 1590 insertions, 0 deletions
| diff --git a/keyboards/teleport/native/ansi/ansi.c b/keyboards/teleport/native/ansi/ansi.c new file mode 100644 index 0000000000..d053ed88eb --- /dev/null +++ b/keyboards/teleport/native/ansi/ansi.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 <http://www.gnu.org/licenses/>. + */ + +#include QMK_KEYBOARD_H + +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = { { +    // Key Matrix to LED Index, LED 61 omitted on ANSI +    { 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     }, \ +    { NO_LED, 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, the LED at { 0,0 } in row 5 is there to catch a non-existing LED on ANSI +    {  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 }, {205,26 }, {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 }, {200,38 },            {224,38 },  +    {  9,51 }, {  0,0  }, { 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, the 0 flag in row 5 is there to catch a non-existing LED on ANSI +    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,    1, 1, +    1, 0, 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/ansi/info.json b/keyboards/teleport/native/ansi/info.json new file mode 100644 index 0000000000..2894d2688c --- /dev/null +++ b/keyboards/teleport/native/ansi/info.json @@ -0,0 +1,6 @@ +{ +    "usb": { +        "pid": "0x0003" +    } +} + diff --git a/keyboards/teleport/native/ansi/keymaps/default/keymap.c b/keyboards/teleport/native/ansi/keymaps/default/keymap.c new file mode 100644 index 0000000000..fcea5c41f3 --- /dev/null +++ b/keyboards/teleport/native/ansi/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 <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +enum layers{ +    BASE, +    GAME, +    _FN1 +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +    [BASE] = LAYOUT_75_ansi(    /* 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_BSLS,     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_ENT,      KC_HOME, +        KC_LSFT,          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_ansi(    /* 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_NO,   KC_TRNS,                            KC_TRNS,                            KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +    ), + +    [_FN1] = LAYOUT_75_ansi(    /* 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, 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/ansi/keymaps/perfmode/config.h b/keyboards/teleport/native/ansi/keymaps/perfmode/config.h new file mode 100644 index 0000000000..a99590cd1c --- /dev/null +++ b/keyboards/teleport/native/ansi/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 <http://www.gnu.org/licenses/>. +*/ + +#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/ansi/keymaps/perfmode/keymap.c b/keyboards/teleport/native/ansi/keymaps/perfmode/keymap.c new file mode 100644 index 0000000000..1a7852a062 --- /dev/null +++ b/keyboards/teleport/native/ansi/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 <http://www.gnu.org/licenses/>. + */ +#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_ansi(    /* 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_BSLS,     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_ENT,      KC_HOME, +        KC_LSFT,          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_ansi(    /* 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_NO,   KC_TRNS,                            KC_TRNS,                            KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +    ), +     +    [PERF] = LAYOUT_75_ansi(    /* 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_NO,   KC_TRNS,                            KC_TRNS,                            KC_TRNS, MO(_FN2),KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +    ), + +    [_FN1] = LAYOUT_75_ansi(    /* 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, 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_ansi(    /* 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_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/ansi/keymaps/perfmode/rules.mk b/keyboards/teleport/native/ansi/keymaps/perfmode/rules.mk new file mode 100644 index 0000000000..b735c48f20 --- /dev/null +++ b/keyboards/teleport/native/ansi/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/ansi/keymaps/via/keymap.c b/keyboards/teleport/native/ansi/keymaps/via/keymap.c new file mode 100644 index 0000000000..e1fbd285ec --- /dev/null +++ b/keyboards/teleport/native/ansi/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 <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +enum layers{ +    BASE, +    GAME, +    _FN1 +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +    [BASE] = LAYOUT_75_ansi(    /* 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_BSLS,     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_ENT,      KC_HOME, +        KC_LSFT,          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_ansi(    /* 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_NO,   KC_TRNS,                            KC_TRNS,                            KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +    ), + +    [_FN1] = LAYOUT_75_ansi(    /* 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, 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/ansi/keymaps/via/rules.mk b/keyboards/teleport/native/ansi/keymaps/via/rules.mk new file mode 100644 index 0000000000..cc393f0b29 --- /dev/null +++ b/keyboards/teleport/native/ansi/keymaps/via/rules.mk @@ -0,0 +1,2 @@ + VIA_ENABLE = yes + 
\ No newline at end of file diff --git a/keyboards/teleport/native/ansi/rules.mk b/keyboards/teleport/native/ansi/rules.mk new file mode 100644 index 0000000000..7ff128fa69 --- /dev/null +++ b/keyboards/teleport/native/ansi/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank
\ No newline at end of file diff --git a/keyboards/teleport/native/config.h b/keyboards/teleport/native/config.h new file mode 100644 index 0000000000..681b9e8001 --- /dev/null +++ b/keyboards/teleport/native/config.h @@ -0,0 +1,113 @@ +/* +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 <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#include "config_common.h" + +/* Enable NKRO by default*/ +#define FORCE_NKRO + +/* Use 3 dynamic keymap layers */ +#define DYNAMIC_KEYMAP_LAYER_COUNT 3 + +/* i2C Config */ +#define I2C_DRIVER I2CD1 +#define I2C1_SCL_PIN        B6 +#define I2C1_SDA_PIN        B7 +#define I2C1_SCL_PAL_MODE   4 +#define I2C1_SDA_PAL_MODE   4 + +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_16_9 +#define I2C1_CLOCK_SPEED 400000 + + +/* RGB Matrix driver config */ +#define DRIVER_COUNT 2 +#define DRIVER_ADDR_1 0b1010000 +#define DRIVER_ADDR_2 0b1010011 +#define DRIVER_1_LED_TOTAL 46 +#define DRIVER_2_LED_TOTAL 39 +#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) + +#define RGB_MATRIX_LED_FLUSH_LIMIT 32 + +#define RGB_DISABLE_WHEN_USB_SUSPENDED  + +#define RGB_MATRIX_DEFAULT_SPD 40 +#define RGB_MATRIX_DEFAULT_VAL 220 +#define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_CUSTOM_SINGLE_COLOR_RAINDROPS + +#define RGB_MATRIX_KEYPRESSES +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS + +// RGB Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects +#define ENABLE_RGB_MATRIX_ALPHAS_MODS                   // 2 Alphas and mods have different colors +#define ENABLE_RGB_MATRIX_BREATHING                     // 3 Breath a static color +#define ENABLE_RGB_MATRIX_CYCLE_ALL                     // 4 Cycle all colors +#define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN                 // 5 Cycle vertically +#define ENABLE_RGB_MATRIX_CYCLE_SPIRAL                  // 6 Cycle in a spirals +#define ENABLE_RGB_MATRIX_TYPING_HEATMAP                // 7 Heatmap of typing speed +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE                // 8 Static background, pressed keys light up +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE      // 9 Pressed keys and nearby keys light up +#define ENABLE_RGB_MATRIX_CUSTOM_SINGLE_COLOR_RAINDROPS // 0 Single color raindrops, random keys lighting up at randomized intensity +#define ENABLE_RGB_MATRIX_CUSTOM_STATIC_GAME_MODE       // - Game mode sets the entire matrix (static) once, then stops LED refreshes + +#define INDICATOR_MAX_BRIGHTNESS 255 +#ifdef RGB_MATRIX_MAXIMUM_BRIGHTNESS +    #undef INDICATOR_MAX_BRIGHTNESS +    #define INDICATOR_MAX_BRIGHTNESS RGB_MATRIX_MAXIMUM_BRIGHTNESS +#endif + + +/* Define indicator LED indices, used for lighting effects  */ +#define W_LED_INDEX 33 +#define A_LED_INDEX 47 +#define S_LED_INDEX 48 +#define D_LED_INDEX 49 + +#define CAPS_LED_INDEX 46 + +#define WIN_LED_INDEX 76 + +#define ANV_A_LED_INDEX 15 +#define ANV_N_LED_INDEX 30 +#define ANV_V_LED_INDEX 45 +#define ANV_I_LED_INDEX 59 +#define ANV_L_LED_INDEX 74 + +#define NUM_1_LED_INDEX 17 +#define NUM_2_LED_INDEX 18 +#define NUM_3_LED_INDEX 19 +#define NUM_4_LED_INDEX 20 +#define NUM_5_LED_INDEX 21 + +#define M_LED_INDEX 68 +#define K_LED_INDEX 54 +#define O_LED_INDEX 40 +#define NUM_0_LED_INDEX 26 +#define P_LED_INDEX 41 +#define SCLN_LED_INDEX 56 +#define SLSH_LED_INDEX 71 + +/* Since the typing heatmap is broken on duplex matrix boards, force it to "slim" mode */ +#ifdef ENABLE_RGB_MATRIX_TYPING_HEATMAP +    #define RGB_MATRIX_TYPING_HEATMAP_SLIM +#endif + + +/* Set HSE clock since it differs from F411 default */ +#define STM32_HSECLK 16000000 diff --git a/keyboards/teleport/native/info.json b/keyboards/teleport/native/info.json new file mode 100644 index 0000000000..d1fe1b90b4 --- /dev/null +++ b/keyboards/teleport/native/info.json @@ -0,0 +1,217 @@ +{ +    "keyboard_name": "Native", +    "manufacturer": "Anvil", +    "maintainer": "ebastler", +    "url": "https://nvil.gg", +    "bootloader": "stm32-dfu", +    "processor": "STM32F411", +    "board": "GENERIC_STM32_F411XE", +    "usb": { +        "vid": "0x7470", +        "device_version": "1.0.0" +    }, +    "features": { +        "bootmagic": true, +        "command": false, +        "console": false, +        "extrakey": true, +        "mousekey": false, +        "nkro": true +    }, +    "debounce": 5, +    "diode_direction": "ROW2COL", +    "matrix_pins": { +        "cols": [ "A5", "A4", "B12", "B14", "B8", "B3", "B4", "B5" ], +        "rows": [ "C14", "C15", "C13", "A1", "A15", "A14", "A13", "B13", "B15", "A8", "A2", "A3" ] +    }, +    "layouts": { +        "LAYOUT_75_iso": { +            "layout": [ +                {"matrix":[0,0], "x":0, "y":0}, +                {"matrix":[1,0], "x":1, "y":0}, +                {"matrix":[0,1], "x":2, "y":0}, +                {"matrix":[1,1], "x":3, "y":0}, +                {"matrix":[0,2], "x":4, "y":0}, +                {"matrix":[1,2], "x":5, "y":0}, +                {"matrix":[0,3], "x":6, "y":0}, +                {"matrix":[1,3], "x":7, "y":0}, +                {"matrix":[0,4], "x":8, "y":0}, +                {"matrix":[1,4], "x":9, "y":0}, +                {"matrix":[0,5], "x":10, "y":0}, +                {"matrix":[1,5], "x":11, "y":0}, +                {"matrix":[0,6], "x":12, "y":0}, +                {"matrix":[1,6], "x":13, "y":0}, +                {"matrix":[0,7], "x":14, "y":0}, +                {"matrix":[1,7], "x":15, "y":0}, + +                {"matrix":[2,0], "x":0, "y":1}, +                {"matrix":[3,0], "x":1, "y":1}, +                {"matrix":[2,1], "x":2, "y":1}, +                {"matrix":[3,1], "x":3, "y":1}, +                {"matrix":[2,2], "x":4, "y":1}, +                {"matrix":[3,2], "x":5, "y":1}, +                {"matrix":[2,3], "x":6, "y":1}, +                {"matrix":[3,3], "x":7, "y":1}, +                {"matrix":[2,4], "x":8, "y":1}, +                {"matrix":[3,4], "x":9, "y":1}, +                {"matrix":[2,5], "x":10, "y":1}, +                {"matrix":[3,5], "x":11, "y":1}, +                {"matrix":[2,6], "x":12, "y":1}, +                {"matrix":[3,6], "x":13, "y":1, "w":2}, +                {"matrix":[3,7], "x":15, "y":1}, +                 +                {"matrix":[4,0], "x":0, "y":2, "w":1.5}, +                {"matrix":[4,1], "x":1.5, "y":2}, +                {"matrix":[5,1], "x":2.5, "y":2}, +                {"matrix":[4,2], "x":3.5, "y":2}, +                {"matrix":[5,2], "x":4.5, "y":2}, +                {"matrix":[4,3], "x":5.5, "y":2}, +                {"matrix":[5,3], "x":6.5, "y":2}, +                {"matrix":[4,4], "x":7.5, "y":2}, +                {"matrix":[5,4], "x":8.5, "y":2},  +                {"matrix":[4,5], "x":9.5, "y":2},  +                {"matrix":[5,5], "x":10.5, "y":2},  +                {"matrix":[4,6], "x":11.5, "y":2},  +                {"matrix":[5,6], "x":12.5, "y":2},  +                {"matrix":[4,7], "x":13.75, "y":2, "w":1.25, "h":2},  +                {"matrix":[5,7], "x":15, "y":2}, + +                {"matrix":[6,0], "x":0, "y":3, "w":1.75},  +                {"matrix":[7,0], "x":1.75, "y":3},  +                {"matrix":[6,1], "x":2.75, "y":3},  +                {"matrix":[7,1], "x":3.75, "y":3},  +                {"matrix":[6,2], "x":4.75, "y":3},  +                {"matrix":[7,2], "x":5.75, "y":3},  +                {"matrix":[6,3], "x":6.75, "y":3},  +                {"matrix":[7,3], "x":7.75, "y":3},  +                {"matrix":[6,4], "x":8.75, "y":3},  +                {"matrix":[7,4], "x":9.75, "y":3},  +                {"matrix":[6,5], "x":10.75, "y":3},  +                {"matrix":[7,5], "x":11.75, "y":3},  +                {"matrix":[6,7], "x":12.75, "y":3},  +                {"matrix":[7,7], "x":15, "y":3}, + +                {"matrix":[8,0], "x":0, "y":4, "w":1.25},  +                {"matrix":[9,0], "x":1.25, "y":4},  +                {"matrix":[8,1], "x":2.25, "y":4},  +                {"matrix":[9,1], "x":3.25, "y":4},  +                {"matrix":[8,2], "x":4.25, "y":4},  +                {"matrix":[9,2], "x":5.25, "y":4},  +                {"matrix":[8,3], "x":6.25, "y":4},  +                {"matrix":[9,3], "x":7.25, "y":4},  +                {"matrix":[8,4], "x":8.25, "y":4},  +                {"matrix":[9,4], "x":9.25, "y":4},  +                {"matrix":[8,5], "x":10.25, "y":4},  +                {"matrix":[9,5], "x":11.25, "y":4},  +                {"matrix":[9,6], "x":12.25, "y":4, "w":1.75},  +                {"matrix":[8,7], "x":14, "y":4},  +                {"matrix":[9,7], "x":15, "y":4}, + +                {"matrix":[10,0], "x":0, "y":5, "w":1.25},  +                {"matrix":[11,0], "x":1.25, "y":5, "w":1.25},  +                {"matrix":[11,1], "x":2.5, "y":5, "w":1.25},  +                {"matrix":[10,1], "x":3.75, "y":5, "w":6.25},  +                {"matrix":[10,5], "x":10, "y":5},  +                {"matrix":[11,5], "x":11, "y":5},  +                {"matrix":[10,6], "x":12, "y":5},  +                {"matrix":[11,6], "x":13, "y":5},  +                {"matrix":[10,7], "x":14, "y":5},  +                {"matrix":[11,7], "x":15, "y":5} +            ] +        }, +        "LAYOUT_75_ansi": { +            "layout": [ +                {"matrix":[0,0], "x":0, "y":0}, +                {"matrix":[1,0], "x":1, "y":0}, +                {"matrix":[0,1], "x":2, "y":0}, +                {"matrix":[1,1], "x":3, "y":0}, +                {"matrix":[0,2], "x":4, "y":0}, +                {"matrix":[1,2], "x":5, "y":0}, +                {"matrix":[0,3], "x":6, "y":0}, +                {"matrix":[1,3], "x":7, "y":0}, +                {"matrix":[0,4], "x":8, "y":0}, +                {"matrix":[1,4], "x":9, "y":0}, +                {"matrix":[0,5], "x":10, "y":0}, +                {"matrix":[1,5], "x":11, "y":0}, +                {"matrix":[0,6], "x":12, "y":0}, +                {"matrix":[1,6], "x":13, "y":0}, +                {"matrix":[0,7], "x":14, "y":0}, +                {"matrix":[1,7], "x":15, "y":0}, + +                {"matrix":[2,0], "x":0, "y":1}, +                {"matrix":[3,0], "x":1, "y":1}, +                {"matrix":[2,1], "x":2, "y":1}, +                {"matrix":[3,1], "x":3, "y":1}, +                {"matrix":[2,2], "x":4, "y":1}, +                {"matrix":[3,2], "x":5, "y":1}, +                {"matrix":[2,3], "x":6, "y":1}, +                {"matrix":[3,3], "x":7, "y":1}, +                {"matrix":[2,4], "x":8, "y":1}, +                {"matrix":[3,4], "x":9, "y":1}, +                {"matrix":[2,5], "x":10, "y":1}, +                {"matrix":[3,5], "x":11, "y":1}, +                {"matrix":[2,6], "x":12, "y":1}, +                {"matrix":[3,6], "x":13, "y":1, "w":2}, +                {"matrix":[3,7], "x":15, "y":1}, +                 +                {"matrix":[4,0], "x":0, "y":2, "w":1.5}, +                {"matrix":[4,1], "x":1.5, "y":2}, +                {"matrix":[5,1], "x":2.5, "y":2}, +                {"matrix":[4,2], "x":3.5, "y":2}, +                {"matrix":[5,2], "x":4.5, "y":2}, +                {"matrix":[4,3], "x":5.5, "y":2}, +                {"matrix":[5,3], "x":6.5, "y":2}, +                {"matrix":[4,4], "x":7.5, "y":2}, +                {"matrix":[5,4], "x":8.5, "y":2},  +                {"matrix":[4,5], "x":9.5, "y":2},  +                {"matrix":[5,5], "x":10.5, "y":2},  +                {"matrix":[4,6], "x":11.5, "y":2},  +                {"matrix":[5,6], "x":12.5, "y":2},  +                {"matrix":[4,7], "x":13.5, "y":2, "w":1.5},  +                {"matrix":[5,7], "x":15, "y":2}, + +                {"matrix":[6,0], "x":0, "y":3, "w":1.75},  +                {"matrix":[7,0], "x":1.75, "y":3},  +                {"matrix":[6,1], "x":2.75, "y":3},  +                {"matrix":[7,1], "x":3.75, "y":3},  +                {"matrix":[6,2], "x":4.75, "y":3},  +                {"matrix":[7,2], "x":5.75, "y":3},  +                {"matrix":[6,3], "x":6.75, "y":3},  +                {"matrix":[7,3], "x":7.75, "y":3},  +                {"matrix":[6,4], "x":8.75, "y":3},  +                {"matrix":[7,4], "x":9.75, "y":3},  +                {"matrix":[6,5], "x":10.75, "y":3},  +                {"matrix":[7,5], "x":11.75, "y":3},  +                {"matrix":[6,7], "x":12.75, "y":3, "w":2.25},  +                {"matrix":[7,7], "x":15, "y":3}, + +                {"matrix":[8,0], "x":0, "y":4, "w":1.25},  +                {"matrix":[8,1], "x":2.25, "y":4},  +                {"matrix":[9,1], "x":3.25, "y":4},  +                {"matrix":[8,2], "x":4.25, "y":4},  +                {"matrix":[9,2], "x":5.25, "y":4},  +                {"matrix":[8,3], "x":6.25, "y":4},  +                {"matrix":[9,3], "x":7.25, "y":4},  +                {"matrix":[8,4], "x":8.25, "y":4},  +                {"matrix":[9,4], "x":9.25, "y":4},  +                {"matrix":[8,5], "x":10.25, "y":4},  +                {"matrix":[9,5], "x":11.25, "y":4},  +                {"matrix":[9,6], "x":12.25, "y":4, "w":1.75},  +                {"matrix":[8,7], "x":14, "y":4},  +                {"matrix":[9,7], "x":15, "y":4}, + +                {"matrix":[10,0], "x":0, "y":5, "w":1.25},  +                {"matrix":[11,0], "x":1.25, "y":5, "w":1.25},  +                {"matrix":[11,1], "x":2.5, "y":5, "w":1.25},  +                {"matrix":[10,1], "x":3.75, "y":5, "w":6.25},  +                {"matrix":[10,5], "x":10, "y":5},  +                {"matrix":[11,5], "x":11, "y":5},  +                {"matrix":[10,6], "x":12, "y":5},  +                {"matrix":[11,6], "x":13, "y":5},  +                {"matrix":[10,7], "x":14, "y":5},  +                {"matrix":[11,7], "x":15, "y":5} +            ] +        } +    } +} + 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 <http://www.gnu.org/licenses/>. + */ + +#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 <http://www.gnu.org/licenses/>. + */ +#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 <http://www.gnu.org/licenses/>. +*/ + +#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 <http://www.gnu.org/licenses/>. + */ +#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 <http://www.gnu.org/licenses/>. + */ +#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 diff --git a/keyboards/teleport/native/mcuconf.h b/keyboards/teleport/native/mcuconf.h new file mode 100644 index 0000000000..8b5d373bc3 --- /dev/null +++ b/keyboards/teleport/native/mcuconf.h @@ -0,0 +1,28 @@ +/* Copyright 2020 QMK + * + * 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_next "mcuconf.h" + +/* Set PLL M divider from 4 (F411 GENERIC default) to 8, because of 16 MHz crystal on board */ +#undef STM32_PLLM_VALUE +#define STM32_PLLM_VALUE                    8 + +/* enable I2C2, used for the LED drivers */ +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1                  TRUE + +#undef STM32_I2C_USE_DMA +#define STM32_I2C_USE_DMA                   TRUE
\ No newline at end of file diff --git a/keyboards/teleport/native/native.c b/keyboards/teleport/native/native.c new file mode 100644 index 0000000000..042e2bfa95 --- /dev/null +++ b/keyboards/teleport/native/native.c @@ -0,0 +1,124 @@ +/* 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 <http://www.gnu.org/licenses/>. + */ + +#include "quantum.h" + +/* This board has !SDB of the is31 wired to D2. Set high to enable */ +void keyboard_post_init_user(void) { +    setPinOutput(B9); +    writePinHigh(B9); +} + +#ifdef RGB_MATRIX_ENABLE +const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT] = { +    /* Refer to IS31 manual for these locations + *   driver + *   |  R location + *   |  |     G location + *   |  |     |     B location + *   |  |     |     | */ +    {0, L_1,  K_1,  J_1},               // Row 1 +    {0, L_2,  K_2,  J_2}, +    {0, L_3,  K_3,  J_3}, +    {0, L_4,  K_4,  J_4}, +    {0, L_5,  K_5,  J_5}, +    {0, L_6,  K_6,  J_6}, +    {0, L_7,  K_7,  J_7}, +    {0, L_8,  K_8,  J_8}, +    {0, L_9,  K_9,  J_9}, +    {0, L_10, K_10, J_10}, +    {0, L_11, K_11, J_11}, +    {0, L_12, K_12, J_12}, +    {0, L_13, K_13, J_13}, +    {0, L_14, K_14, J_14}, +    {0, L_15, K_15, J_15}, +    {0, L_16, K_16, J_16}, + +    {0, I_1,  H_1,  G_1},               // Row 2 +    {0, I_2,  H_2,  G_2}, +    {0, I_3,  H_3,  G_3}, +    {0, I_4,  H_4,  G_4}, +    {0, I_5,  H_5,  G_5}, +    {0, I_6,  H_6,  G_6}, +    {0, I_7,  H_7,  G_7}, +    {0, I_8,  H_8,  G_8}, +    {0, I_9,  H_9,  G_9}, +    {0, I_10, H_10, G_10}, +    {0, I_11, H_11, G_11}, +    {0, I_12, H_12, G_12}, +    {0, I_13, H_13, G_13}, +    {0, I_15, H_15, G_15}, +    {0, I_16, H_16, G_16}, + +    {0, F_1,  E_1,  D_1},               // Row 3 +    {0, F_3,  E_3,  D_3}, +    {0, F_4,  E_4,  D_4}, +    {0, F_5,  E_5,  D_5}, +    {0, F_6,  E_6,  D_6}, +    {0, F_7,  E_7,  D_7}, +    {0, F_8,  E_8,  D_8}, +    {0, F_9,  E_9,  D_9}, +    {0, F_10, E_10, D_10}, +    {0, F_11, E_11, D_11}, +    {0, F_12, E_12, D_12}, +    {0, F_13, E_13, D_13}, +    {0, F_14, E_14, D_14}, +    {0, F_15, E_15, D_15}, +    {0, F_16, E_16, D_16}, + +    {1, L_1,  K_1,  J_1},               // Row 4 +    {1, L_3,  K_3,  J_3}, +    {1, L_4,  K_4,  J_4}, +    {1, L_5,  K_5,  J_5}, +    {1, L_6,  K_6,  J_6}, +    {1, L_7,  K_7,  J_7}, +    {1, L_8,  K_8,  J_8}, +    {1, L_9,  K_9,  J_9}, +    {1, L_10, K_10, J_10}, +    {1, L_11, K_11, J_11}, +    {1, L_12, K_12, J_12}, +    {1, L_13, K_13, J_13}, +    {1, L_14, K_14, J_14}, +    {1, L_16, K_16, J_16}, + +    {1, I_1,  H_1,  G_1},               // Row 5 +    {1, I_2,  H_2,  G_2}, +    {1, I_3,  H_3,  G_3}, +    {1, I_4,  H_4,  G_4}, +    {1, I_5,  H_5,  G_5}, +    {1, I_6,  H_6,  G_6}, +    {1, I_7,  H_7,  G_7}, +    {1, I_8,  H_8,  G_8}, +    {1, I_9,  H_9,  G_9}, +    {1, I_10, H_10, G_10}, +    {1, I_11, H_11, G_11}, +    {1, I_12, H_12, G_12}, +    {1, I_14, H_14, G_14}, +    {1, I_15, H_15, G_15}, +    {1, I_16, H_16, G_16}, + +    {1, F_1,  E_1,  D_1},               // Row 6 +    {1, F_2,  E_2,  D_2}, +    {1, F_3,  E_3,  D_3}, +    {1, F_7,  E_7,  D_7}, +    {1, F_11, E_11, D_11}, +    {1, F_12, E_12, D_12}, +    {1, F_13, E_13, D_13}, +    {1, F_14, E_14, D_14}, +    {1, F_15, E_15, D_15}, +    {1, F_16, E_16, D_16} +}; +#endif
\ No newline at end of file diff --git a/keyboards/teleport/native/readme.md b/keyboards/teleport/native/readme.md new file mode 100644 index 0000000000..9ac1034fef --- /dev/null +++ b/keyboards/teleport/native/readme.md @@ -0,0 +1,29 @@ +# Anvil Native + +The Native is a hot-swap 75% board with per-key LED ligthing in the Anvil brand lineup.  + +* Keyboard maintainer: [ebastler](https://github.com/ebastler) +* Hardware supported: Anvil Native ISO/ANSI +* Hardware availability: Buy at [nvil.gg](https://www.nvil.gg/products/native-custom-keyboard-iso-de-ansi-de) + +Enter Bootloader:  + +* Bootmagic: Keep ESC (top left key) pressed while plugging the board in +* Physical reset button on the bottom of the PCB + +Make example for this keyboard (after setting up your build environment): + +    qmk compile -kb teleport/native/iso -km default +    qmk compile -kb teleport/native/ansi -km default + +If you want the default keymap with all features present on the board when sold, pick the `perfmode` keymaps instead: + +    qmk compile -kb teleport/native/iso -km perfmode +    qmk compile -kb teleport/native/ansi -km perfmode + +Flash example for this keyboard: + +    qmk flash -kb teleport/native/iso -km default +    qmk flash -kb teleport/native/ansi -km default + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/teleport/native/rgb_matrix_kb.inc b/keyboards/teleport/native/rgb_matrix_kb.inc new file mode 100644 index 0000000000..5df5312a42 --- /dev/null +++ b/keyboards/teleport/native/rgb_matrix_kb.inc @@ -0,0 +1,110 @@ +RGB_MATRIX_EFFECT(SINGLE_COLOR_RAINDROPS) +RGB_MATRIX_EFFECT(STATIC_GAME_MODE) +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +/* This effect has been partially derived from quantum/rgb_matrix/animations/pixel_rain_anim.h and raindrops_anim.h  +It sets random LEDs to matrix color (with very slight hue variation) but random intensity */ +static bool SINGLE_COLOR_RAINDROPS(effect_params_t* params) { +    static uint32_t wait_timer = 0; + +    // interval function and timing in general taken from pixel rain animation +    inline uint32_t interval(void) { +        return 500 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16); +    } + +    void single_color_raindrops_set_color(uint8_t i, effect_params_t * params) { +        if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) { +            return; +        } +         +        // Take matrix color, add between -5 and +5 to hue, random brightness between 0 and val, set to 0 if val between 0 and 5, then write to LED +        HSV hsv = rgb_matrix_get_hsv(); +        hsv.h = rgb_matrix_get_hue() - 2 + random8() % 5; +        hsv.v = random8() % rgb_matrix_get_val(); +        if (hsv.v < 5) {  +            hsv.v = 0; +        } +        RGB rgb = rgb_matrix_hsv_to_rgb(hsv); +        rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); +        wait_timer = g_rgb_timer + interval(); +    } + +    RGB_MATRIX_USE_LIMITS(led_min, led_max); +    if (!params->init) { +        if (g_rgb_timer > wait_timer) { +            single_color_raindrops_set_color(mod8(random8(), RGB_MATRIX_LED_COUNT), params); +        } +    } else { +        for (int i = led_min; i < led_max; i++) { +            single_color_raindrops_set_color(i, params); +        } +    } +    return rgb_matrix_check_finished_leds(led_max); +} + +/* This "effect" is a workaround to fix long matrix scan pauses caused by i2c communication. +When enabled, it writes all relevant LEDs once to static colors, then halts LED refreshes until a different animation is selcted. */ +bool STATIC_GAME_MODE(effect_params_t* params) { + +    void game_mode_set_color(int i, effect_params_t* params) { +        if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) { +            return; +        } + +        HSV hsv = rgb_matrix_get_hsv(); + +        switch (i) { +            case W_LED_INDEX: +            case A_LED_INDEX: +            case S_LED_INDEX: +            case D_LED_INDEX: + +            case M_LED_INDEX: +            case K_LED_INDEX: +            case O_LED_INDEX: +            case P_LED_INDEX: +            case NUM_0_LED_INDEX: +            case SLSH_LED_INDEX: +                break; + +            case SCLN_LED_INDEX: +            case ANV_A_LED_INDEX: +            case ANV_N_LED_INDEX: +            case ANV_V_LED_INDEX: +            case ANV_I_LED_INDEX: +            case ANV_L_LED_INDEX: +                hsv.s = 255; +                hsv.h = rgb_matrix_get_hue()+30; +                break; + +            case NUM_1_LED_INDEX: +            case NUM_2_LED_INDEX: +            case NUM_3_LED_INDEX: +            case NUM_4_LED_INDEX: +            case NUM_5_LED_INDEX: +                hsv.s = 255; +                hsv.h = rgb_matrix_get_hue()+30; +                hsv.v = rgb_matrix_get_val()*2/3; +                break; + +            default: +                hsv.v = 0; +                break; +        } + +        RGB rgb = hsv_to_rgb(hsv); +        rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); +    } + +    RGB_MATRIX_USE_LIMITS(led_min, led_max); +    if (!params->init) { +        // Do not update LEDs after initial blanking +    } else { +        for (int i = led_min; i < led_max; i++) { +            game_mode_set_color(i, params); +        } +    } +    return rgb_matrix_check_finished_leds(led_max); +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/keyboards/teleport/native/rules.mk b/keyboards/teleport/native/rules.mk new file mode 100644 index 0000000000..cac6a5346f --- /dev/null +++ b/keyboards/teleport/native/rules.mk @@ -0,0 +1,5 @@ +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = IS31FL3733 +RGB_MATRIX_CUSTOM_KB = yes + +DEFAULT_FOLDER = teleport/native/iso
\ No newline at end of file | 
