Custom QMK Firmware for Macropad

I have created a custom firmware for the macro pad (simplified version below).
I have issues with getting the firmware to work properly. It seems there is still some remnance from the original firmware interacting with it.

keymap.c

// Copyright 2022 Framework Computer
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H
#include "factory.h"


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    [0] = LAYOUT(
        TO(0),    TO(1),      TO(2),       KC_NO,
        KC_TAB,   KC_MINS,    KC_PLUS,     KC_BSPC,
        KC_7,     KC_8,       KC_9,        KC_EQL,
        KC_4,     KC_5,       KC_6,        KC_ASTR,
        KC_1,     KC_2,       KC_3,        KC_SLSH,
        KC_COMM,  KC_0,       KC_DOT,      KC_ENT
    ),
    [1] = LAYOUT(
        _______, _______,    _______,    _______,
        KC_PSCR, KC_SCRL,    KC_PAUSE,   KC_ESC,
        KC_INS,  KC_HOME,    KC_PGUP,    C(KC_HOME),
        KC_DEL,  KC_END,     KC_PGDN,    C(KC_END),
        KC_NO,   KC_UP,      KC_NO,      KC_NO, 
        KC_LEFT, KC_DOWN,    KC_RIGHT,   KC_ENTER
    ),
    [2] = LAYOUT(
        _______, _______, _______, _______,
        KC_E,    KC_F,    KC_G,    KC_H,
        KC_I,    KC_J,    KC_K,    KC_L,
        KC_M,    KC_N,    KC_O,    KC_P,
        KC_Q,    KC_R,    KC_S,    KC_T,
        KC_U,    KC_V,    KC_W,    KC_X
    ),
};

I compile the code with no issues like this

qmk compile -kb framework/macropad -km darkcruix

Then Flash it to the macropad (attaching it with 2 + 6) held down, so it is in bootloader mode while attaching:

qmk flash -kb framework/macropad -km darkcruix

All seems to work fine, but I can’t toggle the layers at all. It stays at layer 0 whatever layer button I press.

Any help is much appreciated.

SOLVED

If someone else looks for a solution, edit the rules.mk (./keyboards/framework/rules.mk) and change these lines:

VIA_ENABLE = no
RAW_ENABLE = yes

Here’s my modified macropad (keycaps and QMK firmware). The macropad changes colors depending on the function of the respective layer.

https://youtu.be/_tV2mSwzBRE

Did you clear persistent memory / EEPROM after flashing your new firmware? Via keymaps are stored there. Parts of it or all of it will remain, and it will take precedence after flashing new firmware.

Disabling Via will have a similar effect, since any persistent memory will just not be used.

1 Like

By Request, here are is the SCAD file for the keycaps (3D printed):
Key_Cap_Cover.scad (3.2 KB)

keycap with cutout:

module key_cap_cover(){
difference(){          
linear_extrude(layer_height*4,scale=0.9)r_square([width,length],1.2,center=true);
translate([-width/20+margin_1[0],length/4-margin_1[1],layer_height-0.2])linear_extrude(layer_height*3+0.2,scale=1.1)text(key_1, font = font,halign="center",valign="center",size=font_size+font_deviation_1);
translate([-width/4+margin_2[0],-length/4+margin_2[1],layer_height])linear_extrude(layer_height*3,scale=1.1)text(key_2, font = font,halign="center",valign="center",size=font_size+font_deviation_2);
translate([width/4-margin_3[0],length/4-margin_3[1],layer_height])linear_extrude(layer_height*3,scale=1.1)text(key_3, font = font,halign="center",valign="center",size=font_size+font_deviation_3);
translate([width/20-margin_4[0],-length/4+margin_4[1],layer_height-0.2])linear_extrude(layer_height*3+0.2,scale=1.1)text(key_4, font = font,halign="center",valign="center",size=font_size+font_deviation_4);
translate([0+center_offset[0],0+center_offset[1],layer_height])linear_extrude(layer_height*3,scale=1.1)text(key_center, font = font,halign="center",valign="center",size=font_size+font_deviation_center);

}
}

Just the legend:

