How to get to point you can have per key RGB control for keyboard and macropad?

Yes, it’s actually BL_STEP. I don’t recall why Via calls it BL_CYCLE, if I ever even knew. Via has an annoying habit of using different names for several keys. The real names are found in /keyboards/framework/ansi/keymaps/default/keymap.c

I don’t know if I understand.
All of the files in /keyboards/framework/ can be modified with whichever editor you wish. As long as you don’t try to rename files. When compiling, QMK does some error checking, for things that it’s able to at least.

That would be placed into your keymap.c file. Exactly where you’d put it depends on what you want to do. For changing colors when changing layers, take a look at docs.qmk.fm/#/feature_layers?id=layer-change-code

i was asking if any steps need to be input by command in the qmk portal rather than edited in the actual files directly.

Sorry, what qmk portal?

Do you mean QMK toolbox?
docs.qmk.fm/#/newbs_flashing?id=flashing-your-keyboard-with-qmk-toolbox
I’ve never even looked at that since I’m on Linux.
It looks like it’s just to help with other chips that aren’t as easy as the RP2040 which is used in Framework’s keyboards. It even mentions

QMK Toolbox is not necessary for flashing RP2040 devices.

I have how to flash your firmware in my guide here Custom QMK firmware? - #14 by MJ1

there is two portals. the qmk toolbox and the QMK_MSYS. like i know setting up the environment you need to use the QMK_MSYS to input the commands for like where the directory is and the github url to the files. is there anything else that needs to be input in the portal or can it all be done directly in the files?

i have added the QK_BOOT on my momentary layer so that is how i get to point of flashing. but i have not compiled any files yet only through VIA so far as i knew i wasnt doing it correctly so far. i finally found the framework folder which for some reason was not part of my 3 other downloads of the qmk_firmware zip file. not sure why but at least now i can see that everything is ready for me to add the color settings. i would not be anywhere as confused if i knew what folders to look for in the beginning so it would be easier to follow your directions.

QMK toolbox doesn’t look like it provides anything one needs for flashing RP2040 chips.

QMK_MSYS, since I’m not on windows, I’m not certain. It looks like it just helps setup your build environment and also provides a command line terminal, where you should be able to enter the compile and / or flash commands.

Can you run

qmk doctor

in the QMK_MSYS window? If everything is good it will end with “QMK is ready to go”.

qmk doctor will list your home directory. Saying Ψ QMK home: /some-path/

If it doesn’t throw errors at you, then you should be good.

You can also try compiling just to see if it throws errors at you

 qmk compile -kb framework/ansi -km default

Yeah, I can’t check the exact issues right now, but the Framework fork of QMK has some old bugs with the qmk doctor command, so trying to compile is the best way to check if it’s working. I think it’s that it fails to detect some binaries.

ok so i went down the path for RGB_MATRIX but found that RBGLIGHT is a better fit to create layers with rgb segments from ranges. the problem is that when i turned on RGBLIGHT i started getting errors. does anyone know what the driver would be for RGBLIGHT?
this is the start of the error:

platforms/chibios/drivers/ws2812_bitbang.c:12:10: error: #error (“NOP_FUDGE configuration required”)
12 | # error(“NOP_FUDGE configuration required”)

what platform and drivers does the RGB ansi keyboard even fall under?
i know what the driver is for the RGB_MATRIX so dont need that.

Whenever there are errors with modifications you’ve made, you really need to link your code, all of the files, like a github repo. The errors given when compiling often aren’t specific enough to know exactly what’s wrong just from seeing the error. All that error tells is that it tried to use the WS2812 driver, the default bitbang one.

But, not sure if you can switch to rgblight. The Framework RGB keyboard is using a IS31FL3743A RGB controller. I took a look and I don’t see built-in support for it with rgblight, only rgb_matrix.

1 Like

The reason I wanted to switch to RGBLIGHT is that it allows layers and can use ranges so don’t need to do each RGB separately. Also RGBLIGHT allows you to step the brightness but when I had the colors switched using rgb matrix it would step the brightness of the keys that were not changed and the keys that were changed were stuck at max brightness. I even tried to adjust the levels by lowering the values but it stayed max. That is with the rgb_matrix_set_color(index, r, g, b). I will try to switch the out with the i,h,s,v version to see if that works.

When I was just using matrix I had some warnings about this:

