-
-
Notifications
You must be signed in to change notification settings - Fork 43.3k
[Keymap] foxx1337 for Massdrop CTRL with raw HID #8692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4c3317d
[Keymap] foxx1337's personal keymap
foxx1337 9a3c697
Add foxx1337 layout defaults
foxx1337 8db04df
Add raw HID communication protocol
foxx1337 d6cb19b
Add rgbmatrix to the raw HID protocol
foxx1337 855c82e
Add readme
foxx1337 57a520b
Modernize ctrl, shift, alt mods detection
foxx1337 b1b0e9a
Add GPL like copyright headers
foxx1337 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Massdrop CTRL default layout with raw HID protocol | ||
|
|
||
| This represents my current layout, with filtered out effects, personal defaults, | ||
| added inactivity timeout (for rgbmatrix) and a HID protocol example. | ||
|
|
||
| To test that this is working, there's a user application I'm using to help with | ||
| development on [my GitHub](https://github.com/foxx1337/rawhid_io). | ||
|
|
||
| Currently all the HID operations defined in the protocol are callable from the | ||
| user application: | ||
|
|
||
| - hello: gets the string "CTRLHID 1.0.0" | ||
| - lights: toggles the rgbmatrix on/off | ||
| - led n #RRGGBB: colors the specified led. Valid n from 0 to 117 (87-117 are on | ||
| the edge) | ||
| - leds start #RRGGBB #RRGGBB #RRGGBB ...: colors the range of leds from start | ||
| - mode n: switches to the specific rgbmatrix mode. Use the last one, 11, to test | ||
| the led operations listed above |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| /* | ||
| * Copyright 2021 foxx1337 at yahoo dot com | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 2 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #define FORCE_NKRO // NKRO by default requires to be turned on, this forces it on during keyboard startup regardless of EEPROM setting. NKRO can still be turned off but will be turned on again if the keyboard reboots. | ||
|
|
||
| #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | ||
| #define RGB_MATRIX_KEYPRESSES // reacts to keypresses | ||
|
|
||
| #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | ||
| #define RGB_MATRIX_KEYPRESSES // reacts to keypresses | ||
| // #define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses) | ||
| #define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_REACTIVE // Sets the default mode, if none has been set | ||
| #define RGB_MATRIX_STARTUP_HUE 12 | ||
| #define RGB_MATRIX_STARTUP_SPD (UINT8_MAX / 2 + 32) | ||
| #define RGB_MATRIX_STARTUP_VAL 96 | ||
| // #define RGBLIGHT_HUE_STEP 12 // Units to step when in/decreasing hue | ||
| // #define RGBLIGHT_SAT_STEP 25 // Units to step when in/decreasing saturation | ||
| // #define RGBLIGHT_VAL_STEP 12 // Units to step when in/decreasing value (brightness) | ||
| // #define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects | ||
| // #define RGB_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended | ||
| // #define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness) | ||
| // #define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness) | ||
| // #define RGBLIGHT_ANIMATIONS // Run RGB animations | ||
| // #define RGBLIGHT_ANIMATIONS // Enable all additional animation modes. | ||
| // #define RGBLIGHT_EFFECT_ALTERNATING // Enable alternating animation mode. | ||
| // #define RGBLIGHT_EFFECT_BREATHING // Enable breathing animation mode. | ||
| // #define RGBLIGHT_EFFECT_CHRISTMAS // Enable christmas animation mode. | ||
| // #define RGBLIGHT_EFFECT_KNIGHT // Enable knight animation mode. | ||
| // #define RGBLIGHT_EFFECT_RAINBOW_MOOD // Enable rainbow mood animation mode. | ||
| // #define RGBLIGHT_EFFECT_RAINBOW_SWIRL // Enable rainbow swirl animation mode. | ||
| // #define RGBLIGHT_EFFECT_RGB_TEST // Enable RGB test animation mode. | ||
| // #define RGBLIGHT_EFFECT_SNAKE // Enable snake animation mode. | ||
| // #define RGBLIGHT_EFFECT_STATIC_GRADIENT // Enable static gradient mode. | ||
|
|
||
| // #define RGBLIGHT_EFFECT_BREATHE_CENTER // If defined, used to calculate the curve for the breathing animation. Valid values are 1.0 to 2.7 | ||
| // #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // The maximum brightness for the breathing mode. Valid values are 1 to 255 | ||
| // #define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 1000 // How long to wait between light changes for the "Christmas" animation, in milliseconds | ||
| // #define RGBLIGHT_EFFECT_CHRISTMAS_STEP 2 // The number of LEDs to group the red/green colors by for the "Christmas" animation | ||
| // #define RGBLIGHT_EFFECT_KNIGHT_LED_NUM RGBLED_NUM // The number of LEDs to have the "Knight" animation travel | ||
| // #define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3 // The number of LEDs to light up for the "Knight" animation | ||
| // #define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0 // The number of LEDs to start the "Knight" animation from the start of the strip by | ||
| // #define RGBLIGHT_RAINBOW_SWIRL_RANGE 255 // Range adjustment for the rainbow swirl effect to get different swirls | ||
| // #define RGBLIGHT_EFFECT_SNAKE_LENGTH 4 // The number of LEDs to light up for the "Snake" animation | ||
|
|
||
| // This list in in the correct mode order. Next mode is the following line, previous mode is previous line. Loops around. | ||
| // #define DISABLE_RGB_MATRIX_SOLID_COLOR // Static single hue, no speed support | ||
| // #define DISABLE_RGB_MATRIX_ALPHAS_MODS // Static dual hue, speed is hue for secondary hue | ||
| #define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN // Static gradient top to bottom, speed controls how much gradient changes | ||
| #define DISABLE_RGB_MATRIX_BREATHING // Single hue brightness cycling animation | ||
| #define DISABLE_RGB_MATRIX_BAND_SAT // Single hue band fading saturation scrolling left to right | ||
| #define DISABLE_RGB_MATRIX_BAND_VAL // Single hue band fading brightness scrolling left to right | ||
| #define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT // Single hue 3 blade spinning pinwheel fades saturation | ||
| #define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL // Single hue 3 blade spinning pinwheel fades brightness | ||
| #define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT // Single hue spinning spiral fades saturation | ||
| #define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL // Single hue spinning spiral fades brightness | ||
| #define DISABLE_RGB_MATRIX_CYCLE_ALL // Full keyboard solid hue cycling through full gradient | ||
| #define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT // Full gradient scrolling left to right | ||
| #define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN // Full gradient scrolling top to bottom | ||
| #define DISABLE_RGB_MATRIX_CYCLE_OUT_IN // Full gradient scrolling out to in | ||
| #define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL // Full dual gradients scrolling out to in | ||
| #define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON // Full gradent Chevron shapped scrolling left to right | ||
| #define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL // Full gradient spinning pinwheel around center of keyboard | ||
| #define DISABLE_RGB_MATRIX_CYCLE_SPIRAL // Full gradient spinning spiral around center of keyboard | ||
| #define DISABLE_RGB_MATRIX_DUAL_BEACON // Full gradient spinning around center of keyboard | ||
| #define DISABLE_RGB_MATRIX_RAINBOW_BEACON // Full tighter gradient spinning around center of keyboard | ||
| #define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS // Full dual gradients spinning two halfs of keyboard | ||
| // #define DISABLE_RGB_MATRIX_RAINDROPS // Randomly changes a single key's hue | ||
| // #define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS // Randomly changes a single key's hue and saturation | ||
| // =================================================== Requires RGB_MATRIX_FRAMEBUFFER_EFFECTS ============================================================= | ||
| #define DISABLE_RGB_MATRIX_TYPING_HEATMAP // How hot is your WPM! | ||
| #define DISABLE_RGB_MATRIX_DIGITAL_RAIN // That famous computer simulation | ||
| // =================================================== RGB_MATRIX_KEYPRESSES OR RGB_MATRIX_KEYRELEASES ===================================================== | ||
| // #define DISABLE_RGB_MATRIX_SOLID_REACTIVE // Static single hue, pulses keys hit to shifted hue then fades to current hue | ||
| //#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE // Pulses keys hit to hue & value then fades value out | ||
| #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE // Hue & value pulse near a single key hit then fades value out | ||
| //#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE // Hue & value pulse near multiple key hits then fades value out | ||
| //#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS // Hue & value pulse the same column and row of a single key hit then fades value out | ||
| #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS // Hue & value pulse the same column and row of multiple key hits then fades value out | ||
| //#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS // Hue & value pulse away on the same column and row of a single key hit then fades value out | ||
| #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS // Hue & value pulse away on the same column and row of multiple key hits then fades value out | ||
| #define DISABLE_RGB_MATRIX_SPLASH // Full gradient & value pulse away from a single key hit then fades value out | ||
| #define DISABLE_RGB_MATRIX_MULTISPLASH // Full gradient & value pulse away from multiple key hits then fades value out | ||
| #define DISABLE_RGB_MATRIX_SOLID_SPLASH // Hue & value pulse away from a single key hit then fades value out | ||
| #define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH // Hue & value pulse away from multiple key hits then fades value out | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* | ||
| * Copyright 2021 foxx1337 at yahoo dot com | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 2 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| #include QMK_KEYBOARD_H | ||
foxx1337 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| #include "hid_protocol.h" | ||
|
|
||
| uint8_t raw_hid_buffer[RAW_EPSIZE]; | ||
|
|
||
| void raw_hid_perform_send(void) { | ||
| raw_hid_send(raw_hid_buffer, RAW_EPSIZE); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| /* | ||
| * Copyright 2021 foxx1337 at yahoo dot com | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 2 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| #pragma once | ||
foxx1337 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| #include <color.h> | ||
| #include <raw_hid.h> | ||
|
|
||
| #define CTRL_HID_GREETING_VERSION "CTRLHID 1.0.0" | ||
|
|
||
| enum ctrl_hid_codes { | ||
| // Signals end of message. Not really that useful. | ||
| CTRL_HID_EOM = 0x00, | ||
| CTRL_HID_OK, | ||
| CTRL_HID_NOK, | ||
|
|
||
| /** | ||
| * to hid: CTRL_HID_HELLO | ||
| * from hid: CTRL_HID_HELLO, "CTRLHID 1.0.0", CTRL_HID_EOM | ||
| **/ | ||
| CTRL_HID_HELLO, | ||
|
|
||
| /** | ||
| * to hid: CTRL_HID_LIGHTS_TOGGLE | ||
| * from hid: CTRL_HID_LIGHTS_TOGGLE, CTRL_HID_OK, is_led_timeout, CTRL_HID_EOM | ||
| * | ||
| * Toggles all the leds on the keyboard. is_led_timeout will be 1 if the new | ||
| * state is off, 0 if leds are on. | ||
| **/ | ||
| CTRL_HID_LIGHTS_TOGGLE, | ||
|
|
||
| /** | ||
| * to hid: CTRL_HID_LED, led_id, r, g, b | ||
| * from hid: CTRL_HID_LED, CTRL_HID_OK, CTRL_HID_EOM | ||
| * on error: CTRL_HID_LED, CTRL_HID_NOK, num_leds, CTRL_HID_EOM | ||
| * | ||
| * Sets the specific led to r, g, b. It's only visible when the hid_effect mode is active. | ||
| **/ | ||
| CTRL_HID_LED, | ||
|
|
||
| /** | ||
| * to hid: CTRL_HID_LEDS, start, count, r0, g0, b0, ..., r[count-1], g[count-1], b[count-1] | ||
| * from hid: CTRL_HID_LEDS, CTRL_HID_OK, affected_leds, CTRL_HID_EOM | ||
| * | ||
| * Sets affected_leds leds following start to the corresponding r, g, b value. | ||
| * It's only visible when the hid_effect mode is active. | ||
| **/ | ||
| CTRL_HID_LEDS, | ||
|
|
||
| /** | ||
| * to hid: CTRL_HID_RGBMATRIX_MODE, mode | ||
| * from hid: CTRL_HID_RGBMATRIX_MODE, CTRL_HID_OK, CTRL_HID_EOM | ||
| * on error: CTRL_HID_RGBMATRIX_MODE, CTRL_HID_NOK, mode_max, CTRL_HID_EOM | ||
| * | ||
| * Changes light mode. mode_max is hid_effect for CTRL_HID_LED and CTRL_HID_LEDS. | ||
| */ | ||
| CTRL_HID_RGBMATRIX_MODE | ||
| }; | ||
|
|
||
| extern uint8_t raw_hid_buffer[RAW_EPSIZE]; | ||
|
|
||
| // Defined in rgb_matrix_user.inc | ||
| // It's 119 for Massdrop CTRL, 0 - 118. | ||
| extern RGB rgb_matrix_led_state[DRIVER_LED_TOTAL]; | ||
|
|
||
| void raw_hid_perform_send(void); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.