module key_cap_cover(){
union(){          
linear_extrude(layer_height*4,scale=0.9)r_square([width,length],1.2,center=true);
translate([-width/20+margin_1[0],length/4-margin_1[1],layer_height-0.2])linear_extrude(layer_height*3+0.2,scale=1.1)text(key_1, font = font,halign="center",valign="center",size=font_size+font_deviation_1);
translate([-width/4+margin_2[0],-length/4+margin_2[1],layer_height])linear_extrude(layer_height*3,scale=1.1)text(key_2, font = font,halign="center",valign="center",size=font_size+font_deviation_2);
translate([width/4-margin_3[0],length/4-margin_3[1],layer_height])linear_extrude(layer_height*3,scale=1.1)text(key_3, font = font,halign="center",valign="center",size=font_size+font_deviation_3);
translate([width/20-margin_4[0],-length/4+margin_4[1],layer_height-0.2])linear_extrude(layer_height*3+0.2,scale=1.1)text(key_4, font = font,halign="center",valign="center",size=font_size+font_deviation_4);
translate([0+center_offset[0],0+center_offset[1],layer_height])linear_extrude(layer_height*3,scale=1.1)text(key_center, font = font,halign="center",valign="center",size=font_size+font_deviation_center);

}
}

QMK code for the MacroPad:

// Copyright 2022 Framework Computer
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H
#include "factory.h"


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    [0] = LAYOUT(
        TO(0),    TO(1),      TO(2),       TO(3),
        KC_TAB,   KC_MINS,    KC_PLUS,     KC_BSPC,
        KC_7,     KC_8,       KC_9,        KC_EQL,
        KC_4,     KC_5,       KC_6,        KC_ASTR,
        KC_1,     KC_2,       KC_3,        KC_SLSH,
        KC_COMM,  KC_0,       KC_DOT,      KC_ENT
    ),
    [1] = LAYOUT(
        _______, _______,    _______,    _______,
        KC_PSCR, KC_SCRL,    KC_PAUSE,   KC_ESC,
        KC_INS,  KC_HOME,    KC_PGUP,    C(KC_HOME),
        KC_DEL,  KC_END,     KC_PGDN,    C(KC_END),
        KC_NO,   KC_UP,      KC_NO,      KC_NO,
        KC_LEFT, KC_DOWN,    KC_RIGHT,   KC_ENTER
    ),
    [2] = LAYOUT(
        _______, _______, _______, _______,
        KC_E,    KC_F,    KC_G,    KC_H,
        KC_I,    KC_J,    KC_K,    KC_L,
        KC_M,    KC_N,    KC_O,    KC_P,
        KC_Q,    KC_R,    KC_S,    KC_T,
        KC_U,    KC_V,    KC_W,    KC_X
    ),
    [3] = LAYOUT(
        _______, _______, _______, _______,
        KC_E,    KC_F,    KC_G,    KC_H,
        KC_I,    KC_J,    KC_K,    KC_L,
        KC_M,    KC_N,    KC_O,    KC_P,
        KC_Q,    KC_R,    KC_S,    KC_T,
        KC_U,    KC_V,    KC_W,    KC_X
    ),

};