[WARNINGS]
|
| a:/program files/qmk_msys/mingw64/bin/…/lib/gcc/arm-none-eabi/12.2.0/…/…/…/…/arm-none-eabi/bin/ld.exe: warning: .build/framework_ansi_Cory.elf has a LOAD segment with RWX permissions
| a:/program files/qmk_msys/mingw64/bin/…/lib/gcc/arm-none-eabi/12.2.0/…/…/…/…/arm-none-eabi/bin/ld.exe: warning: .build/framework_ansi_Cory.elf has a LOAD segment with RWX permissions

i looked for the issue but you can only see that info in terminal. no direct access and i was lost trying to find the segments i needed to look at. although i did find on accident that if you compile a second time right after then it comes back with no warnings and no issues with it working once bootloaded. does this mean it hid the warnings on second compile or was it fixed somehow on second try?

To facilitate RGBLIGHT and using ranges i went through the files and rearranged the matrix so now the numbers start at 0 on the escape key and increases by one going right. i had no errors with this (as long as RGBLIGHT was not enabled) and i got every key assigned correctly.

When i only enabled RGBLIGHT and no code added in the keyboard files then it would spit out a ton of errors that all fall under the snippet i copied in my last reply. would you like me to copy and paste the whole error section in another reply?

i really think the RGBLIGHT errors were because the driver was not defined so it picked that one and qmk didnt like it at compile.

if you need anything copied or linked so you can see just let me know.

oh and looking into the files that code RGBLIGHT i found that RGBLIGHT is RGB_MATRIX as it was defined under RGBLIGHT_ENABLE inside rgb_matrix.h in the quantum folder. This is just a few i copied from the file.

define rgblight_toggle rgb_matrix_toggle

define rgblight_enable rgb_matrix_enable

define rgblight_disable rgb_matrix_disable

define rgblight_is_enabled rgb_matrix_is_enabled

define rgblight_mode rgb_matrix_mode

define rgblight_get_mode rgb_matrix_get_mode

define rgblight_step rgb_matrix_step

so why does it go crazy when i enable RGBLIGHT?

