ErwanDouaille / qmk_custom_firmware

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Documentation can be found here : https://docs.qmk.fm/#/feature_rgb_matrix?id=functions

https://old.reddit.com/r/glorious/comments/okrbjg/peeps_qmk_and_via_rgb_guide_only_for_ansi/

GMMK PRO QMK AND VIA RGB/KNOB/LAYER GUIDE FOR ANSI AND ISO AFTER UPDATE

Big thanks to Shady and Elvanos from the Glorious discord for helping me!

edit: thanks to Madnan for finding a crucial spelling error in my post.

0 responsibility on my part if you brick your board

If you are using linux read through the wsl guide, if you are using macos check this and click on MacOs in step 2 on the site, for the Q1 macs read this.

This guide is mostly for the peeps who want more customizability in configuring their qmk map, if you just want to change rgb with keycodes you can use the qmk configurator.

Step 1 Installing the software you need

Install qmk_toolbox (https://github.com/qmk/qmk_toolbox/releases) so you can flash the keyboard.

You can either use qmk.msys or WSL to compile the keymap. I recommend you don't go through the hassle of trying to install WSL if you don't have it running already, but here's a readthrough if you want to use it.

qmk.msys

Install qmk.msys (https://github.com/qmk/qmk_distro_msys/releases/latest) if your antivirus tags it, make an exception. If it is windows defender click more info and then run anyway.

Start QMK.msys

Type:

qmk setup
and press enter

If you are experiencing issue's with the keymap not having rgb, try running qmk setup -b develop instead.

When it is done downloading and doing stuff go to C:\users\your username\qmk_firmware

Make a copy of the default keymap folder (not the keymaps folder) in qmk_firmware\keyboards\gmmk\pro\ansi\keymaps

or

qmk_firmware\keyboards\gmmk\pro\iso\keymaps and rename the folder

I called it peep

If the only keyboard you are going to be editing is the GMMK pro this might save you some time, paste this in qmk_msys or you wsl window if you are running ANSI:

qmk config user.keyboard=gmmk/pro/ansi
If you're using the ISO version of the gmmk pro, paste this instead:

qmk config user.keyboard=gmmk/pro/iso
After that paste this:

qmk config user.keymap=<your keymap name>
So because I renamed the folder to peep it is:

qmk config user.keymap=peep
Now you are ready to edit the keymap

​

Step 2. Editing the keymap

Open the keymap folder you renamed earlier, if you did not do that read step 1 again.

Open that folder and open the keymap.c file, do not rename the keymap.c file

You can use visual studio code or just good old notepad to edit it.

If you are using visual studio code check out this extention to keep track of your brackets.

Keycodes to use.

Check if the keycode works with your operating system!

Knob functions

Do not forget to set a reset button if you have removed it from the keymap,standard is layer 1 pipe key/backslash (\|)

Also for rgb controls, do not forget to set them otherwise you will have zero rgb customizability .

RGB_TOG, RGB_MOD, RGB_RMOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI , RGB_VAD,

​

(2.1) layers

If you want to add another layer copypaste this and replace the X with the layer you want:

ANSI:

    [X] = LAYOUT(
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,          _______,
        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, _______, _______,
        _______, _______, _______,                            _______,                            _______, _______, _______, _______, _______, _______
    ),
ISO:

    [X] = LAYOUT(
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,                   _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, _______, _______,
        _______, _______, _______,                            _______,                            _______, _______, _______, _______, _______, _______
    ),
When switching to a layer make sure the key you are using as a layer switch(MO for example) is kc_trns or ______, on the layer you are switching to in the keymap:

    [0] = LAYOUT(
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,          _______,
        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, _______, _______,
        _______, _______, _______,                            _______,                            _______, MO(1),   _______, _______, _______, _______
    ),                                                                                                     ^^layer switch 

    [1] = LAYOUT(
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,          _______,
        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, _______, _______,
        _______, _______, _______,                            _______,                            _______, _______, _______, _______, _______, _______
    ),                                                                                                     ^^transparant key
As you can see the last key in the keymap doesnt require a comma at the end, please refrain from adding one as that tells the compiler that there's another key coming up!

​

(2.2) KNOB

The knob press key is the top right _______, in the layout.

The knob code looks like this:

bool encoder_update_user(uint8_t index, bool clockwise) {

    if (clockwise) {
      tap_code(KC_VOLU);
    } else {
      tap_code(KC_VOLD);
    }
    return true;
}
If you want the knob to have different functions on different layers copypaste this as a starting point, replacing the old code:

bool encoder_update_user(uint8_t index, bool clockwise) {
  if (index == 0) {
    switch(biton32(layer_state)){
        default:
            if (clockwise) {
                tap_code16(keycode);
            } else {
                tap_code16(keycode);
            }
            break;
        }
    }
    return true;
}
Every layer you add to the knob needs this:

        case <layer number>:
              if (clockwise){
                tap_code16(keycode);
            } else{
                tap_code16(keycode);
            }
            break;
This is how it should look like if you add a layer:

  if (index == 0) {
    switch(biton32(layer_state)){
        case 1:
            if (clockwise){
                tap_code16(C(KC_TAB));
            } else{
                tap_code16(S(C(KC_TAB)));
            }
            break;
        default:
            if (clockwise) {
                tap_code16(KC_WH_D);
            } else {
                tap_code16(KC_WH_U);
            }
            break;
        }
    }
    return true;
}
You can replace the KC_VOLU and KC_VOLD with the keycodes you want.

Some knob functions do not compile if you do not put 16 after the tap_code, so I recommend you just put it at every tap_code to avoid needing to do it later or running into errors.

​

(2.3) RGB

Led brightness is from 0 to 255

Paste this in the keymap.c under the layout and knob,

void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {

}
Capslock, Numlock and Scroll lock indicators:

    if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) {
        RGB_MATRIX_INDICATOR_SET_COLOR(index, R, G, B); //capslock key
    }
    if (IS_HOST_LED_ON(USB_LED_SCROLL_LOCK)) {
    RGB_MATRIX_INDICATOR_SET_COLOR(index, R, G, B); 
    }   
    if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) {   // on if NUM lock is OFF
        RGB_MATRIX_INDICATOR_SET_COLOR(index, R, G, B);
    }