bool rgb_matrix_indicators_user(void) {
  if (rgb_matrix_config.enable == 1) {
    if (layer_state_cmp(layer_state, 0)) {
        // Highlight Number Keys 
        rgb_matrix_set_color(4, 147, 112, 219); // tab		C1 R2
        rgb_matrix_set_color(7, 128, 0, 128); // 7 ins	C1 R3
        rgb_matrix_set_color(6, 128, 0, 128); // 4 del	C1 R4
        rgb_matrix_set_color(9, 128, 0, 128); // 1 		C1 R5
        rgb_matrix_set_color(0, 147, 112, 219); // -		C2 R2
        rgb_matrix_set_color(1, 128, 0, 128); // 8 hom	C2 R3
        rgb_matrix_set_color(3, 128, 0, 128); // 5 end	C2 R4
        rgb_matrix_set_color(11, 128, 0, 128); // 2 		C2 R5
        rgb_matrix_set_color(8, 147, 112, 219); // ,		C1 R6
        rgb_matrix_set_color(20, 147, 112, 219); // + 		C3 R2
        rgb_matrix_set_color(21, 128, 0, 128); // 9		C3 R3
        rgb_matrix_set_color(23, 128, 0, 128); // 6		C3 R4
        rgb_matrix_set_color(15, 128, 0, 128); // 3		C3 R5
        rgb_matrix_set_color(14, 147, 112, 219); // .		C3 R6 
        rgb_matrix_set_color(18, 147, 112, 219); // bckspc	C4 R2
        rgb_matrix_set_color(19, 147, 112, 219); // *		C4 R4 
    rgb_matrix_set_color(12, 147, 112, 219); // enter	C4 R6
        rgb_matrix_set_color(5, 128, 0, 128); // mod1         C1 R1
        rgb_matrix_set_color(2, 255, 255, 0); // mod2		C2 R1
        rgb_matrix_set_color(17, 128, 128, 128); // mod4 	C4 R1
        rgb_matrix_set_color(16, 147, 112, 219); // =		C4 R3
        rgb_matrix_set_color(13, 147, 112, 219); // /		C4 R5
        rgb_matrix_set_color(10, 128, 0, 128); // 0		C2 R6
    rgb_matrix_set_color(22, 0, 0, 255); // mod3	C3 R1
    }
    if (layer_state_cmp(layer_state, 1)) {
        // Highlight Number Keys 
        rgb_matrix_set_color(4, 255, 255, 204); // tab		C1 R2
        rgb_matrix_set_color(7, 255, 255, 0); // 7 ins	C1 R3
        rgb_matrix_set_color(6, 255, 255, 0); // 4 del	C1 R4
        rgb_matrix_set_color(9, 0, 0, 0); // 1 		C1 R5
        rgb_matrix_set_color(0, 255, 255, 204); // -		C2 R2
        rgb_matrix_set_color(1, 255, 255, 0); // 8 hom	C2 R3
        rgb_matrix_set_color(3, 255, 255, 0); // 5 end	C2 R4
        rgb_matrix_set_color(11, 255, 255, 0); // 2 		C2 R5
        rgb_matrix_set_color(8, 255, 255, 0); // ,		C1 R6
        rgb_matrix_set_color(20, 255, 255, 204); // + 		C3 R2
        rgb_matrix_set_color(21, 255, 255, 0); // 9		C3 R3
        rgb_matrix_set_color(23, 255, 255, 0); // 6		C3 R4
        rgb_matrix_set_color(15, 0, 0, 0); // 3		C3 R5
        rgb_matrix_set_color(14, 255, 255, 0); // .		C3 R6 
        rgb_matrix_set_color(18, 255, 255, 204); // bckspc	C4 R2
        rgb_matrix_set_color(19, 255, 255, 204); // *		C4 R4 
    rgb_matrix_set_color(12, 255, 255, 204); // enter	C4 R6
        rgb_matrix_set_color(5, 128, 0, 128); // mod1         C1 R1
        rgb_matrix_set_color(2, 255, 255, 0); // mod2		C2 R1
        rgb_matrix_set_color(17, 128, 128, 128); // mod4 	C4 R1
        rgb_matrix_set_color(16, 255, 255, 204); // =		C4 R3
        rgb_matrix_set_color(13, 255, 255, 204); // /		C4 R5
        rgb_matrix_set_color(10, 255, 255, 0); // 0		C2 R6
    rgb_matrix_set_color(22, 0, 0, 255); // mod3	C3 R1
    }
    if (layer_state_cmp(layer_state, 2)) {
        // Highlight Number Keys 
        rgb_matrix_set_color(4, 30, 144, 255); // tab		C1 R2
        rgb_matrix_set_color(7, 30, 144, 255); // 7 ins	C1 R3
        rgb_matrix_set_color(6, 30, 144, 255); // 4 del	C1 R4
        rgb_matrix_set_color(9, 30, 144, 255); // 1 		C1 R5
        rgb_matrix_set_color(0, 30, 144, 255); // -		C2 R2
        rgb_matrix_set_color(1, 30, 144, 255); // 8 hom	C2 R3
        rgb_matrix_set_color(3, 30, 144, 255); // 5 end	C2 R4
        rgb_matrix_set_color(11, 30, 144, 255); // 2 		C2 R5
        rgb_matrix_set_color(8, 30, 144, 255); // ,		C1 R6
        rgb_matrix_set_color(20, 30, 144, 255); // + 		C3 R2
        rgb_matrix_set_color(21, 30, 144, 255); // 9		C3 R3
        rgb_matrix_set_color(23, 30, 144, 255); // 6		C3 R4
        rgb_matrix_set_color(15, 30, 144, 255); // 3		C3 R5
        rgb_matrix_set_color(14, 30, 144, 255); // .		C3 R6 
        rgb_matrix_set_color(18, 30, 144, 255); // bckspc	C4 R2
        rgb_matrix_set_color(19, 30, 144, 255); // *		C4 R4 
    rgb_matrix_set_color(12, 30, 144, 255); // enter	C4 R6
        rgb_matrix_set_color(5, 128, 0, 128); // mod1         C1 R1
        rgb_matrix_set_color(2, 255, 255, 0); // mod2		C2 R1
        rgb_matrix_set_color(17, 128, 128, 128); // mod4 	C4 R1
        rgb_matrix_set_color(16, 30, 144, 255); // =		C4 R3
        rgb_matrix_set_color(13, 30, 144, 255); // /		C4 R5
        rgb_matrix_set_color(10, 30, 144, 255); // 0		C2 R6
    rgb_matrix_set_color(22, 0, 0, 255); // mod3	C3 R1
    }
    if (layer_state_cmp(layer_state, 3)) {
        // Highlight Number Keys 
        rgb_matrix_set_color(4, 8, 8, 8); // tab		C1 R2
        rgb_matrix_set_color(7, 8, 8, 8); // 7 ins	C1 R3
        rgb_matrix_set_color(6, 8, 8, 8); // 4 del	C1 R4
        rgb_matrix_set_color(9, 8, 8, 8); // 1 		C1 R5
        rgb_matrix_set_color(0, 8, 8, 8); // -		C2 R2
        rgb_matrix_set_color(1, 8, 8, 8); // 8 hom	C2 R3
        rgb_matrix_set_color(3, 8, 8, 8); // 5 end	C2 R4
        rgb_matrix_set_color(11, 8, 8, 8); // 2 		C2 R5
        rgb_matrix_set_color(8, 8, 8, 8); // ,		C1 R6
        rgb_matrix_set_color(20, 8, 8, 8); // + 		C3 R2
        rgb_matrix_set_color(21, 8, 8, 8); // 9		C3 R3
        rgb_matrix_set_color(23, 8, 8, 8); // 6		C3 R4
        rgb_matrix_set_color(15, 8, 8, 8); // 3		C3 R5
        rgb_matrix_set_color(14, 8, 8, 8); // .		C3 R6 
        rgb_matrix_set_color(18, 8, 8, 8); // bckspc	C4 R2
        rgb_matrix_set_color(19, 8, 8, 8); // *		C4 R4 
    rgb_matrix_set_color(12, 8, 8, 8); // enter	C4 R6
        rgb_matrix_set_color(5, 8, 0, 8); // mod1         C1 R1
        rgb_matrix_set_color(2, 8, 8, 0); // mod2		C2 R1
        rgb_matrix_set_color(17, 8, 8, 8); // mod4 	C4 R1
        rgb_matrix_set_color(16, 8, 8, 8); // =		C4 R3
        rgb_matrix_set_color(13, 8, 8, 8); // /		C4 R5
        rgb_matrix_set_color(10, 8, 8, 8); // 0		C2 R6
    rgb_matrix_set_color(22, 0, 0, 8); // mod3	C3 R1
    }




  }
  return true;
}

