Compare commits
7 Commits
pikapika
...
hid_rgb_co
| Author | SHA1 | Date | |
|---|---|---|---|
| 73daaa4198 | |||
| 1e67c09ddf | |||
|
|
7b22a4dbf1 | ||
|
|
381b60a084 | ||
|
|
56718042b0 | ||
| c27330e306 | |||
|
|
76f5c55e80 |
20
keyboards/hid_rgbled/config.h
Normal file
20
keyboards/hid_rgbled/config.h
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright 2024 hsgw (@hsgw)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
* Feature disable options
|
||||
* These options are also useful to firmware size reduction.
|
||||
*/
|
||||
|
||||
/* disable debug print */
|
||||
//#define NO_DEBUG
|
||||
|
||||
/* disable print */
|
||||
//#define NO_PRINT
|
||||
|
||||
/* disable action features */
|
||||
//#define NO_ACTION_LAYER
|
||||
//#define NO_ACTION_TAPPING
|
||||
//#define NO_ACTION_ONESHOT
|
||||
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 };
|
||||
22
keyboards/hid_rgbled/ichi_pp/config.h
Normal file
22
keyboards/hid_rgbled/ichi_pp/config.h
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright 2024 hsgw (Takuya Urakawa, Dm9Records, 5z6p.com)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
|
||||
|
||||
#define NO_USB_STARTUP_CHECK
|
||||
|
||||
// SPI
|
||||
#define WS2812_SPI_DRIVER SPID1
|
||||
#define WS2812_SPI_MOSI_PAL_MODE 0
|
||||
#define WS2812_SPI_SCK_PAL_MODE 0
|
||||
#define WS2812_SPI_SCK_PIN A5
|
||||
// #define WS2812_EXTERNAL_PULLUP
|
||||
|
||||
#define RGBLIGHT_DEFAULT_ON true
|
||||
|
||||
#define LAYER_STATE_8BIT
|
||||
#define NO_ACTION_LAYER
|
||||
#define NO_ACTION_TAPPING
|
||||
#define NO_ACTION_ONESHOT
|
||||
9
keyboards/hid_rgbled/ichi_pp/halconf.h
Normal file
9
keyboards/hid_rgbled/ichi_pp/halconf.h
Normal file
@@ -0,0 +1,9 @@
|
||||
// Copyright 2024 hsgw (Takuya Urakawa, Dm9Records, 5z6p.com)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
// #define HAL_USE_I2C TRUE
|
||||
#define HAL_USE_SPI TRUE
|
||||
|
||||
#include_next <halconf.h>
|
||||
10
keyboards/hid_rgbled/ichi_pp/ichi_pp.c
Normal file
10
keyboards/hid_rgbled/ichi_pp/ichi_pp.c
Normal file
@@ -0,0 +1,10 @@
|
||||
// Copyright 2024 hsgw (Takuya Urakawa, Dm9Records, 5z6p.com)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
void keyboard_pre_init_kb() {
|
||||
// Enable USB pins
|
||||
SYSCFG->CFGR1 |= SYSCFG_CFGR1_PA11_PA12_RMP;
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
21
keyboards/hid_rgbled/ichi_pp/info.json
Normal file
21
keyboards/hid_rgbled/ichi_pp/info.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"bootloader": "stm32-dfu",
|
||||
"processor": "STM32F042",
|
||||
"url": "",
|
||||
"usb": {
|
||||
"device_version": "1.0.0",
|
||||
"pid": "0x0000",
|
||||
"vid": "0xFEED"
|
||||
},
|
||||
"matrix_pins":{
|
||||
"direct": [["A4"]]
|
||||
},
|
||||
"ws2812": {
|
||||
"pin": "A7",
|
||||
"driver": "spi"
|
||||
},
|
||||
"rgblight": {
|
||||
"led_count": 10,
|
||||
"max_brightness": 255
|
||||
}
|
||||
}
|
||||
21
keyboards/hid_rgbled/ichi_pp/mcuconf.h
Normal file
21
keyboards/hid_rgbled/ichi_pp/mcuconf.h
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright 2024 hsgw (Takuya Urakawa, Dm9Records, 5z6p.com)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
// #undef STM32_I2C_USE_I2C1
|
||||
// #define STM32_I2C_USE_I2C1 TRUE
|
||||
|
||||
// #undef STM32_I2C_I2C1_RX_DMA_STREAM
|
||||
// #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
|
||||
// #undef STM32_I2C_I2C1_TX_DMA_STREAM
|
||||
// #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
|
||||
|
||||
#undef STM32_SPI_SPI1_RX_DMA_STREAM
|
||||
#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
|
||||
#undef STM32_SPI_SPI1_TX_DMA_STREAM
|
||||
#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
|
||||
|
||||
#undef STM32_SPI_USE_SPI1
|
||||
#define STM32_SPI_USE_SPI1 TRUE
|
||||
1
keyboards/hid_rgbled/ichi_pp/rules.mk
Normal file
1
keyboards/hid_rgbled/ichi_pp/rules.mk
Normal file
@@ -0,0 +1 @@
|
||||
# This file intentionally left blank
|
||||
45
keyboards/hid_rgbled/info.json
Normal file
45
keyboards/hid_rgbled/info.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"manufacturer": "hsgw",
|
||||
"keyboard_name": "hid_rgbled",
|
||||
"maintainer": "hsgw",
|
||||
"url": "",
|
||||
"usb": {
|
||||
"device_version": "1.0.0",
|
||||
"pid": "0x0000",
|
||||
"vid": "0xFEED"
|
||||
},
|
||||
"features": {
|
||||
"bootmagic": true,
|
||||
"command": false,
|
||||
"console": false,
|
||||
"extrakey": false,
|
||||
"mousekey": false,
|
||||
"nkro": false,
|
||||
"rgblight": true,
|
||||
"raw": true
|
||||
},
|
||||
"rgblight": {
|
||||
"saturation_steps": 8,
|
||||
"brightness_steps": 8,
|
||||
"sleep": true,
|
||||
"animations": {
|
||||
"breathing": false,
|
||||
"rainbow_mood": false,
|
||||
"rainbow_swirl": false,
|
||||
"snake": false,
|
||||
"knight": false,
|
||||
"christmas": false,
|
||||
"static_gradient": false,
|
||||
"rgb_test": true,
|
||||
"alternating": false,
|
||||
"twinkle": false
|
||||
}
|
||||
},
|
||||
"layouts": {
|
||||
"LAYOUT_ortho_1x1": {
|
||||
"layout": [
|
||||
{"matrix": [0, 0], "x": 0, "y": 0}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
10
keyboards/hid_rgbled/keymaps/default/keymap.c
Normal file
10
keyboards/hid_rgbled/keymaps/default/keymap.c
Normal file
@@ -0,0 +1,10 @@
|
||||
// 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
|
||||
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);
|
||||
}
|
||||
28
keyboards/hid_rgbled/readme.md
Normal file
28
keyboards/hid_rgbled/readme.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# hid_rgbled
|
||||
|
||||

|
||||
|
||||
*A short description of the keyboard/project*
|
||||
|
||||
* Keyboard Maintainer: [hsgw](https://github.com/hsgw)
|
||||
* Hardware Supported: *The PCBs, controllers supported*
|
||||
* Hardware Availability: *Links to where you can find this hardware*
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make hid_rgbled:xiao_rp2040:default
|
||||
make hid_rgbled:(your add direcry):default
|
||||
|
||||
Flashing example for this keyboard:
|
||||
|
||||
make hid_rgbled:default:flash
|
||||
|
||||
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
|
||||
|
||||
## Bootloader
|
||||
|
||||
Enter the bootloader in 3 ways:
|
||||
|
||||
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
|
||||
* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
|
||||
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available
|
||||
21
keyboards/hid_rgbled/rp2040_zero/info.json
Normal file
21
keyboards/hid_rgbled/rp2040_zero/info.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"bootloader": "rp2040",
|
||||
"processor": "RP2040",
|
||||
"url": "",
|
||||
"usb": {
|
||||
"device_version": "1.0.0",
|
||||
"pid": "0x0000",
|
||||
"vid": "0xFEED"
|
||||
},
|
||||
"matrix_pins":{
|
||||
"direct": [["GP0"]]
|
||||
},
|
||||
"ws2812": {
|
||||
"pin": "GP16",
|
||||
"driver": "vendor"
|
||||
},
|
||||
"rgblight": {
|
||||
"led_count": 1,
|
||||
"max_brightness": 255
|
||||
}
|
||||
}
|
||||
1
keyboards/hid_rgbled/rp2040_zero/rules.mk
Normal file
1
keyboards/hid_rgbled/rp2040_zero/rules.mk
Normal file
@@ -0,0 +1 @@
|
||||
# This file intentionally left blank
|
||||
1
keyboards/hid_rgbled/rules.mk
Normal file
1
keyboards/hid_rgbled/rules.mk
Normal file
@@ -0,0 +1 @@
|
||||
# This file intentionally left blank
|
||||
21
keyboards/hid_rgbled/xiao_rp2040/info.json
Normal file
21
keyboards/hid_rgbled/xiao_rp2040/info.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"bootloader": "rp2040",
|
||||
"processor": "RP2040",
|
||||
"url": "",
|
||||
"usb": {
|
||||
"device_version": "1.0.0",
|
||||
"pid": "0x0000",
|
||||
"vid": "0xFEED"
|
||||
},
|
||||
"matrix_pins":{
|
||||
"direct": [["GP26"]]
|
||||
},
|
||||
"ws2812": {
|
||||
"pin": "GP12",
|
||||
"driver": "vendor"
|
||||
},
|
||||
"rgblight": {
|
||||
"led_count": 1,
|
||||
"max_brightness": 200
|
||||
}
|
||||
}
|
||||
1
keyboards/hid_rgbled/xiao_rp2040/rules.mk
Normal file
1
keyboards/hid_rgbled/xiao_rp2040/rules.mk
Normal file
@@ -0,0 +1 @@
|
||||
# This file intentionally left blank
|
||||
9
keyboards/hid_rgbled/xiao_rp2040/xiao_rp2040.c
Normal file
9
keyboards/hid_rgbled/xiao_rp2040/xiao_rp2040.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "quantum.h"
|
||||
|
||||
void keyboard_pre_init_kb(void) {
|
||||
// power up rgbled
|
||||
setPinOutput(GP11);
|
||||
writePinHigh(GP11);
|
||||
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#pragma once
|
||||
|
||||
#define RAW_ENABLE
|
||||
|
||||
#ifndef CORTEX_ENABLE_WFI_IDLE
|
||||
# define CORTEX_ENABLE_WFI_IDLE TRUE
|
||||
#endif // CORTEX_ENABLE_WFI_IDLE
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "usb_descriptor.h"
|
||||
#include "usb_driver.h"
|
||||
#include "usb_types.h"
|
||||
#include "rgblight.h"
|
||||
|
||||
#ifdef NKRO_ENABLE
|
||||
# include "keycode_config.h"
|
||||
@@ -972,10 +973,30 @@ void raw_hid_send(uint8_t *data, uint8_t length) {
|
||||
chnWrite(&drivers.raw_driver.driver, data, length);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void raw_hid_receive(uint8_t *data, uint8_t length) {
|
||||
// Users should #include "raw_hid.h" in their own code
|
||||
// and implement this function there. Leave this as weak linkage
|
||||
// so users can opt to not handle data coming in.
|
||||
enum HID_RGBLED_COMMAND { HID_PING = 0, HID_SET_HSV, HID_SET_RGB };
|
||||
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);
|
||||
//rgblight_setrgb(data[0], data[1], data[2]);
|
||||
}
|
||||
|
||||
void raw_hid_task(void) {
|
||||
|
||||
Reference in New Issue
Block a user