The numlock indicator is set to be turned on when numlock is turned off, as most people have numlock on at all times I recommend you to keep it like this. If you want to add more keys just add: RGB_MATRIX_INDICATOR_SET_COLOR(index, R, G, B);

LayersIf you want a different rgb profile on different layers:

switch(get_highest_layer(layer_state)){  // special handling per layer
            case 1:  //layer one
                RGB_MATRIX_INDICATOR_SET_COLOR(index, R, G, B);
            break;
            default;
                break;
            break;
}
If you want to add a layer, simply copypaste:

case x:  //layer number
                RGB_MATRIX_INDICATOR_SET_COLOR(index, R, G, B);
            break;
so if you have layers 0, 1 and 2:

switch(get_highest_layer(layer_state)){  // special handling per layer
            case 1:  //layer 1
                RGB_MATRIX_INDICATOR_SET_COLOR(index, R, G, B);
            break;
            case 2:  //layer 2
                RGB_MATRIX_INDICATOR_SET_COLOR(index, R, G, B);
            break;
            default: //layer 0
                break;
            break;
}
You can only add one index number, so for every led you want activated on that layer you need to add the RGB_MATRIX_INDICATOR_SET_COLOR(index, R, G, B);

If you want the whole board to give one colour add:

rgb_matrix_set_color_all(r, g, b)
instead of the RGB_MATRIX_INDICATOR_SET_COLOR(index, R, G, B);

You don't have to do this for every layer as the rgb colours you can set using the keycodes will shine on every layer unless its overridden by whats above.

Here is the layout of the leds (index numbers) on the board FOR ANSI:

// RGB LED layout

// led number, function of the key

//  67, Side led 01    0, ESC      6, F1       12, F2       18, F3       23, F4       28, F5       34, F6       39, F7       44, F8       50, F9       56, F10      61, F11      66, F12      69, Prt       Rotary(Mute)   68, Side led 12
//  70, Side led 02    1, ~        7, 1        13, 2        19, 3        24, 4        29, 5        35, 6        40, 7        45, 8        51, 9        57, 0        62, -_       78, (=+)     85, BackSpc   72, Del        71, Side led 13
//  73, Side led 03    2, Tab      8, Q        14, W        20. E        25, R        30, T        36, Y        41, U        46, I        52, O        58, P        63, [{       89, ]}       93, \|        75, PgUp       74, Side led 14
//  76, Side led 04    3, Caps     9, A        15, S        21, D        26, F        31, G        37, H        42, J        47, K        53, L        59, ;:       64, '"                    96, Enter     86, PgDn       77, Side led 15
//  80, Side led 05    4, Sh_L     10, Z       16, X        22, C        27, V        32, B        38, N        43, M        48, ,<       54, .<       60, /?                    90, Sh_R     94, Up        82, End        81, Side led 16
//  83, Side led 06    5, Ct_L     11,Win_L    17, Alt_L                              33, SPACE                              49, Alt_R    55, FN                    65, Ct_R     95, Left     97, Down      79, Right      84, Side led 17
//  87, Side led 07                                                                                                                                                                                                        88, Side led 18
//  91, Side led 08                                                                                                                                                                                                        92, Side led 19
I have included the // on every row so you can paste it in the keymap.

