qmk_firmware icon indicating copy to clipboard operation
qmk_firmware copied to clipboard

Can't solve my RGB matrix

Open Gabriele-tomai00 opened this issue 7 months ago • 4 comments

Hello, I'm having problem with my rgb matrix. In a file <keyboard_name>.c I put this code:

#ifdef RGBLIGHT_ENABLE
led_config_t g_led_config = { {
            {34,     33, 32, 31, 30, 29, 28},
            {22, 23, 24, 25, 26, 27, NO_LED},
            {21, 20, 19, 18, 17, 16, NO_LED},
            {9,      10, 11, 12, 13, 14, 15},
            {8,      7,   6,  5,  4,  3,  2},
            {NO_LED, NO_LED, NO_LED, NO_LED, 1, NO_LED, 0},

                                    {NO_LED, 64,     65, 66, 67, 68, 69, 70},
                                    {63,     62,     61, 60, 59, 58, 57, 56},
                                    {49,     50, 51, 52, 53, 54, 55, NO_LED},
                                    {48, 47, 46, 45, 44, 43, NO_LED, NO_LED},
                                    {37, 38, 39, 40, 41, 42, NO_LED, NO_LED},
                                    {36, 35, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED}}, 
{
          // right part
          4, 4, 4, 4, 4, 4, 4, 
          4, 4, 4, 4, 4, 4,
          4, 4, 4, 4, 4, 4, 
          4, 4, 4, 4, 4, 4, 4,
          4, 4, 4, 4, 4, 4, 4 
                         4, 4,
          // left part
          4, 4, 4, 4, 4, 4, 4, 
       4, 4, 4, 4, 4, 4, 4, 4,
          4, 4, 4, 4, 4, 4, 4,
             4, 4, 4, 4, 4, 4,
             4, 4, 4, 4, 4, 4, 
             4, 4

     }
 };

#endif

But I got a very long list of errors during compilation:

Compiling: keyboards/new_split_keyboard_gabriele/new_split_keyboard_gabriele.c                     In file included from quantum/quantum.h:32,
                 from keyboards/new_split_keyboard_gabriele/new_split_keyboard_gabriele.c:1:
quantum/rgblight/rgblight.h:325:22: error: expected identifier or '(' before 'void'
 void rgblight_enable(void);
                      ^~~~