I’m getting ready to buy a Framework 16 in the next few weeks and plan on getting the macropad. In anticipation, I have laid out my idea for the macropad setup and written my keymap.c file based on this thread. I can’t test it yet, but any thoughts, feedback, or suggestions are welcome.

Layouts:





Layout Concept

keymap.c

// Copyright 2022 Framework Computer
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H
#include "factory.h"

enum custom_keycodes {
    WORDCOUNT = SAFE_RANGE,
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    [0] = LAYOUT(   //Numpad
        TO(0),         TO(1),         TO(2),             TO(3),
        RGB_VAI,       KC_KP_SLASH,   KC_KP_ASTERISK,    KC_KP_MINUS,
        KC_KP_7,       KC_KP_8,       KC_KP_9,           KC_KP_PLUS,
        KC_KP_4,       KC_KP_5,       KC_KP_6,           KC_PERCENT,
        KC_KP_1,       KC_KP_2,       KC_KP_3,           KC_KP_EQUAL,
        KC_BACKSPACE,  KC_KP_0,       KC_KP_DOT,         KC_ENTER
    ),
    [1] = LAYOUT(   //Arrows
        _______,       _______,       _______,            _______,
        RGB_VAI,       KC_INSERT,     KC_SCROLL_LOCK,     KC_PRINT_SCREEN,
        XXXXXXX,       XXXXXXX,       XXXXXXX,            XXXXXXX,
        KC_HOME,       KC_PGUP,       KC_PGDN,            KC_END,
        XXXXXXX,       KC_UP,         XXXXXXX,            XXXXXXX,
        KC_LEFT,       KC_DOWN,       KC_RIGHT,           _______
    ),
    [2] = LAYOUT(   //Docs
        _______,       _______,       _______,            _______,
        C(KC_B),       C(KC_I),       C(KC_U),            LSA(KC_5),
        RCS(KC_L),     RCS(KC_E),     RCS(KC_R),          WORDCOUNT,
        LCA(KC_4),     LCA(KC_5),     XXXXXXX,            RCS(KC_8),
        LCA(KC_1),     LCA(KC_2),     LCA(KC_3),          RCS(KC_7),
        XXXXXXX,       LCA(KC_0),     XXXXXXX,            _______
    ),
    [3] = LAYOUT(   //Windows
        _______,       _______,       _______,            _______,
        RGB_VAI,       C(KC_T),       C(KC_W),            RCS(KC_T),
        C(KC_Z),       C(KC_Y),       XXXXXXX,            XXXXXXX,
        G(KC_4),       G(KC_5),       G(KC_6),            XXXXXXX,
        G(KC_1),       G(KC_2),       G(KC_3),            XXXXXXX,
        LCA(KC_N),     LCA(KC_F),     LCA(KC_T),          _______
    ),

};