This is the ISO map, made by u/Veyka.

// RGB LED layout ISO

// led number, function of the key

//  68, Side led 01    0, ESC      6, F1       12, F2       18, F3       23, F4       28, F5       34, F6       39, F7       44, F8       50, F9       56, F10      61, F11      66, F12      70, Prt                      Rotary(Mute)   69, Side led 12
//  71, Side led 02    1, `~       7, 1        13, 2        19, 3        24, 4        29, 5        35, 6        40, 7        45, 8        51, 9        57, 0        62, -_       79, (=+)     86, BackSpc                73, Del        72, Side led 13
//  74, Side led 03    2, Tab      8, Q        14, W        20. E        25, R        30, T        36, Y        41, U        46, I        52, O        58, P        63, [{       90, ]}                                    76, PgUp       75, Side led 14
//  77, Side led 04    3, Caps     9, A        15, S        21, D        26, F        31, G        37, H        42, J        47, K        53, L        59, ;:       64, '"       95, #        97, Enter                    87, PgDn       78, Side led 15
//  81, Side led 05    4, Sh_L     67,\          10, Z        16, X        22, C        27, V        32, B        38, N        43, M        48, ,<       54, .<       60, /?                        91, Sh_R     94, Up    83, End        82, Side led 16
//  84, Side led 06    5, Ct_L     11,Win_L    17, Alt_L                                           33, SPACE                                  49, Alt_R    55, FN       65, Ct_R                  96, Left     98, Down  80, Right      85, Side led 17
//  88, Side led 07                                                                                                                                                                                                                      89, Side led 18
//  92, Side led 08                                                                                                                                                                                                                      93, Side led 19
​

When you are done it should look similar to this:

void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {

    if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) {
        RGB_MATRIX_INDICATOR_SET_COLOR(3, 255, 0, 0); //capslock key
    }
    if (IS_HOST_LED_ON(USB_LED_SCROLL_LOCK)) {
        RGB_MATRIX_INDICATOR_SET_COLOR(67, 0, 255, 0); //side led 01
        RGB_MATRIX_INDICATOR_SET_COLOR(70, 0, 255, 0); //side led 02
        RGB_MATRIX_INDICATOR_SET_COLOR(73, 0, 255, 0); //side led 03
    }   
    if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) {   // on if NUM lock is OFF
    RGB_MATRIX_INDICATOR_SET_COLOR(83, 255, 0, 255); //side led 06
    RGB_MATRIX_INDICATOR_SET_COLOR(87, 255, 0, 255); //side led 07
        RGB_MATRIX_INDICATOR_SET_COLOR(91, 255, 0, 255); //side led 08
    }

       switch(get_highest_layer(layer_state)){  // special handling per layer
            case 1:  //layer one
                RGB_MATRIX_INDICATOR_SET_COLOR(0, 255, 0, 255); //esc 
                break;
            case 2:
                RGB_MATRIX_INDICATOR_SET_COLOR(0, 255, 0, 255); //esc
                break;
            case 3:
                rgb_matrix_set_color_all(255, 255, 0)
                break;
            default:
                break;
            break;
    }
}
​

(2.4) adding macro's

Read this for extra keycodes etcIf you want to add macro's to your keymap you need to add this above your keymap:

enum custom_keycodes {
    macro1 = SAFE_RANGE,
    macro2,
    macro3,
};
You can replace macro1, macro 2 and macro 3 with any combination of letters and numbers. You can also add more than 3 macro's, as long as there's storage space.

Then, you add them to the part of the keymap you want the macro in.

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    [0] = LAYOUT(
        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_PSCR,          KC_MUTE,
        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_DEL,
        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_PGUP,
        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_PGDN,
        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(1),   KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
    ),

[1] = LAYOUT(
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET,            _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          macro1,           _______,
        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          macro2,  _______, _______,
        _______, _______, _______,                            _______,                            _______, _______, _______, macro3, _______, _______
    ),


};
Like i did on the enter, right shift and left pointing arrow. Then under the keymap or above doesn't really matter, paste this:

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    switch (keycode) {
    case macro1:
        if (record->event.pressed) { //When you press the key (downstroke)
            SEND_STRING("Hello world"); //types hello world 
        } else { // when you release the key (upstroke)
            SEND_STRING(SS_TAP(X_ENT)) //presses enter 
        }
        break;
    }
    return true;
};
If you dont need a function on the upstroke you can simply add this:

