add hid-rgbled
This commit is contained in:
35
keyboards/hid_rgbled/hid_rgbled.c
Normal file
35
keyboards/hid_rgbled/hid_rgbled.c
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#include "hid_rgbled.h"
|
||||||
|
|
||||||
|
#include <raw_hid.h>
|
||||||
|
#include <rgblight.h>
|
||||||
|
|
||||||
|
void keyboard_post_init_kb(void) {
|
||||||
|
rgblight_enable();
|
||||||
|
rgblight_sethsv_noeeprom(0, 0, 0);
|
||||||
|
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
|
||||||
|
keyboard_post_init_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_hid_receive(uint8_t *data, uint8_t length) {
|
||||||
|
switch (data[0]) {
|
||||||
|
case HID_PING:
|
||||||
|
data[0] = 1;
|
||||||
|
data[1] = 'R';
|
||||||
|
data[2] = 'G';
|
||||||
|
data[3] = 'B';
|
||||||
|
break;
|
||||||
|
case HID_SET_HSV:
|
||||||
|
rgblight_sethsv_noeeprom(data[1], data[2], data[3]);
|
||||||
|
data[0] = 1;
|
||||||
|
break;
|
||||||
|
case HID_SET_RGB:
|
||||||
|
rgblight_setrgb(data[1], data[2], data[3]);
|
||||||
|
data[0] = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
data[1] = data[0];
|
||||||
|
data[0] = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
raw_hid_send(data, length);
|
||||||
|
}
|
||||||
3
keyboards/hid_rgbled/hid_rgbled.h
Normal file
3
keyboards/hid_rgbled/hid_rgbled.h
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#include <quantum.h>
|
||||||
|
|
||||||
|
enum HID_RGBLED_COMMAND { HID_PING = 0, HID_SET_HSV, HID_SET_RGB };
|
||||||
@@ -12,10 +12,11 @@
|
|||||||
"bootmagic": true,
|
"bootmagic": true,
|
||||||
"command": false,
|
"command": false,
|
||||||
"console": false,
|
"console": false,
|
||||||
"extrakey": true,
|
"extrakey": false,
|
||||||
"mousekey": true,
|
"mousekey": false,
|
||||||
"nkro": true,
|
"nkro": false,
|
||||||
"rgblight": true
|
"rgblight": true,
|
||||||
|
"raw": true
|
||||||
},
|
},
|
||||||
"rgblight": {
|
"rgblight": {
|
||||||
"saturation_steps": 8,
|
"saturation_steps": 8,
|
||||||
@@ -23,16 +24,16 @@
|
|||||||
"led_count": 1,
|
"led_count": 1,
|
||||||
"sleep": true,
|
"sleep": true,
|
||||||
"animations": {
|
"animations": {
|
||||||
"breathing": true,
|
"breathing": false,
|
||||||
"rainbow_mood": true,
|
"rainbow_mood": false,
|
||||||
"rainbow_swirl": true,
|
"rainbow_swirl": false,
|
||||||
"snake": true,
|
"snake": false,
|
||||||
"knight": true,
|
"knight": false,
|
||||||
"christmas": true,
|
"christmas": false,
|
||||||
"static_gradient": true,
|
"static_gradient": false,
|
||||||
"rgb_test": true,
|
"rgb_test": true,
|
||||||
"alternating": true,
|
"alternating": false,
|
||||||
"twinkle": true
|
"twinkle": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"layouts": {
|
"layouts": {
|
||||||
|
|||||||
@@ -5,12 +5,6 @@
|
|||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[0] = LAYOUT_ortho_1x1(KC_ENT)
|
||||||
[0] = LAYOUT_ortho_1x1(KC_A)
|
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
void keyboard_post_init_user(void) {
|
|
||||||
rgblight_enable();
|
|
||||||
rgblight_mode(RGBLIGHT_MODE_RGB_TEST);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
// Copyright 2023 QMK
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include QMK_KEYBOARD_H
|
|
||||||
#include <raw_hid.h>
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
|
|
||||||
[0] = LAYOUT_ortho_1x1(KC_A)
|
|
||||||
};
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
void keyboard_post_init_user(void) {
|
|
||||||
rgblight_enable();
|
|
||||||
}
|
|
||||||
|
|
||||||
void raw_hid_receive(uint8_t *data, uint8_t length) {
|
|
||||||
// `data` is a pointer to the buffer containing the received HID report
|
|
||||||
// `length` is the length of the report - always `RAW_EPSIZE`
|
|
||||||
uint8_t response[length];
|
|
||||||
memset(response, 0, length);
|
|
||||||
response[0] = 'B';
|
|
||||||
if (data[0] == 'A') {
|
|
||||||
raw_hid_send(response, length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
RAW_ENABLE = yes
|
|
||||||
16
keyboards/hid_rgbled/keymaps/test/keymap.c
Normal file
16
keyboards/hid_rgbled/keymaps/test/keymap.c
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// Copyright 2023 QMK
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
[0] = LAYOUT_ortho_1x1(KC_ENT)
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
void keyboard_post_init_user(void) {
|
||||||
|
rgblight_enable();
|
||||||
|
rgblight_mode(RGBLIGHT_MODE_RGB_TEST);
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
void keyboard_post_init_kb(void) {
|
void keyboard_pre_init_kb(void) {
|
||||||
// power up rgbled
|
// power up rgbled
|
||||||
setPinOutput(GP11);
|
setPinOutput(GP11);
|
||||||
writePinHigh(GP11);
|
writePinHigh(GP11);
|
||||||
|
|
||||||
keyboard_post_init_user();
|
keyboard_pre_init_user();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user