qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

keymap.c (4354B)


      1 /* Copyright 2023 a_marmot
      2 *
      3 * This program is free software: you can redistribute it and/or modify
      4 * it under the terms of the GNU General Public License as published by
      5 * the Free Software Foundation, either version 2 of the License, or
      6 * (at your option) any later version.
      7 *
      8 * This program is distributed in the hope that it will be useful,
      9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11 * GNU General Public License for more details.
     12 *
     13 * You should have received a copy of the GNU General Public License
     14 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     15 */
     16 
     17 #include QMK_KEYBOARD_H
     18 
     19 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     20 
     21 //generic default keymap with Razor defaults (+ mode toggle)
     22 
     23     /*
     24      * ┌───┬───┬───┬───┬───┐
     25      * │Esc│ 1 │ 2 │ 3 │ 4 │
     26      * ├───┼───┼───┼───┼───┤
     27      * │Tab│ q │ w │ e │ r │
     28      * ├───┼───┼───┼───┼───┤
     29      * │Cap│ a │ s │ d │ f │
     30      * ├───┼───┼───┼───┼───┤
     31      * │Shi│ z │ x │ c │ v │
     32      * ├───┼───┼───┼───┼───┤
     33      * │Alt│ ↑ │ ↓ │ → │ ← │
     34      * ├───────┴┬──┴───┴───┤
     35      * │Spacebar│change map│
     36      * └────────┴──────────┘
     37      */
     38      
     39      [0] = LAYOUT(
     40         KC_ESC, KC_1, KC_2, KC_3, KC_4,
     41         KC_TAB, KC_Q, KC_W, KC_E, KC_R,
     42         KC_CAPS, KC_A, KC_S, KC_D, KC_F,
     43         KC_LSFT, KC_Z, KC_X, KC_C, KC_V,
     44         KC_LALT, KC_UP, KC_DOWN, KC_RIGHT, KC_LEFT,
     45         KC_SPACE, TO(1)
     46     ),
     47 
     48 //Second example keymap with all modifier keys replaced with numbers or letters
     49 
     50     /*
     51      * ┌───┬───┬───┬───┬───┐
     52      * │ 0 │ 1 │ 2 │ 3 │ 4 │
     53      * ├───┼───┼───┼───┼───┤
     54      * │ i │ q │ w │ e │ r │
     55      * ├───┼───┼───┼───┼───┤
     56      * │ j │ a │ s │ d │ f │
     57      * ├───┼───┼───┼───┼───┤
     58      * │ k │ z │ x │ c │ v │
     59      * ├───┼───┼───┼───┼───┤
     60      * │ l │ ↑ │ ↓ │ → │ ← │
     61      * ├───────┴┬──┴───┴───┤
     62      * │Spacebar│change map│
     63      * └────────┴──────────┘
     64      */
     65      
     66    [1] = LAYOUT(
     67         KC_0, KC_1, KC_2, KC_3, KC_4,
     68         KC_I, KC_Q, KC_W, KC_E, KC_R,
     69         KC_J, KC_A, KC_S, KC_D, KC_F,
     70         KC_K, KC_Z, KC_X, KC_C, KC_V,
     71         KC_L, KC_UP, KC_DOWN, KC_RIGHT, KC_LEFT,
     72         KC_SPACE, TO(0)
     73     ) 
     74 //, add more keymaps here
     75 
     76 };
     77 
     78 static const uint8_t colormap[][20][3] = {
     79 
     80 // colors for the default key map in hex RGB values
     81 	{
     82 		{0x00, 0x00, 0xFF},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},
     83 		{0xFF, 0x70, 0x00},{0x00, 0xFF, 0xFF},{0x80, 0x00, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},
     84 		{0xFF, 0x70, 0x00},{0x80, 0x00, 0xFF},{0x80, 0x00, 0xFF},{0x80, 0x00, 0xFF},{0x00, 0xFF, 0xFF},
     85 		{0xFF, 0x70, 0x00},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF}
     86 	},
     87 	
     88 // colors for the 2nd key map 
     89 	{
     90 		{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},
     91 		{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x80, 0x00, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},
     92 		{0x00, 0xFF, 0xFF},{0x80, 0x00, 0xFF},{0x80, 0x00, 0xFF},{0x80, 0x00, 0xFF},{0x00, 0xFF, 0xFF},
     93 		{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF}
     94 	}
     95 //, add more keymaps here
     96 
     97 };	
     98 
     99 
    100 bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
    101     for (uint8_t i = led_min; i < led_max; i++) {
    102        	rgb_matrix_set_color(i, 
    103        	colormap[get_highest_layer(layer_state|default_layer_state)][i][0],
    104        	colormap[get_highest_layer(layer_state|default_layer_state)][i][1],
    105        	colormap[get_highest_layer(layer_state|default_layer_state)][i][2]);
    106 	}
    107 	
    108     return false;
    109 }
    110