Tidy use of raw hid within keyboards (#23557)

This commit is contained in:
Joel Challis 2024-04-19 02:18:51 +01:00 committed by GitHub
parent 4a7fdda668
commit 1513966c38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 21 additions and 112 deletions

View File

@ -172,27 +172,3 @@ webusb_pos_t webusb_keymap[] = {
{4, 0}, {4, 1}, {4, 2}, {4, 6}, {4, 10}, {4, 11}, {4, 12}, {4, 13}, {4, 0}, {4, 1}, {4, 2}, {4, 6}, {4, 10}, {4, 11}, {4, 12}, {4, 13},
}; };
#endif #endif
#ifndef RAW_ENABLE
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
#else
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
if (record->event.pressed) {
switch(keycode) {
#ifdef RGBLIGHT_ENABLE
#ifdef RGB_MATRIX_ENABLE
case KC_F13: // toggle rgb matrix
rgb_matrix_toggle();
return false;
case KC_F14:
rgb_matrix_step();
return false;
#endif
#endif
default:
break;
}
}
return true;
}

View File

@ -44,3 +44,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
_______,_______,_______, _______, _______,_______,_______,_______) _______,_______,_______, _______, _______,_______,_______,_______)
}; };
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch(keycode) {
#ifdef RGBLIGHT_ENABLE
#ifdef RGB_MATRIX_ENABLE
case KC_F13: // toggle rgb matrix
rgb_matrix_toggle();
return false;
case KC_F14:
rgb_matrix_step();
return false;
#endif
#endif
default:
break;
}
}
return true;
}

View File

@ -1,3 +1 @@
RGBLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes
RAW_ENABLE = no
DYNAMIC_KEYMAP_ENABLE = no

View File

@ -73,8 +73,7 @@
"mousekey": false, "mousekey": false,
"extrakey": true, "extrakey": true,
"nkro": true, "nkro": true,
"rgb_matrix": true, "rgb_matrix": true
"raw": true
}, },
"community_layouts": ["60_ansi", "60_iso"], "community_layouts": ["60_ansi", "60_iso"],
"layouts": { "layouts": {

View File

@ -2,7 +2,3 @@
# when we get USB suspend event. We want it to keep updating # when we get USB suspend event. We want it to keep updating
# backlight effects. # backlight effects.
OPT_DEFS += -DNO_SUSPEND_POWER_DOWN OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
# Experimental features for zealcmd please do no enable
#RAW_ENABLE = yes
#USE_KEYMAPS_IN_EEPROM = yes

View File

@ -15,80 +15,6 @@
*/ */
#include "quantum.h" #include "quantum.h"
// Please ignore this is for upcoming features
/*#ifdef RAW_ENABLE
void raw_hid_receive( uint8_t *data, uint8_t length )
{
uint8_t command = data[0];
switch ( command )
{
case id_protocol_version:
{
msg_protocol_version *msg = (msg_protocol_version*)&data[1];
msg->version = PROTOCOL_VERSION;
break;
}
#if USE_KEYMAPS_IN_EEPROM
case id_keymap_keycode_load:
{
msg_keymap_keycode_load *msg = (msg_keymap_keycode_load*)&data[1];
msg->keycode = keymap_keycode_load( msg->layer, msg->row, msg->column );
break;
}
case id_keymap_keycode_save:
{
msg_keymap_keycode_save *msg = (msg_keymap_keycode_save*)&data[1];
keymap_keycode_save( msg->layer, msg->row, msg->column, msg->keycode);
break;
}
case id_keymap_default_save:
{
keymap_default_save();
break;
}
#endif // USE_KEYMAPS_IN_EEPROM
case id_backlight_config_set_values:
{
msg_backlight_config_set_values *msg = (msg_backlight_config_set_values*)&data[1];
backlight_config_set_values(msg);
backlight_config_save();
break;
}
case id_backlight_config_set_alphas_mods:
{
msg_backlight_config_set_alphas_mods *msg = (msg_backlight_config_set_alphas_mods*)&data[1];
backlight_config_set_alphas_mods( msg->alphas_mods );
backlight_config_save();
break;
}
case id_backlight_set_key_color:
{
msg_backlight_set_key_color *msg = (msg_backlight_set_key_color*)&data[1];
backlight_set_key_color(msg->row, msg->column, msg->hsv);
break;
}
case id_system_get_state:
{
msg_system_state *msg = (msg_system_state*)&data[1];
msg->value = backlight_get_tick();
break;
}
default:
{
// Unhandled message.
data[0] = id_unhandled;
break;
}
}
// Return same buffer with values changed
raw_hid_send( data, length );
}
#endif*/
#ifdef HS60_ANSI #ifdef HS60_ANSI
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {

View File

@ -12,7 +12,6 @@ RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output AUDIO_ENABLE = no # Audio output
DIP_SWITCH_ENABLE = yes DIP_SWITCH_ENABLE = yes
RGB_MATRIX_ENABLE = yes RGB_MATRIX_ENABLE = yes
RAW_ENABLE = yes
LTO_ENABLE = yes LTO_ENABLE = yes
# custom matrix setup # custom matrix setup

View File

@ -13,7 +13,6 @@ AUDIO_ENABLE = no # Audio output
ENCODER_ENABLE = yes # Enable Encoder ENCODER_ENABLE = yes # Enable Encoder
DIP_SWITCH_ENABLE = yes DIP_SWITCH_ENABLE = yes
RGB_MATRIX_ENABLE = yes RGB_MATRIX_ENABLE = yes
RAW_ENABLE = yes
LTO_ENABLE = yes LTO_ENABLE = yes
# custom matrix setup # custom matrix setup

View File

@ -21,7 +21,6 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output AUDIO_ENABLE = no # Audio output
VIRTSER_ENABLE = no # USB Serial Driver VIRTSER_ENABLE = no # USB Serial Driver
RAW_ENABLE = no # Raw device
AUTO_SHIFT_ENABLE = no # Auto Shift AUTO_SHIFT_ENABLE = no # Auto Shift
# Custom RGB matrix handling # Custom RGB matrix handling

View File

@ -21,7 +21,6 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output AUDIO_ENABLE = no # Audio output
VIRTSER_ENABLE = no # USB Serial Driver VIRTSER_ENABLE = no # USB Serial Driver
RAW_ENABLE = no # Raw device
AUTO_SHIFT_ENABLE = no # Auto Shift AUTO_SHIFT_ENABLE = no # Auto Shift
# Custom RGB matrix handling # Custom RGB matrix handling

View File

@ -3,5 +3,3 @@ MCU_LDSCRIPT = STM32F103xB
# Extra include # Extra include
SRC += keycode_lookup.c SRC += keycode_lookup.c
RAW_ENABLE = yes # Enables HID RAW communication between the board and the PC