bool process_record_user(uint16_t keycode, keyrecord* record) {
  switch (keycode) {
    case WORDCOUNT:
      if (record->event.pressed) {
        SEND_STRING(SS_TAP(RCS(KC_C)) 
                    SS_DELAY(250) 
                    SS_TAP(KC_SPACE)
                    SS_DELAY(50) 
                    SS_TAP(KC_TAB) 
                    SS_DELAY(50)
                    SS_TAP(KC_TAB)
                    SS_DELAY(50)
                    SS_TAP(KC_ENTER));
      }
      return false;
  }
  return true;
}

bool rgb_matrix_indicators_user(void) {
  if (rgb_matrix_config.enable == 1) {
    if (layer_state_cmp(layer_state, 0)) {
        // Numpad 
        rgb_matrix_set_color(4,  RGB_WHITE);    // RGB      C1 R2
        rgb_matrix_set_color(7,  RGB_RED);      // 7 	    C1 R3
        rgb_matrix_set_color(6,  RGB_RED);      // 4        C1 R4
        rgb_matrix_set_color(9,  RGB_RED);      // 1 	    C1 R5
        rgb_matrix_set_color(0,  RGB_PINk);     // slash    C2 R2
        rgb_matrix_set_color(1,  RGB_RED);      // 8    	C2 R3
        rgb_matrix_set_color(3,  RGB_RED);      // 5    	C2 R4
        rgb_matrix_set_color(11, RGB_RED);      // 2 		C2 R5
        rgb_matrix_set_color(8,  RGB_Pink);     // BkSp	    C1 R6
        rgb_matrix_set_color(20, RGB_PINK);     // X 		C3 R2
        rgb_matrix_set_color(21, RGB_RED);      // 9		C3 R3
        rgb_matrix_set_color(23, RGB_RED);      // 6		C3 R4
        rgb_matrix_set_color(15, RGB_RED);      // 3		C3 R5
        rgb_matrix_set_color(14, RGB_PINK);     // .		C3 R6 
        rgb_matrix_set_color(18, RGB_PINK);     // -	    C4 R2
        rgb_matrix_set_color(19, RGB_PINK);     // %		C4 R4 
        rgb_matrix_set_color(12, RGB_WHITE);    // Enter    C4 R6
        rgb_matrix_set_color(5,  RGB_RED);      // Numpad   C1 R1
        rgb_matrix_set_color(2,  RGB_GREEN);    // Arrows   C2 R1
        rgb_matrix_set_color(17, RGB_YELLOW);   // Windows	C4 R1
        rgb_matrix_set_color(16, RGB_PINK);     // +		C4 R3
        rgb_matrix_set_color(13, RGB_PINK);     // =		C4 R5
        rgb_matrix_set_color(10, RGB_RED);      // 0		C2 R6
        rgb_matrix_set_color(22, RGB_BLUE);     // Docs     C3 R1
    }
    if (layer_state_cmp(layer_state, 1)) {
        // Arrows 
        rgb_matrix_set_color(4,  RGB_WHITE);        // RGB      C1 R2
        rgb_matrix_set_color(7,  RGB_BLACK);        // None 	C1 R3
        rgb_matrix_set_color(6,  RGB_SPRINGGREEN);  // Home     C1 R4
        rgb_matrix_set_color(9,  RGB_BLACK);        // None 	C1 R5
        rgb_matrix_set_color(0,  RGB_SPRINGGREEN);  // Insert   C2 R2
        rgb_matrix_set_color(1,  RGB_BLACK);        // None    	C2 R3
        rgb_matrix_set_color(3,  RGB_SPRINGGREEN);  // Page Up	C2 R4
        rgb_matrix_set_color(11, RGB_GREEN);        // Up 		C2 R5
        rgb_matrix_set_color(8,  RGB_GREEN);        // Left	    C1 R6
        rgb_matrix_set_color(20, RGB_SPRINGGREEN);  // ScrLck   C3 R2
        rgb_matrix_set_color(21, RGB_BLACK);        // None		C3 R3
        rgb_matrix_set_color(23, RGB_SPRINGGREEN);  // Page Dwn	C3 R4
        rgb_matrix_set_color(15, RGB_BLACK);        // None		C3 R5
        rgb_matrix_set_color(14, RGB_GREEN);        // Right	C3 R6 
        rgb_matrix_set_color(18, RGB_SPRINGGREEN);  // Prt Scr  C4 R2
        rgb_matrix_set_color(19, RGB_SPRINGGREEN);  // End		C4 R4 
        rgb_matrix_set_color(12, RGB_WHITE);        // Enter    C4 R6
        rgb_matrix_set_color(5,  RGB_RED);          // Numpad   C1 R1
        rgb_matrix_set_color(2,  RGB_GREEN);        // Arrows   C2 R1
        rgb_matrix_set_color(17, RGB_YELLOW);       // Windows	C4 R1
        rgb_matrix_set_color(16, RGB_BLACK);        // None		C4 R3
        rgb_matrix_set_color(13, RGB_BLACK);        // None		C4 R5
        rgb_matrix_set_color(10, RGB_GREEN);        // Down		C2 R6
        rgb_matrix_set_color(22, RGB_BLUE);         // Docs     C3 R1
    }
    if (layer_state_cmp(layer_state, 2)) {
        // Docs 
        rgb_matrix_set_color(4,  RGB_BLUE);    // Bold      C1 R2
        rgb_matrix_set_color(7,  RGB_TEAL);    // Left	    C1 R3
        rgb_matrix_set_color(6,  RGB_BLUE);    // Head 4    C1 R4
        rgb_matrix_set_color(9,  RGB_BLUE);    // Head 1    C1 R5
        rgb_matrix_set_color(0,  RGB_BLUE);    // italic    C2 R2
        rgb_matrix_set_color(1,  RGB_TEAL);    // Center 	C2 R3
        rgb_matrix_set_color(3,  RGB_BLUE);    // Head 5 	C2 R4
        rgb_matrix_set_color(11, RGB_BLUE);    // Head 2	C2 R5
        rgb_matrix_set_color(8,  RGB_BLACK);   // None	    C1 R6
        rgb_matrix_set_color(20, RGB_BLUE);    // U Line	C3 R2
        rgb_matrix_set_color(21, RGB_TEAL);    // Right     C3 R3
        rgb_matrix_set_color(23, RGB_BLACK);   // None		C3 R4
        rgb_matrix_set_color(15, RGB_BLUE);    // Head 3    C3 R5
        rgb_matrix_set_color(14, RGB_BLACK);   // None		C3 R6 
        rgb_matrix_set_color(18, RGB_BLUE);    // Stike     C4 R2
        rgb_matrix_set_color(19, RGB_TEAL);    // bullet	C4 R4 
        rgb_matrix_set_color(12, RGB_WHITE);   // Enter     C4 R6
        rgb_matrix_set_color(5,  RGB_RED);     // Numpad    C1 R1
        rgb_matrix_set_color(2,  RGB_GREEN);   // Arrows    C2 R1
        rgb_matrix_set_color(17, RGB_YELLOW);  // Windows	C4 R1
        rgb_matrix_set_color(16, RGB_TEAL);    // WordCount	C4 R3
        rgb_matrix_set_color(13, RGB_TEAL);    // numbers	C4 R5
        rgb_matrix_set_color(10, RGB_BLUE);    // normal	C2 R6
        rgb_matrix_set_color(22, RGB_BLUE);    // Docs      C3 R1
    }
    if (layer_state_cmp(layer_state, 3)) {
        // Windows 
        rgb_matrix_set_color(4,  RGB_WHITE);        // RGB      C1 R2
        rgb_matrix_set_color(7,  RGB_GOLDENROD);    // Undo	    C1 R3
        rgb_matrix_set_color(6,  RGB_YELLOW);       // Desk 4   C1 R4
        rgb_matrix_set_color(9,  RGB_YELLOW);       // Desk 1   C1 R5
        rgb_matrix_set_color(0,  RGB_YELLOW);       // NewTab   C2 R2
        rgb_matrix_set_color(1,  RGB_GOLDENROD);    // Redo    	C2 R3
        rgb_matrix_set_color(3,  RGB_YELLOW);       // Desk 5  	C2 R4
        rgb_matrix_set_color(11, RGB_YELLOW);       // Desk 2   C2 R5
        rgb_matrix_set_color(8,  RGB_GOLDENROD);    // NotePad  C1 R6
        rgb_matrix_set_color(20, RGB_YELLOW);       // CloseTab	C3 R2
        rgb_matrix_set_color(21, RGB_BLACK);        // None		C3 R3
        rgb_matrix_set_color(23, RGB_YELLOW);       // Desk 6	C3 R4
        rgb_matrix_set_color(15, RGB_YELLOW);       // Desk 3	C3 R5
        rgb_matrix_set_color(14, RGB_GOLDENROD);    // Terminal	C3 R6 
        rgb_matrix_set_color(18, RGB_YELLOW);       // Opentab  C4 R2
        rgb_matrix_set_color(19, RGB_BLACK);        // None		C4 R4 
        rgb_matrix_set_color(12, RGB_WHITE);        // Enter    C4 R6
        rgb_matrix_set_color(5,  RGB_RED);          // Numpad   C1 R1
        rgb_matrix_set_color(2,  RGB_GREEN);        // Arrows   C2 R1
        rgb_matrix_set_color(17, RGB_YELLOW);       // Windows	C4 R1
        rgb_matrix_set_color(16, RGB_BLACK);        // None		C4 R3
        rgb_matrix_set_color(13, RGB_BLACK);        // None		C4 R5
        rgb_matrix_set_color(10, RGB_GOLDENROD);    // Files	C2 R6
        rgb_matrix_set_color(22, RGB_BLUE);         // Docs     C3 R1
    }

  }
  return true;
}