Add mouse layer to Kprepublic BM40HSRGB Coffee layout (#19878)

Co-authored-by: Fae <faenkhauser@gmail.com>
This commit is contained in:
CoffeeIsLife 2023-02-18 11:38:06 -06:00 committed by GitHub
parent 3110a70f6f
commit d2bed27414
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 102 additions and 39 deletions

View file

@ -81,5 +81,13 @@
#ifdef MOUSEKEY_ENABLE
# define MOUSEKEY_INTERVAL 16 // 60 FPS
// Speed up the slowest preset
# define MK_C_OFFSET_0 4
# define MK_C_INTERVAL_0 16
// Speed up the medium preset
# define MK_C_OFFSET_1 16
# define MK_3_SPEED
#endif

View file

@ -10,15 +10,30 @@ enum custom_keycodes {
MCR_REC, // Macro record
MCR_SWT, // Swap active macro
#endif
#ifdef MOUSEKEY_ENABLE
MS_ACL_U,
MS_ACL_D,
#endif
};
enum layout_names {
_MAIN = 0, // Keys Layout: The main keyboard layout that has all the characters
_SUB, // Extension to Main
_CTR, // Macros, RGB, Audio controls, layer access. More or less the control center of my keyboard
#ifdef MOUSEKEY_ENABLE
_MSE,
#endif // MOUSEKEY_ENABLE
_END,
};
#ifdef MOUSEKEY_ENABLE
#include "action.h"
#define TOG_MSE TG(_MSE)
static int current_accel = 0;
#else
#define TOG_MSE XXXXXXX
#endif // MOUSEKEY_ENABLE
#ifdef DYNAMIC_MACRO_ENABLE
// Macro 1 is = 1, Macro 2 = -1, No macro = 0
static bool MACRO1 = true;
@ -57,8 +72,16 @@ const uint16_t PROGMEM keymaps[_END][MATRIX_ROWS][MATRIX_COLS] = {
XXXXXXX, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, XXXXXXX, XXXXXXX, KC_VOLU, XXXXXXX, XXXXXXX, MCR_REC,
XXXXXXX, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, XXXXXXX, KC_MPRV, KC_MPLY, KC_MNXT, XXXXXXX, MCR_PLY,
XXXXXXX, XXXXXXX, RGB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLD, XXXXXXX, XXXXXXX, MCR_SWT,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TOG_MSE, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
)
#ifdef MOUSEKEY_ENABLE
,[_MSE] = LAYOUT_planck_mit(
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, XXXXXXX, XXXXXXX, KC_BTN1, KC_WH_D, KC_WH_U, KC_BTN2, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, MS_ACL_D, TOG_MSE, MS_ACL_U,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
)
#endif // MOUSEKEY_ENABLE
};
#define LAYER (get_highest_layer(layer_state))
@ -126,6 +149,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
#endif
#ifdef MOUSEKEY_ENABLE
if (keycode == MS_ACL_U || keycode == MS_ACL_D) {
if (record->event.pressed) {
if ( (keycode == MS_ACL_U) && (current_accel < 2) ) { current_accel += 1; }
if ( (keycode == MS_ACL_D) && (current_accel > 0) ) { current_accel -= 1; }
}
keycode = KC_ACL0 + current_accel;
action_t mousekey_action = action_for_keycode(keycode);
process_action(record, mousekey_action);
}
#endif
switch (keycode) {
#ifdef DYNAMIC_MACRO_ENABLE
case MCR_SWT:

View file

@ -5,34 +5,44 @@ A layout that aims to be familiar to people that have used larger boards
## The layout
The primary layer ( `_MAIN` ) is as close to standard qwerty as I could get.
```
esc | q | w | e | r | t | y | u | i | o | p | bksp
tab | a | s | d | f | g | h | j | k | l | ; | '
shft | z | x | c | v | b | n | m | , | . | / | rtrn
ctrl | win | | alt | SUB | spc | CTR | lft | dwn | up | rght
```
| row | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|-----|------|------|---|-----|-----|-----|-----|-----|-----|-----|----|------|
| 1 | esc | q | w | e | r | t | y | u | i | o | p | bksp |
| 2 | tab | a | s | d | f | g | h | j | k | l | ; | ' |
| 3 | shft | z | x | c | v | b | n | m | , | . | / | rtrn |
| 4 | ctrl | win | | alt | SUB | spc | <- | CTR | lft | dwn | up | rght |
The secondary layer ( `_SUB` ) is for syntax, F keys, and number keys
```
grv | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | del
| F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | pgup
_ | F7 | F8 | F9 | F10 | F11 | F12 | | home | end | \ | pgdn
_ | _ | | _ | _ | _ | _ | | | |
```
| row | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|-----|-----|----|----|----|-----|-----|-----|----|------|-----|----|------|
| 1 | grv | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | del |
| 2 | | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | pgup |
| 3 | _ | F7 | F8 | F9 | F10 | F11 | F12 | | home | end | \ | pgdn |
| 4 | _ | _ | | _ | _ | _ | <- | _ | | | | |
The control layer ( `_CTR` ) is for lighting, media, and macros
```
| SPD- | BRI+ | SPD+ | HUE+ | SAT+ | | | VOL+ | | | MCR_REC
| EFCT- | BRI- | EFCT+ | HUE- | SAT- | | PREV | PLAY | NEXT | | MCR_PLY
| | TOG | | | | | | VOL- | | | MCR_SWT
| | | | | _ | | | | |
```
| row | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|-----|---|-------|------|-------|------|---------|-----|------|------|------|----|---------|
| 1 | | SPD- | BRI+ | SPD+ | HUE+ | SAT+ | | | VOL+ | | | MCR_REC |
| 2 | | EFCT- | BRI- | EFCT+ | HUE- | SAT- | | PREV | PLAY | NEXT | | MCR_PLY |
| 3 | | | TOG | | | | | | VOL- | | | MCR_SWT |
| 4 | | | | | | MSE_TOG | <- | | | | | |
The mouse layer ( `_MSE` ) is for making the keyboard function as a mouse as well
| row | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|-----|---|------|------|------|-------|---------|-----|-------|-------|-------|-------|----|
| 1 | | | | | | | | | | | | |
| 2 | | MS_L | MS_D | MS_U | MS_R | | | L_CLC | SCR_D | SCR_U | R_CLC | |
| 3 | | | | | | | | | | | | |
| 4 | | | | | ACL_D | MSE_TOG | <- | ACL_U | | | | |
| Key name | Explanation |
| -------- | -------------------------------------- |
|----------|----------------------------------------------|
| \_ | Passthrough the key on the layer below |
| <- | Same key as imediate left. Used for spacebar |
| SUB | Goes to _SUB layer while held down |
| CTR | Goes to _CTR layer while held down |
| MSE_TOG | Toggles the mouse layer on or off |
| SPD +/- | Changes speed for the RGB effect |
| BRI +/- | Changes the brightness of the lighting |
| EFCT +/- | Moves to the next/previous effect |
@ -47,6 +57,16 @@ The control layer ( `_CTR` ) is for lighting, media, and macros
| MCR_REC | Record macro ( Press again to stop ) |
| MCR_PLY | Play recorded macro |
| MCR_SWT | Switch active macro |
| MS_L | Move mouse cursor left |
| MS_U | Move mouse cursor up |
| MS_D | Move mouse cursor down |
| MD_R | Move mouse cursor right |
| L_CLC | Mouse left click |
| R_CLC | Mouse right click |
| SCR_U | Mouse scroll up |
| SCR_D | Mouse scroll down |
| ACL_U | Raise mouse/scroll speed |
| ACL_D | Lower mouse/scroll speed |
## Compiling

View file

@ -1,4 +1,4 @@
MOUSEKEY_ENABLE = no
MOUSEKEY_ENABLE = yes
NKRO_ENABLE = yes
DYNAMIC_MACRO_ENABLE = yes
LTO_ENABLE = yes