keyboards/new_split_keyboard_gabriele/new_split_keyboard_gabriele.c:5:1: error: unknown type name 'led_config_t'; did you mean 'debug_config_t'?
 led_config_t g_led_config = { {
 ^~~~~~~~~~~~
 debug_config_t
keyboards/new_split_keyboard_gabriele/new_split_keyboard_gabriele.c:5:1: error: braces around scalar initializer [-Werror]
keyboards/new_split_keyboard_gabriele/new_split_keyboard_gabriele.c:5:1: note: (near initialization for 'g_led_config')
keyboards/new_split_keyboard_gabriele/new_split_keyboard_gabriele.c:6:13: error: braces around scalar initializer [-Werror]
             {34,     33, 32, 31, 30, 29, 28},
             ^
keyboards/new_split_keyboard_gabriele/new_split_keyboard_gabriele.c:6:13: note: (near initialization for 'g_led_config')
keyboards/new_split_keyboard_gabriele/new_split_keyboard_gabriele.c:6:22: error: excess elements in scalar initializer [-Werror]
             {34,     33, 32, 31, 30, 29, 28},
                      ^~
keyboards/new_split_keyboard_gabriele/new_split_keyboard_gabriele.c:6:22: note: (near initialization for 'g_led_config')
keyboards/new_split_keyboard_gabriele/new_split_keyboard_gabriele.c:6:26: error: excess elements in scalar initializer [-Werror]
             {34,     33, 32, 31, 30, 29, 28},
                          ^~
keyboards/new_split_keyboard_gabriele/new_split_keyboard_gabriele.c:6:26: note: (near initialization for 'g_led_config')
keyboards/new_split_keyboard_gabriele/new_split_keyboard_gabriele.c:6:30: error: excess elements in scalar initializer [-Werror]
             {34,     33, 32, 31, 30, 29, 28},
                              ^~
keyboards/new_split_keyboard_gabriele/new_split_keyboard_gabriele.c:6:30: note: (near initialization for 'g_led_config')
keyboards/new_split_keyboard_gabriele/new_split_keyboard_gabriele.c:6:34: error: excess elements in scalar initializer [-Werror]
             {34,     33, 32, 31, 30, 29, 28},

....

This is the first keymap:

    [0] = LAYOUT(
      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_MUTE,
      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_F1,                          KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, 
      MO(1), KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_ENT, KC_DEL,                   KC_SPC, MO(1), KC_LALT, KC_LGUI, KC_LEFT, KC_RIGHT,
                                MO(2), MO(1),                                      MO(1), KC_BSPC
    ),

This is my keyboard.json, the part about matrix:

...
    "matrix_pins": {
        "cols": ["GP21", "GP19", "GP16", "GP8", "GP11", "GP3", "GP2", "GP1", "GP0"],
        "rows": ["GP22", "GP20", "GP18", "GP17", "GP5", "GP15"]
    },
    "processor": "RP2040",
    "split": {
        "enabled": true,
        "matrix_pins": {
            "right": {
                "cols": ["GP22", "GP21", "GP17", "GP7", "GP8", "GP11", "GP2", "GP0"],
                "rows": ["GP9", "GP6", "GP20", "GP19", "GP3", "GP16"]
            }
        },
...

I don't have problem without led. I'm building a custom split keyboard (serial connection) with RP2040

Thank you very much

Gabriele-tomai00 avatar May 28 '25 18:05 Gabriele-tomai00

#ifdef RGBLIGHT_ENABLE
led_config_t g_led_config = { {

RGBLIGHT does not use g_led_config, only RGB Matrix does https://docs.qmk.fm/features/rgb_matrix#common-configuration.

zvecr avatar May 28 '25 19:05 zvecr

That's right, apologize, I think I copy/paste something and now it works... But I also corrected some errors I had on the matrix.

#include "quantum.h"

#ifdef RGB_MATRIX_ENABLE
led_config_t g_led_config = { {
            {  34,     33,     32,      31,  30,   29,   28,   NO_LED, NO_LED},
            {  22,   NO_LED,   23,      24,  25,   26,   27,   NO_LED, NO_LED},
            {  21,   NO_LED,   20,      19,  18,   17,   16,   NO_LED, NO_LED},
            {NO_LED,   9,      10,      11,  12,   13,   14,     15,   NO_LED},
            {  8,      7,    NO_LED,     6,   5,    4,  NO_LED,   3,      2  },
            {NO_LED, NO_LED, NO_LED,  NO_LED, 1, NO_LED,  0,   NO_LED, NO_LED},

                                    { NO_LED, 64,   65,    66,     67,      68,    69,     70,    NO_LED},
                                    {  63,    62,   61,    60,     59,      58,    57,     56,    NO_LED },
                                    {  49,    50,   51,    52,     53,      54,  NO_LED,   55,    NO_LED },
                                    { NO_LED, 48,   47,    46,     45,      44,  NO_LED,   43,    NO_LED },
                                    { NO_LED, 37,   38,   NO_LED,  39,      40,    41,     42,    NO_LED },
                                    {  36,    35, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED}
        }, 
{
     // right part
    {56, 64}, {84, 64},
    {112, 51}, {98, 51}, {70, 51}, {56, 51}, {42, 51}, {14, 51}, {0, 51},
    {14, 38}, {28, 38}, {42, 38}, {56, 38}, {70, 38}, {84, 38}, {98, 38},
    {84, 26}, {70, 26}, {56, 26}, {42, 26}, {28, 26}, {0, 26},
    {0, 13}, {28, 13}, {42, 13}, {56, 13}, {70, 13}, {84, 13},
    {84, 0}, {70, 0}, {56, 0}, {42, 0}, {28, 0}, {14, 0}, {0, 0},
    {154, 64}, 
     // left part
    {126, 64},
    {140, 51}, {154, 51}, {182, 51}, {196, 51}, {210, 51}, {224, 51},
    {224, 38}, {196, 38}, {182, 38}, {168, 38}, {154, 38}, {140, 38},
    {126, 26}, {140, 26}, {154, 26}, {168, 26}, {182, 26}, {196, 26}, {224, 26},
    {224, 13}, {210, 13}, {196, 13}, {182, 13}, {168, 13}, {154, 13}, {140, 13}, {126, 13},
    {140, 0}, {154, 0}, {168, 0}, {182, 0}, {196, 0}, {210, 0}, {224, 0}
     },
    {
          // right part
          4, 4, 4, 4, 4, 4, 4, 
          4, 4, 4, 4, 4, 4,
          4, 4, 4, 4, 4, 4, 
          4, 4, 4, 4, 4, 4, 4,
          4, 4, 4, 4, 4, 4, 4,
                         4, 4,
          // left part
          4, 4, 4, 4, 4, 4, 4, 
       4, 4, 4, 4, 4, 4, 4, 4,
          4, 4, 4, 4, 4, 4, 4,
             4, 4, 4, 4, 4, 4,
             4, 4, 4, 4, 4, 4, 
             4, 4

    }
 };

Thank you

Gabriele-tomai00 avatar May 29 '25 09:05 Gabriele-tomai00

Shouldn't it be rgb_config_t, rather than led_config_t? The latter is for monochrome LEDs.

yeroca avatar May 30 '25 01:05 yeroca

Shouldn't it be rgb_config_t, rather than led_config_t? The latter is for monochrome LEDs.

No, its led_config_t for both.

$ rg led_config_t quantum/

quantum/led_matrix/led_matrix.h
202:extern led_config_t g_led_config;

quantum/rgb_matrix/rgb_matrix.h
282:extern led_config_t g_led_config;

zvecr avatar May 30 '25 01:05 zvecr

This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged properly or other activity occurs. For maintainers: Please label with bug, in progress, on hold, discussion or to do to prevent the issue from being re-flagged.

github-actions[bot] avatar Aug 29 '25 02:08 github-actions[bot]

This issue has been automatically closed because it has not had activity in the last 30 days. If this issue is still valid, re-open the issue and let us know. // [stale-action-closed]

github-actions[bot] avatar Sep 28 '25 02:09 github-actions[bot]