As MJ1 mentioned, we really need to see your code to understand what might be causing your problems. Can you at least paste the keymap.c file someplace? If you put it here, make sure to wrap it in ``` (3 backticks) on each end for readability.

That said, two thoughts from me:

  • I get the same warnings about LOAD segments when I compile. The Framework code is a bit of a work-in-progress, but that hasn’t stopped it from working for me.

  • My RGB code is minimal, but it sounds like you need a minimal starting point. Here’s my function for it:

bool rgb_matrix_indicators_user(void) {
  if (rgb_matrix_config.enable == 1) {
    if (layer_state_cmp(layer_state, _QWERTY_BASE)) {
        // Highlight F and J keys (normal home index keys)
        rgb_matrix_set_color(43, 64, 64, 0);
        rgb_matrix_set_color(49, 64, 64, 0);
    } else {
        // Highlight F and K keys (Colemak T and N with right hand shifted)
        rgb_matrix_set_color(43, 64, 64, 64);
        rgb_matrix_set_color(50, 64, 64, 64);
    }

    if (layer_state_cmp(layer_state, _FM)) {
        // Highlight function keys
        rgb_matrix_set_color(21, 128, 128, 128);
        rgb_matrix_set_color(19, 128, 128, 128);
        rgb_matrix_set_color(18, 128, 128, 128);
        rgb_matrix_set_color(20, 128, 128, 128);
        rgb_matrix_set_color(22, 128, 128, 128);
        rgb_matrix_set_color(24, 128, 128, 128);
        rgb_matrix_set_color(26, 128, 128, 128);
        rgb_matrix_set_color(67, 128, 128, 128);
        rgb_matrix_set_color(74, 128, 128, 128);
        rgb_matrix_set_color(68, 128, 128, 128);
        rgb_matrix_set_color(66, 128, 128, 128);
        rgb_matrix_set_color(71, 128, 128, 128);
        rgb_matrix_set_color(70, 128, 128, 128);
    }

  }
  return true;
}

If you want to cover more keys at once, look into rgb_matrix_indicators_advanced_user, as described here. This example shows handling all LEDs at once:

bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
    for (uint8_t i = led_min; i < led_max; i++) {
        switch(get_highest_layer(layer_state|default_layer_state)) {
            case 2:
                rgb_matrix_set_color(i, RGB_BLUE);
                break;
            case 1:
                rgb_matrix_set_color(i, RGB_YELLOW);
                break;
            default:
                break;
        }
    }
    return false;
}

That said, I expect it to be trickier for the Framework keyboard if you want to target certain chunks of the keyboard, given the very non-linear layout of the LEDs by index.

2 Likes

Yeah, either not specifying a rgblight driver or leaving something else out will cause it to try to fall back to the default one, the WS2812 bitbang driver.

But as I said, I see no support for IS31FL3743A with rgblight. So, you can’t specify the driver you would need. That’s the true issue.

IS31FL3743A uses the shared common is31fl3731 driver. Try to use it, and it will tell you it’s not a valid driver for rgblight.

 * RGBLIGHT_DRIVER=is31fl3731 is not a valid RGB type                                                  [ERRORS]

builddefs/common_features.mk:310: *** Invalid RGBLIGHT_DRIVER.  Stop.

All of the Framework keyboard’s RGB leds are connected to 2x IS31FL3743A RGB controllers. There is no other way to control them. Unless you are able to add support, you can’t use rgblight.

I don’t know if it’s the issue, but I suggest doing qmk clean before every compile or flash. You can get random problems if you don’t.

1 Like

@Cory_Galloway if you paste your whole files here, please also wrap it in a colapsed block to save the thread from being hard to scroll.
Like this:

[details="/framework/ansi/keymaps/default/keymap.c"]

```c
(keymap.c file code)
```
[/details]

example:

/framework/ansi/keymaps/default/keymap.c
// Copyright 2022 Framework Computer
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H
#include "framework.h"

enum _layers {
  _BASE,
  _FN,
  _FN_LOCK,
  _FM
};


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     /*
     *         ┌─────┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬────┐
     * 14 keys │ESC  │Mut│vDn│vUp│Prv│Ply│Nxt│bDn│bUp│Scn│Air│Prt│App│Del │
     *         ├───┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┤
     * 14 keys │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │Backsp│
     *         ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬────┤
     * 14 keys │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \  │
     *         ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴────┤
     * 13 keys │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Enter │
     *         ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───────┤
     * 12 keys │ Shift  │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │  Shift  │
     *         ├────┬───┼───┼───┼───┴───┴───┴───┴───┼───┼───┼───┴┬───┬────┤
     *         │    │   │   │   │                   │   │   │    │↑  │    │
     * 11 keys │Ctrl│FN │GUI│Alt│                   │Alt│Ctl│ ←  ├───┤  → │
     *         │    │   │   │   │                   │   │   │    │  ↓│    │
     *         └────┴───┴───┴───┴───────────────────┴───┴───┴────┴───┴────┘
     * 78 total
     */
    [_BASE] = LAYOUT(
        KC_ESC,  KC_MUTE, KC_VOLD, KC_VOLU, KC_MPRV, KC_MPLY, KC_MNXT, KC_BRID, KC_BRIU, KC_SCRN, KC_AIRP, KC_PSCR, KC_MSEL, 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_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_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_LSFT,          KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH,          KC_RSFT,
        KC_LCTL, MO(_FN), KC_LGUI, KC_LALT,          KC_SPC,                    KC_RALT, KC_RCTL, KC_LEFT,   KC_UP, KC_DOWN, KC_RGHT
    ),
     /*
     * Function layer
     *         ┌─────┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬────┐
     * 14 keys │FN lk│F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│Ins │
     *         ├───┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┤
     * 14 keys │   │   │   │   │   │   │   │   │   │   │   │   │   │      │
     *         ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬────┤
     * 14 keys │     │   │RGB│Nxt│Hue│Sat│Spd│Brt│   │   │Pau│   │   │    │
     *         ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴────┤
     * 13 keys │      │   │SRq│Prv│Hue│Sat│Spd│Brt│ScL│   │   │   │       │
     *         ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───────┤
     * 12 keys │        │   │   │   │   │   │Brk│   │   │   │   │         │
     *         ├────┬───┼───┼───┼───┴───┴───┴───┴───┼───┼───┼───┴┬───┬────┤
     *         │    │   │   │   │                   │   │   │    │PgU│    │
     * 11 keys │    │   │   │   │ Toggle Backlight  │   │   │Home├───┤End │
     *         │    │   │   │   │                   │   │   │    │PgD│    │
     *         └────┴───┴───┴───┴───────────────────┴───┴───┴────┴───┴────┘
     * 78 total
     */
    [_FN] = LAYOUT(
        FN_LOCK, 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_INS,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
        _______, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_SPI, RGB_VAI, _______, _______, KC_PAUS, _______, _______, _______,
        _______, _______, KC_SYRQ, RGB_RMOD,RGB_HUD, RGB_SAD, RGB_SPD, RGB_VAD, KC_SCRL, _______, _______, _______,          _______,
        _______,          _______, _______, BL_BRTG, _______, KC_BRK,  _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______,          BL_STEP,                   _______, _______, KC_HOME, KC_PGUP, KC_PGDN, KC_END
    ),
    // Function lock layer
    // Everything on F-row locked to function layer, except ESC and DEL
    [_FN_LOCK] = LAYOUT(
        _______, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, MO(_FM), _______, _______,          _______,                   _______, _______, _______, _______, _______, _______
    ),
    // Locked+temporary FN (back to base plus extra keys)
    [_FM] = LAYOUT(
        FN_LOCK, KC_MUTE, KC_VOLD, KC_VOLU, KC_MPRV, KC_MPLY, KC_MNXT, KC_BRID, KC_BRIU, KC_SCRN, KC_AIRP, KC_PSCR, KC_MSEL,  KC_INS,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
        _______, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_SPI, RGB_VAI, _______, _______, KC_PAUS, _______, _______, _______,
        _______, _______, KC_SYRQ, RGB_RMOD,RGB_HUD, RGB_SAD, RGB_SPD, RGB_VAD, KC_SCRL, _______, _______, _______,          _______,
        _______,          _______, _______, BL_BRTG, _______, KC_BRK,  _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______,          BL_STEP,                   _______, _______, KC_HOME, KC_PGUP, KC_PGDN, KC_END
    ),
};

// Make sure to keep FN Lock even after reset
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    switch (keycode) {
        case FN_LOCK:
            if (record->event.pressed) {
                if (layer_state_is(_FN)) {
                    set_single_persistent_default_layer(_FN_LOCK);
                }
                if (layer_state_is(_FM)) {
                    set_single_persistent_default_layer(_BASE);
                }
            }
            return false;
            break;
        default:
            break;
    }
    return true;
}

The option is under the gear icon in the post editor.

2 Likes

thanks for info. i didnt want to paste the whole file and not sure how to add my files to github so i can give a link. i really want to let you see my keymap and other keyboard files i changed. i have only touched the files inside the keyboard folder. nothing higher than that folder was changed only referenced to find any errors inside my keyboard files. i just have to see if i can clean up the matrix without breaking it. i already cleaned up the rgb id’s so it starts at 0 in top left corner and goes in reading order in reading down the keyboard. so i think i can use rgb matrix with a bool setup that i input the start and end led to create segments so dont have to specify each rgb individually unless its just for a key not in a range specified. it will take me a minute to code those options but after trial and error and reading everything on qmk i can as reference i think i am good to go as long as i can find the commands and keycodes in the quantum and other folders that is where the commands were created to see how to use them correctly. which helps way more than some of the documentation on the websites that is kinda light on details.

While creating a proper fork of the Framework repo is the best way to store and share code, there is also the option of a gist. You can put multiple files in a single gist.
What is a GitHub gist? A Beginner’s Guide to GitHub gists

The RP2040 has so much memory that it isn’t any problem just specifying the keys you want individually. Of course, the color you wish to set can be a variable, so you don’t have to repeat that, and so you can change colors easily. But I get that it looks neater if you can condense specifying the keys.

There are two 21’s and no 10 here. I think the row 6 key 2 is LED 10 for K110, correct?

1 Like

Yep, looks like it’s LED index 10 for that key. Thanks for the correction! I updated the map. Maybe I looked at K101 instead of K110.

1 Like

I have been working on 6 versions of the per key RGB keymaps but this is the only one that is sorta polished and have not found any conflicts so far. ANYONE please take a look and if you got any changes that would increase speed or use less data for same tasks it would be appreciated. I also have ones for the macropad that work for me but i need to polish those too before uploading. you can see my macropad in the images on the README file.

I worked out how to change the RGB’s brightness like how backlight step works for animation brightness. and also now you can have per key RGB or turn off the RGB brightness and the animation colors will be active and you can configure in the RGB layer.

1 Like