diff options
4 files changed, 309 insertions, 0 deletions
diff --git a/keyboards/kprepublic/bm40hsrgb/keymaps/coffee/config.h b/keyboards/kprepublic/bm40hsrgb/keymaps/coffee/config.h new file mode 100644 index 0000000000..bfcec37892 --- /dev/null +++ b/keyboards/kprepublic/bm40hsrgb/keymaps/coffee/config.h @@ -0,0 +1,85 @@ +// Copyright 2022 Fae Fankhauser (@CoffeeIsLife87) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define LAYER_STATE_8BIT + +// RGB Matrix effects disable +#ifdef RGB_MATRIX_ENABLE +# define UNDERGLOW_DISABLE + +# define RGB_TRIGGER_ON_KEYDOWN + +# define RGB_MATRIX_LED_FLUSH_LIMIT 10 + +# undef ENABLE_RGB_MATRIX_SOLID_COLOR +# undef ENABLE_RGB_MATRIX_ALPHAS_MODS +# undef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +# undef ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +# undef ENABLE_RGB_MATRIX_BREATHING +# undef ENABLE_RGB_MATRIX_BAND_SAT +# undef ENABLE_RGB_MATRIX_BAND_VAL +# undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +# undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +# undef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT +# undef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL + +# undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# undef ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# undef ENABLE_RGB_MATRIX_DUAL_BEACON +# undef ENABLE_RGB_MATRIX_RAINBOW_BEACON +# undef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +# undef ENABLE_RGB_MATRIX_RAINDROPS +# undef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +# undef ENABLE_RGB_MATRIX_HUE_BREATHING +# undef ENABLE_RGB_MATRIX_HUE_PENDULUM +# undef ENABLE_RGB_MATRIX_HUE_WAVE +# undef ENABLE_RGB_MATRIX_PIXEL_RAIN +# undef ENABLE_RGB_MATRIX_PIXEL_FLOW +# undef ENABLE_RGB_MATRIX_PIXEL_FRACTAL + +# undef ENABLE_RGB_MATRIX_TYPING_HEATMAP +# undef ENABLE_RGB_MATRIX_DIGITAL_RAIN + +# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +# undef ENABLE_RGB_MATRIX_SPLASH +# undef ENABLE_RGB_MATRIX_SOLID_SPLASH +# undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH +#endif + +// If RGBLight is enabled +#ifdef RGBLIGHT_ENABLE +# define RGBLED_NUM DRIVER_LED_TOTAL + +# define RGBLIGHT_EFFECT_SNAKE +# define RGBLIGHT_EFFECT_STATIC_GRADIENT +#endif + +// Feature disable +#ifndef NO_PRINT +# define NO_PRINT +#endif + +#ifndef NO_DEBUG +# define NO_DEBUG +#endif + +#ifndef NO_ACTION_ONESHOT +# define NO_ACTION_ONESHOT +#endif + +// Configure features +#ifdef DYNAMIC_MACRO_ENABLE +# define DYNAMIC_MACRO_USER_CALL +# define DYNAMIC_MACRO_NO_NESTING +#endif + +#ifdef MOUSEKEY_ENABLE +# define MOUSEKEY_INTERVAL 16 // 60 FPS +# define MK_3_SPEED +#endif
\ No newline at end of file diff --git a/keyboards/kprepublic/bm40hsrgb/keymaps/coffee/keymap.c b/keyboards/kprepublic/bm40hsrgb/keymaps/coffee/keymap.c new file mode 100644 index 0000000000..9130bd678e --- /dev/null +++ b/keyboards/kprepublic/bm40hsrgb/keymaps/coffee/keymap.c @@ -0,0 +1,165 @@ +// Copyright 2022 Fae Fankhauser (@CoffeeIsLife87) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +enum custom_keycodes { + NULLKEY = SAFE_RANGE, // An empty key to start (and maybe end) the enum + #ifdef DYNAMIC_MACRO_ENABLE + MCR_PLY, // Macro play + MCR_REC, // Macro record + MCR_SWT, // Swap active macro + #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 + _END, +}; + +#ifdef DYNAMIC_MACRO_ENABLE + // Macro 1 is = 1, Macro 2 = -1, No macro = 0 + static bool MACRO1 = true; + static bool RECORDING = false; + + static uint16_t REC = DM_REC1; + static uint16_t PLY = DM_PLY1; + + void dynamic_macro_record_start_user(void) { + REC = DM_RSTP; + RECORDING = true; + } + void dynamic_macro_record_end_user(int8_t direction) { + RECORDING = false; + } +#else + #define MCR_PLY KC_NO + #define MCR_REC KC_NO + #define MCR_SWT KC_NO +#endif + +const uint16_t PROGMEM keymaps[_END][MATRIX_ROWS][MATRIX_COLS] = { + [_MAIN] = LAYOUT_planck_mit( + KC_ESC , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_BSPC, + KC_TAB , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_ENT , + KC_LCTL, KC_LGUI, XXXXXXX,KC_LALT ,MO(_SUB), KC_SPC ,MO(_CTR), KC_LEFT, KC_DOWN, KC_UP , KC_RGHT + ), + [_SUB] = LAYOUT_planck_mit( + KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_DEL, + XXXXXXX, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_MINS, KC_EQL , KC_LBRC, KC_RBRC, KC_PGUP, + _______, KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , XXXXXXX, XXXXXXX, XXXXXXX, KC_BSLS, KC_PGDN, + _______, _______, XXXXXXX, _______, _______, _______ , _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + ), + [_CTR] = LAYOUT_planck_mit( + 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 + ) +}; + +#define LAYER (get_highest_layer(layer_state)) +#define LAYER_SIZE (MATRIX_ROWS * MATRIX_COLS) +#define CHECK_LED() \ + if ((i >= DRIVER_LED_TOTAL) \ + || ((g_led_config.flags[pos] == LED_FLAG_NONE) || (g_led_config.flags[pos] == LED_FLAG_UNDERGLOW))) \ + continue + +#ifdef RGB_MATRIX_ENABLE + + #ifdef UNDERGLOW_DISABLE + void keyboard_pre_init_user(void) { + + for (int key_id = 0; key_id < DRIVER_LED_TOTAL; key_id++ ) { + if (g_led_config.flags[key_id] == LED_FLAG_UNDERGLOW) { + g_led_config.flags[key_id] = LED_FLAG_NONE; + } + } + } + #endif + + void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + if (LAYER != _MAIN) { + + int DimmedMax = UINT8_MAX - (UINT8_MAX - rgb_matrix_config.hsv.v); + + for (uint8_t i = led_min; i <= led_max; i++) { + + uint8_t pos = ((uint8_t*)g_led_config.matrix_co)[i]; + + CHECK_LED(); // Check LED before moving on + uint16_t KC = pgm_read_word(&((uint16_t*)keymaps)[(LAYER_SIZE * LAYER) + i]); + + if (KC == KC_NO) { + RGB_MATRIX_INDICATOR_SET_COLOR(pos, 0, 0, 0 ); + } + + #ifdef DYNAMIC_MACRO_ENABLE + else if (KC == MCR_SWT) { + if (!MACRO1) { + RGB_MATRIX_INDICATOR_SET_COLOR(pos, 0, DimmedMax, DimmedMax); + } + } else if (KC == MCR_REC) { + if (RECORDING) { + RGB_MATRIX_INDICATOR_SET_COLOR(pos, DimmedMax, 0, 0); + } + } + #endif + + } + } + } +#endif + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + + #ifdef DYNAMIC_MACRO_ENABLE + if (keycode == MCR_REC) keycode = REC; + if (keycode == MCR_PLY) keycode = PLY; + if (!process_dynamic_macro(keycode, record)) { + REC = (MACRO1 ? DM_REC1 : DM_REC2); + return false; + } + #endif + + switch (keycode) { + #ifdef DYNAMIC_MACRO_ENABLE + case MCR_SWT: + if (!RECORDING && record->event.pressed) { + // if the button is pressed and we're not recording + MACRO1 = !MACRO1; + if (MACRO1) { + REC = DM_REC1; + PLY = DM_PLY1; + } else { + REC = DM_REC2; + PLY = DM_PLY2; + } + } + return false; + #endif + + #if defined(RGB_MATRIX_ENABLE) && defined(RGBLIGHT_ENABLE) // this only needs to be defined if both are enabled + case RGB_TOG: // We can intercept this keycode ig? Cool :) + if (record->event.pressed) { + if (rgb_matrix_is_enabled()) { + rgb_matrix_disable/*_noeeprom*/(); + rgblight_enable/*_noeeprom*/(); + } else if (rgblight_is_enabled()) { + rgb_matrix_disable/*_noeeprom*/(); + rgblight_disable/*_noeeprom*/(); + } else { + rgb_matrix_enable/*_noeeprom*/(); + rgblight_disable/*_noeeprom*/(); + } + } + return false; + #endif + + default: + return true; //Process all other keycodes normally + } +}
\ No newline at end of file diff --git a/keyboards/kprepublic/bm40hsrgb/keymaps/coffee/readme.md b/keyboards/kprepublic/bm40hsrgb/keymaps/coffee/readme.md new file mode 100644 index 0000000000..2fb004cece --- /dev/null +++ b/keyboards/kprepublic/bm40hsrgb/keymaps/coffee/readme.md @@ -0,0 +1,55 @@ +# Kprepublic BM40HSRGB Coffee + +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 +``` + +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 | | | | \ | pgdn + _ | _ | | _ | _ | _ | _ | | | | +``` + +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 + | | | | | _ | | | | | +``` + +| Key name | Explanation | +| -------- | -------------------------------------- | +| \_ | Passthrough the key on the layer below | +| SUB | Goes to _SUB layer while held down | +| CTR | Goes to _CTR layer while held down | +| SPD +/- | Changes speed for the RGB effect | +| BRI +/- | Changes the brightness of the lighting | +| EFCT +/- | Moves to the next/previous effect | +| TOG | Toggles the lighting on or off | +| HUE +/- | Changes the hue for RGB effects | +| SAT +/- | Changes the saturation for RGB effects | +| MSE | Toggles the Mouse layer | +| VOL +/- | Raises or lowers media volume | +| PREV | Goes to previous media | +| PLAY | Play/Pause media | +| NEXT | Goes to next media | +| MCR_REC | Record macro ( Press again to stop ) | +| MCR_PLY | Play recorded macro | +| MCR_SWT | Switch active macro | + +## Compiling + +Compiling: `make kprepublic/bm40hsrgb:coffee` + +Flashing: `make kprepublic/bm40hsrgb:coffee:flash` diff --git a/keyboards/kprepublic/bm40hsrgb/keymaps/coffee/rules.mk b/keyboards/kprepublic/bm40hsrgb/keymaps/coffee/rules.mk new file mode 100644 index 0000000000..5d3039b8e2 --- /dev/null +++ b/keyboards/kprepublic/bm40hsrgb/keymaps/coffee/rules.mk @@ -0,0 +1,4 @@ +MOUSEKEY_ENABLE = no +NKRO_ENABLE = yes +DYNAMIC_MACRO_ENABLE = yes +LTO_ENABLE = yes
\ No newline at end of file |