diff --git a/modules/qmk/keymap.c b/modules/qmk/keymap.c index 81cdd0c..ac14d66 100644 --- a/modules/qmk/keymap.c +++ b/modules/qmk/keymap.c @@ -89,8 +89,29 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; } +enum HIDR_COMMANDS { + HIDR_RGB_SET = 0, + HIDR_OK +}; + void raw_hid_receive(uint8_t* data, uint8_t length) { - raw_hid_send(data, length); + uint8_t response[length]; + memset(response, 0, length); + + if (data[0] == HIDR_RGB_SET) { + uint8_t r = data[1]; + uint8_t g = data[2]; + uint8_t b = data[3]; + for (uint8_t i = 0 ; i < 8 ; i++) { + rgblight_setrgb_at(r, g, b, i); + } + + response[0] = HIDR_OK; + raw_hid_send(response, length); + } else { + memcpy(response, data, length); + raw_hid_send(response, length); + } }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {