mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-29 03:26:13 +01:00
Implement some HID raw communication
Signed-off-by: magic_rb <magic_rb@redalder.org>
This commit is contained in:
parent
dd19ecbece
commit
540a7696b7
|
@ -89,8 +89,29 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum HIDR_COMMANDS {
|
||||||
|
HIDR_RGB_SET = 0,
|
||||||
|
HIDR_OK
|
||||||
|
};
|
||||||
|
|
||||||
void raw_hid_receive(uint8_t* data, uint8_t length) {
|
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] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
Loading…
Reference in a new issue