bool process_record_user(uint16_t keycode, keyrecord_t *record) { 
   case macro1:
        if (record->event.pressed) { //When you press the key (downstroke)
            SEND_STRING("Hello world");
        }
        break;
If you do one macro it should look something like this:

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    switch (keycode) {
    case macro1:
        if (record->event.pressed) { //When you press the key (downstroke)
            SEND_STRING("Hello world"); //types hello world 
        } else { // when you release the key (upstroke)
            SEND_STRING(SS_TAP(X_ENT)) //presses enter 
        }
        break;
    }
    return true;
};
If you have multiple it will look something like this:

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    switch (keycode) {
    case macro1:
        if (record->event.pressed) { //When you press the key
            SEND_STRING("Hello World"); //types hello world 
        } else {
            // when you release the key
        }
        break;

    case macro2:
        if (record->event.pressed) {
           SEND_STRING(SS_LGUI("r") SS_DELAY(50) "taskkill /f /IM GTA5.exe" SS_TAP(X_ENT)); //stops GTA5
        }
        break;
    }
    return true;
};
3. VIA

Adding via support to your qmk keymap (not necessary, only if you want to use VIA after flashing the keymap)

Copy the rules.mk file in the qmk_firmware\keyboards\gmmk\pro\ansi or qmk_firmware\keyboards\gmmk\pro\iso folder to the folder of the keymap you are making

Add the following to the rules.mk file you copied to the folder of your keymap:

VIA_ENABLE = yes
If you want VIA support on every keymap add the VIA_ENABLE = yes to the rules.mk in the qmk_firmware\keyboards\gmmk\pro\ansi or qmk_firmware\keyboards\gmmk\pro\iso folder instead.

To stop VIA from giving visual bugs, include at least layer 0 to 3 in the keymap even when those layers consist out of _______,

If you are using the iso version, please add the gmmk_pro_ison.json to the design tab. Thanks to Inffy from the glorious discord for this map.

​

4. Compiling the keymap

When you are done editing the keymap, save it and type this in qmk_msys or your WSL window:

qmk compile
It will compile the keymap and put it in the qmk_firmware\.build folder or at the bottom of the qmk_firmware folder.

If you skipped the "qmk config user.keyboard=gmmk/pro" part, type this instead for ANSI:

qmk compile -kb gmmk/pro/ansi -km <name of your keymaps folder> -j <amount of threads the cpu has>
So for me it is:

qmk compile -kb gmmk/pro/ansi -km peep -j 16
If you're running ISO type this:

qmk compile -kb gmmk/pro/iso -km <name of your keymaps folder> -j <amount of threads the cpu has>
If you are getting compile errors that refer to something in the quantum folder you probably forgot a bracket or used the wrong keycode.

​

5. Flashing the keyboard

Open qmk_toolbox and select the gmmk_pro_keymapname.bin from the qmk_firmware\.build folder (if you went with wsl use the shortcut you have created earlier)

Because I called the keymap folder peep, I need to flash the gmmk_pro_peep.bin

Do not try to flash the .hex file as that does not work with the GMMK Pro's MCU.

Hold spacebar+b on your GMMK Pro while plugging in the usb c cable, this should put it into the bootloader mode.

Now click flash on the top right and it will start flashing the firmware onto the keyboard, it is very important that you do not change anything about the power or data delivery towards the keyboard until it is done flashing, so do not remove the cable, do not turn off your pc, do not flip the switch on your power strip, do not close the program etc.

Done!

#Via bug

When you have flashed the firmware with the via enabled it is possible for the board to not respond(it does not register you typing and the rgb is turned off), you can replug the cable and it should work, if it still does not respond, press the button on the bottom of the pcb while plugging in the usb-c cable and flash the GMMK_PRO_DEFAULT_FIRMWARE_ANSI.bin or GMMK_PRO_DEFAULT_FIRMWARE_ISO.bin file. If you want to use glorious core again(why?!) you can use the same file to go back.

If the layout does not update after flashing another keymap with VIA enabled in the rules.mk file, flash the default keymap for your layout and try again.

If you experienced RGB problems using core and this does not fix that, please get in touch with customer support https://www.pcgamingrace.com/pages/contact-us.

About


Languages

Language:C 97.3%Language:Makefile 2.7%