From 80ed013a54ebb76796ae50bda437485593f91efb Mon Sep 17 00:00:00 2001 From: Daniel Prilik Date: Wed, 6 Mar 2019 15:24:08 -0800 Subject: [PATCH 1/5] port Massdrop CTRL/ALT to use RGB Matrix Co-authored-by: Matt Schneeberger --- docs/feature_rgb_matrix.md | 15 +- keyboards/massdrop/alt/config.h | 2 + keyboards/massdrop/alt/config_led.c | 148 +++++ keyboards/massdrop/alt/config_led.h | 20 +- .../massdrop/alt/keymaps/abishalom/keymap.c | 122 +--- .../massdrop/alt/keymaps/default/keymap.c | 122 +--- keyboards/massdrop/alt/keymaps/mac/keymap.c | 122 +--- .../massdrop/alt/keymaps/prilik/keymap.c | 137 +++++ .../massdrop/alt/keymaps/prilik/rules.mk | 38 ++ .../massdrop/alt/keymaps/reywood/README.md | 5 + keyboards/massdrop/alt/rules.mk | 7 +- keyboards/massdrop/ctrl/config.h | 2 + keyboards/massdrop/ctrl/config_led.c | 144 +++++ keyboards/massdrop/ctrl/config_led.h | 18 +- .../massdrop/ctrl/keymaps/default/keymap.c | 126 +---- keyboards/massdrop/ctrl/keymaps/mac/keymap.c | 126 +---- .../ctrl/keymaps/responsive_pattern/README.md | 5 + keyboards/massdrop/ctrl/led_programs.c | 120 ---- keyboards/massdrop/ctrl/rules.mk | 7 +- quantum/rgb_matrix.c | 47 +- quantum/rgb_matrix.h | 19 +- tmk_core/common/arm_atsam/suspend.c | 9 +- tmk_core/protocol/arm_atsam.mk | 5 +- .../protocol/arm_atsam/arm_atsam_protocol.h | 3 + tmk_core/protocol/arm_atsam/i2c_master.c | 8 +- tmk_core/protocol/arm_atsam/led_matrix.c | 525 +++++++----------- tmk_core/protocol/arm_atsam/led_matrix.h | 85 ++- .../protocol/arm_atsam/led_matrix_programs.c | 5 +- tmk_core/protocol/arm_atsam/main_arm_atsam.c | 16 +- tmk_core/protocol/arm_atsam/usb/usb2422.c | 1 - 30 files changed, 949 insertions(+), 1060 deletions(-) create mode 100644 keyboards/massdrop/alt/config_led.c create mode 100644 keyboards/massdrop/alt/keymaps/prilik/keymap.c create mode 100644 keyboards/massdrop/alt/keymaps/prilik/rules.mk create mode 100644 keyboards/massdrop/alt/keymaps/reywood/README.md create mode 100644 keyboards/massdrop/ctrl/config_led.c create mode 100644 keyboards/massdrop/ctrl/keymaps/responsive_pattern/README.md delete mode 100644 keyboards/massdrop/ctrl/led_programs.c rename keyboards/massdrop/alt/led_programs.c => tmk_core/protocol/arm_atsam/led_matrix_programs.c (99%) diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 0af1e4947960..0699d5a954fc 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -84,7 +84,7 @@ Define these arrays listing all the LEDs in your `.c`: Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](http://www.issi.com/WW/pdf/31FL3733.pdf) and the header file `drivers/issi/is31fl3733.h`. The `driver` is the index of the driver you defined in your `config.h` (Only `0` right now). -From this point forward the configuration is the same for all the drivers. +From this point forward the configuration is the same for all the drivers. const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { /* {row | col << 4} @@ -150,7 +150,7 @@ These are the effects that are currently available: #endif RGB_MATRIX_EFFECT_MAX }; - + You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `config.h`: @@ -187,12 +187,13 @@ A similar function works in the keymap as `rgb_matrix_indicators_user`. ## Additional `config.h` Options - #define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot) - #define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened) - #define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects + #define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot) + #define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened) + #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_SKIP_FRAMES 1 // number of frames to skip when displaying animations (0 is full effect) if not defined defaults to 1 - #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 + #define RGB_MATRIX_SKIP_FRAMES 1 // number of frames to skip when displaying animations (0 is full effect) if not defined defaults to 1 + #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 + #define RGB_MATRIX_EXTRA_TOG // RGB_TOG key cycles from ALL > JUST_KEYS > JUST_UNDERGLOW > OFF (instead of just ON > OFF) ## EEPROM storage diff --git a/keyboards/massdrop/alt/config.h b/keyboards/massdrop/alt/config.h index d2f73a6a8e10..92f664b96938 100644 --- a/keyboards/massdrop/alt/config.h +++ b/keyboards/massdrop/alt/config.h @@ -119,3 +119,5 @@ along with this program. If not, see . //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION + +#include "config_led.h" diff --git a/keyboards/massdrop/alt/config_led.c b/keyboards/massdrop/alt/config_led.c new file mode 100644 index 000000000000..7d98e47c907b --- /dev/null +++ b/keyboards/massdrop/alt/config_led.c @@ -0,0 +1,148 @@ +#ifdef RGB_MATRIX_ENABLE +#include "alt.h" + +#include "led_matrix.h" +#include "rgb_matrix.h" +#include "config_led.h" + +// This table can be almost-automatically derived from ISSI3733_LED_MAP that is +// defined in config_led.h + +// You can calculate the (0-244, 0-64) x/y values from the x/y values defined in +// ISSI3733_LED_MAP with the following formula: +// uint8_t rgb_x = ((ISSI3733_LED_MAP[i].x - MIN_X) / (MAX_X - MIN_X)) * 224; +// uint8_t rgb_y = ((ISSI3733_LED_MAP[i].y - MIN_Y) / (MAX_Y - MIN_Y)) * 64; +// Where the min/max vars are the minimum and maximum "bounds" of x/y values +// present in ISSI3733_LED_MAP +// +// The row/col values need to be manually tweaked though, compensating for the +// "empty" cells that are a product of larger keys +// +// There is a quick-and-dirty implementation of this under ledvis.html + +const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { + /* 0 */ { { (0)|(0 << 4) }, { 8, 56 }, 0 }, // KC_ESC + /* 1 */ { { (0)|(1 << 4) }, { 22, 56 }, 0 }, // KC_1 + /* 2 */ { { (0)|(2 << 4) }, { 35, 56 }, 0 }, // KC_2 + /* 3 */ { { (0)|(3 << 4) }, { 49, 56 }, 0 }, // KC_3 + /* 4 */ { { (0)|(4 << 4) }, { 63, 56 }, 0 }, // KC_4 + /* 5 */ { { (0)|(5 << 4) }, { 77, 56 }, 0 }, // KC_5 + /* 6 */ { { (0)|(6 << 4) }, { 91, 56 }, 0 }, // KC_6 + /* 7 */ { { (0)|(7 << 4) }, { 105, 56 }, 0 }, // KC_7 + /* 8 */ { { (0)|(8 << 4) }, { 118, 56 }, 0 }, // KC_8 + /* 9 */ { { (0)|(9 << 4) }, { 132, 56 }, 0 }, // KC_9 + /* 10 */ { { (0)|(10 << 4) }, { 146, 56 }, 0 }, // KC_0 + /* 11 */ { { (0)|(11 << 4) }, { 160, 56 }, 0 }, // KC_MINS + /* 12 */ { { (0)|(12 << 4) }, { 174, 56 }, 0 }, // KC_EQL + /* 13 */ { { (0)|(13 << 4) }, { 195, 56 }, 0 }, // KC_BSPC + /* 14 */ { { (0)|(14 << 4) }, { 215, 56 }, 0 }, // KC_DEL + /* 15 */ { { (1)|(0 << 4) }, { 11, 44 }, 0 }, // KC_TAB + /* 16 */ { { (1)|(1 << 4) }, { 28, 44 }, 0 }, // KC_Q + /* 17 */ { { (1)|(2 << 4) }, { 42, 44 }, 0 }, // KC_W + /* 18 */ { { (1)|(3 << 4) }, { 56, 44 }, 0 }, // KC_E + /* 19 */ { { (1)|(4 << 4) }, { 70, 44 }, 0 }, // KC_R + /* 20 */ { { (1)|(5 << 4) }, { 84, 44 }, 0 }, // KC_T + /* 21 */ { { (1)|(6 << 4) }, { 98, 44 }, 0 }, // KC_Y + /* 22 */ { { (1)|(7 << 4) }, { 112, 44 }, 0 }, // KC_U + /* 23 */ { { (1)|(8 << 4) }, { 125, 44 }, 0 }, // KC_I + /* 24 */ { { (1)|(9 << 4) }, { 139, 44 }, 0 }, // KC_O + /* 25 */ { { (1)|(10 << 4) }, { 153, 44 }, 0 }, // KC_P + /* 26 */ { { (1)|(11 << 4) }, { 167, 44 }, 0 }, // KC_LBRC + /* 27 */ { { (1)|(12 << 4) }, { 181, 44 }, 0 }, // KC_RBRC + /* 28 */ { { (1)|(13 << 4) }, { 198, 44 }, 0 }, // KC_BSLS + /* 29 */ { { (1)|(14 << 4) }, { 215, 44 }, 0 }, // KC_HOME + /* 30 */ { { (2)|(0 << 4) }, { 13, 32 }, 1 }, // KC_CAPS + /* 31 */ { { (2)|(1 << 4) }, { 32, 32 }, 0 }, // KC_A + /* 32 */ { { (2)|(2 << 4) }, { 46, 32 }, 0 }, // KC_S + /* 33 */ { { (2)|(3 << 4) }, { 60, 32 }, 0 }, // KC_D + /* 34 */ { { (2)|(4 << 4) }, { 73, 32 }, 0 }, // KC_F + /* 35 */ { { (2)|(5 << 4) }, { 87, 32 }, 0 }, // KC_G + /* 36 */ { { (2)|(6 << 4) }, { 101, 32 }, 0 }, // KC_H + /* 37 */ { { (2)|(7 << 4) }, { 115, 32 }, 0 }, // KC_J + /* 38 */ { { (2)|(8 << 4) }, { 129, 32 }, 0 }, // KC_K + /* 39 */ { { (2)|(9 << 4) }, { 143, 32 }, 0 }, // KC_L + /* 40 */ { { (2)|(10 << 4) }, { 156, 32 }, 0 }, // KC_SCLN + /* 41 */ { { (2)|(11 << 4) }, { 170, 32 }, 0 }, // KC_QUOT + /* _________________________________________ */ // ____ + /* 42 */ { { (2)|(13 << 4) }, { 193, 32 }, 0 }, // KC_ENT + /* 43 */ { { (2)|(14 << 4) }, { 215, 32 }, 0 }, // KC_PGUP + /* 44 */ { { (3)|(0 << 4) }, { 16, 19 }, 0 }, // KC_LSFT + /* 45 */ { { (3)|(2 << 4) }, { 39, 19 }, 0 }, // KC_Z + /* 46 */ { { (3)|(3 << 4) }, { 53, 19 }, 0 }, // KC_X + /* 47 */ { { (3)|(4 << 4) }, { 67, 19 }, 0 }, // KC_C + /* 48 */ { { (3)|(5 << 4) }, { 80, 19 }, 0 }, // KC_V + /* 49 */ { { (3)|(6 << 4) }, { 94, 19 }, 0 }, // KC_B + /* 50 */ { { (3)|(7 << 4) }, { 108, 19 }, 0 }, // KC_N + /* 51 */ { { (3)|(8 << 4) }, { 122, 19 }, 0 }, // KC_M + /* 52 */ { { (3)|(9 << 4) }, { 136, 19 }, 0 }, // KC_COMM + /* 53 */ { { (3)|(10 << 4) }, { 150, 19 }, 0 }, // KC_DOT + /* 54 */ { { (3)|(11 << 4) }, { 163, 19 }, 0 }, // KC_SLSH + /* 55 */ { { (3)|(12 << 4) }, { 182, 19 }, 0 }, // KC_RSFT + /* _________________________________________ */ // ____ + /* 56 */ { { (3)|(13 << 4) }, { 201, 19 }, 0 }, // KC_UP + /* 57 */ { { (3)|(14 << 4) }, { 215, 19 }, 0 }, // KC_PGDN + /* 58 */ { { (4)|(0 << 4) }, { 9, 7 }, 0 }, // KC_LCTL + /* 59 */ { { (4)|(1 << 4) }, { 27, 7 }, 0 }, // KC_LGUI + /* 60 */ { { (4)|(2 << 4) }, { 44, 7 }, 0 }, // KC_LALT + /* _________________________________________ */ // ____ + /* _________________________________________ */ // ____ + /* _________________________________________ */ // ____ + /* 61 */ { { (4)|(6 << 4) }, { 96, 7 }, 0 }, // KC_SPC + /* _________________________________________ */ // ____ + /* _________________________________________ */ // ____ + /* _________________________________________ */ // ____ + /* 62 */ { { (4)|(10 << 4) }, { 148, 7 }, 0 }, // KC_RALT + /* 63 */ { { (4)|(11 << 4) }, { 165, 7 }, 0 }, // MO(1) + /* 64 */ { { (4)|(12 << 4) }, { 188, 7 }, 0 }, // KC_LEFT + /* 65 */ { { (4)|(13 << 4) }, { 201, 7 }, 0 }, // KC_DOWN + /* 66 */ { { (4)|(14 << 4) }, { 215, 7 }, 0 }, // KC_RGHT + + // Underglow LEDs + { { 255 }, { 1, 1 }, 0 }, + { { 255 }, { 15, 0 }, 0 }, + { { 255 }, { 31, 0 }, 0 }, + { { 255 }, { 47, 0 }, 0 }, + { { 255 }, { 63, 0 }, 0 }, + { { 255 }, { 79, 0 }, 0 }, + { { 255 }, { 95, 0 }, 0 }, + { { 255 }, { 112, 0 }, 0 }, + { { 255 }, { 128, 0 }, 0 }, + { { 255 }, { 144, 0 }, 0 }, + { { 255 }, { 160, 0 }, 0 }, + { { 255 }, { 176, 0 }, 0 }, + { { 255 }, { 192, 0 }, 0 }, + { { 255 }, { 208, 0 }, 0 }, + { { 255 }, { 222, 1 }, 0 }, + { { 255 }, { 224, 13 }, 0 }, + { { 255 }, { 224, 25 }, 0 }, + { { 255 }, { 224, 38 }, 0 }, + { { 255 }, { 224, 50 }, 0 }, + { { 255 }, { 222, 62 }, 0 }, + { { 255 }, { 191, 64 }, 0 }, + { { 255 }, { 179, 64 }, 0 }, + { { 255 }, { 167, 64 }, 0 }, + { { 255 }, { 153, 64 }, 0 }, + { { 255 }, { 139, 64 }, 0 }, + { { 255 }, { 125, 64 }, 0 }, + { { 255 }, { 112, 64 }, 0 }, + { { 255 }, { 98, 64 }, 0 }, + { { 255 }, { 84, 64 }, 0 }, + { { 255 }, { 70, 64 }, 0 }, + { { 255 }, { 56, 64 }, 0 }, + { { 255 }, { 42, 64 }, 0 }, + { { 255 }, { 28, 64 }, 0 }, + { { 255 }, { 1, 62 }, 0 }, + { { 255 }, { 0, 50 }, 0 }, + { { 255 }, { 0, 38 }, 0 }, + { { 255 }, { 0, 25 }, 0 }, + { { 255 }, { 0, 13 }, 0 }, +}; + +#ifdef USB_LED_INDICATOR_ENABLE +void rgb_matrix_indicators_kb(void) +{ + led_matrix_indicators(); +} +#endif // USB_LED_INDICATOR_ENABLE + +#endif diff --git a/keyboards/massdrop/alt/config_led.h b/keyboards/massdrop/alt/config_led.h index a049e38179a6..7b8b786801de 100644 --- a/keyboards/massdrop/alt/config_led.h +++ b/keyboards/massdrop/alt/config_led.h @@ -15,11 +15,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef _config_led_h_ -#define _config_led_h_ +#pragma once //Define number of ISSI3733 drivers being used (1...16) #define ISSI3733_DRIVER_COUNT 2 +#define DRIVER_LED_TOTAL ISSI3733_LED_COUNT //Hardware address of each driver (Refer to ISSI3733 pdf "Table 1 Slave Address" and keyboard schematic) #define ISSI3773_DRIVER_ADDRESSES { 0xA0, 0xBE } @@ -30,22 +30,17 @@ along with this program. If not, see . //Count of LED bodies #define ISSI3733_LED_COUNT 105 -//Default Global Current Register value (Default brightness 0 - 255) -#define ISSI3733_GCR_DEFAULT 128 - #define LED_GCR_MAX 165 //Max GCR value (0 - 255) WARNING: Raising this value may overload the LED drivers and USB bus #define LED_GCR_STEP 10 //GCR increment/decrement value +//Default Global Current Register value (Default brightness 0 - 255) +#define ISSI3733_GCR_DEFAULT LED_GCR_MAX + //Automatic power rollback and recovery #define V5_HIGH 2540 //5V high level (After low power detect, point at which LEDs are allowed to use more power ) #define V5_LOW 2480 //5V low level (LED power rolled back to stay above this limit) #define V5_CAT 2200 //5V catastrophic level (Host USB port potential to shut down) -#define ANIMATION_SPEED_STEP 1 - -#define BREATHE_MIN_STEP 0 -#define BREATHE_MAX_STEP 255 - //LED Mapping - More practically generated from a spreadsheet program //id: ID of the LED (Sync with PCB callouts) //x: Physical X coordinate of LED (units do not matter) @@ -175,4 +170,7 @@ along with this program. If not, see . #define USB_LED_KANA_SCANCODE 255 #endif //USB_LED_INDICATOR_ENABLE -#endif //_config_led_h_ +#define RGB_MATRIX_KEYPRESSES +#define RGB_MATRIX_SKIP_FRAMES 1 +#define RGB_MATRIX_EXTRA_TOG + diff --git a/keyboards/massdrop/alt/keymaps/abishalom/keymap.c b/keyboards/massdrop/alt/keymaps/abishalom/keymap.c index 10bc62c1f0e6..a4519d404902 100644 --- a/keyboards/massdrop/alt/keymaps/abishalom/keymap.c +++ b/keyboards/massdrop/alt/keymaps/abishalom/keymap.c @@ -1,25 +1,13 @@ #include QMK_KEYBOARD_H enum alt_keycodes { - L_BRI = SAFE_RANGE, //LED Brightness Increase - L_BRD, //LED Brightness Decrease - L_PTN, //LED Pattern Select Next - L_PTP, //LED Pattern Select Previous - L_PSI, //LED Pattern Speed Increase - L_PSD, //LED Pattern Speed Decrease - L_T_MD, //LED Toggle Mode - L_T_ONF, //LED Toggle On / Off - L_ON, //LED On - L_OFF, //LED Off - L_T_BR, //LED Toggle Breath Effect - L_T_PTD, //LED Toggle Scrolling Pattern Direction - U_T_AUTO, //USB Extra Port Toggle Auto Detect / Always Active - U_T_AGCR, //USB Toggle Automatic GCR control - DBG_TOG, //DEBUG Toggle On / Off - DBG_MTRX, //DEBUG Toggle Matrix Prints - DBG_KBD, //DEBUG Toggle Keyboard Prints - DBG_MOU, //DEBUG Toggle Mouse Prints - MD_BOOT, //Restart into bootloader after hold timeout + U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active + U_T_AGCR, //USB Toggle Automatic GCR control + DBG_TOG, //DEBUG Toggle On / Off + DBG_MTRX, //DEBUG Toggle Matrix Prints + DBG_KBD, //DEBUG Toggle Keyboard Prints + DBG_MOU, //DEBUG Toggle Mouse Prints + MD_BOOT, //Restart into bootloader after hold timeout }; #define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode @@ -35,19 +23,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT \ ), [1] = LAYOUT( - KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_MUTE, \ - L_T_BR, L_PSD, L_BRI, L_PSI, KC_TRNS, KC_TRNS, KC_TRNS, U_T_AUTO,U_T_AGCR,KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, KC_END, \ - L_T_PTD, L_PTP, L_BRD, L_PTN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU, \ - KC_TRNS, L_T_MD, L_T_ONF, KC_TRNS, KC_TRNS, MD_BOOT, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_VOLD, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END \ + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MUTE, \ + _______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \ + _______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, \ + _______, RGB_TOG, _______, _______, _______, MD_BOOT, TG_NKRO, DBG_TOG, _______, _______, _______, _______, KC_PGUP, KC_VOLD, \ + _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END \ ), /* [X] = LAYOUT( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______ \ ), */ }; @@ -68,82 +56,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { static uint32_t key_timer; switch (keycode) { - case L_BRI: - if (record->event.pressed) { - if (LED_GCR_STEP > LED_GCR_MAX - gcr_desired) gcr_desired = LED_GCR_MAX; - else gcr_desired += LED_GCR_STEP; - if (led_animation_breathing) gcr_breathe = gcr_desired; - } - return false; - case L_BRD: - if (record->event.pressed) { - if (LED_GCR_STEP > gcr_desired) gcr_desired = 0; - else gcr_desired -= LED_GCR_STEP; - if (led_animation_breathing) gcr_breathe = gcr_desired; - } - return false; - case L_PTN: - if (record->event.pressed) { - if (led_animation_id == led_setups_count - 1) led_animation_id = 0; - else led_animation_id++; - } - return false; - case L_PTP: - if (record->event.pressed) { - if (led_animation_id == 0) led_animation_id = led_setups_count - 1; - else led_animation_id--; - } - return false; - case L_PSI: - if (record->event.pressed) { - led_animation_speed += ANIMATION_SPEED_STEP; - } - return false; - case L_PSD: - if (record->event.pressed) { - led_animation_speed -= ANIMATION_SPEED_STEP; - if (led_animation_speed < 0) led_animation_speed = 0; - } - return false; - case L_T_MD: - if (record->event.pressed) { - led_lighting_mode++; - if (led_lighting_mode > LED_MODE_MAX_INDEX) led_lighting_mode = LED_MODE_NORMAL; - } - return false; - case L_T_ONF: - if (record->event.pressed) { - led_enabled = !led_enabled; - I2C3733_Control_Set(led_enabled); - } - return false; - case L_ON: - if (record->event.pressed) { - led_enabled = 1; - I2C3733_Control_Set(led_enabled); - } - return false; - case L_OFF: - if (record->event.pressed) { - led_enabled = 0; - I2C3733_Control_Set(led_enabled); - } - return false; - case L_T_BR: - if (record->event.pressed) { - led_animation_breathing = !led_animation_breathing; - if (led_animation_breathing) { - gcr_breathe = gcr_desired; - led_animation_breathe_cur = BREATHE_MIN_STEP; - breathe_dir = 1; - } - } - return false; - case L_T_PTD: - if (record->event.pressed) { - led_animation_direction = !led_animation_direction; - } - return false; case U_T_AUTO: if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode"); diff --git a/keyboards/massdrop/alt/keymaps/default/keymap.c b/keyboards/massdrop/alt/keymaps/default/keymap.c index 10bc62c1f0e6..a4519d404902 100644 --- a/keyboards/massdrop/alt/keymaps/default/keymap.c +++ b/keyboards/massdrop/alt/keymaps/default/keymap.c @@ -1,25 +1,13 @@ #include QMK_KEYBOARD_H enum alt_keycodes { - L_BRI = SAFE_RANGE, //LED Brightness Increase - L_BRD, //LED Brightness Decrease - L_PTN, //LED Pattern Select Next - L_PTP, //LED Pattern Select Previous - L_PSI, //LED Pattern Speed Increase - L_PSD, //LED Pattern Speed Decrease - L_T_MD, //LED Toggle Mode - L_T_ONF, //LED Toggle On / Off - L_ON, //LED On - L_OFF, //LED Off - L_T_BR, //LED Toggle Breath Effect - L_T_PTD, //LED Toggle Scrolling Pattern Direction - U_T_AUTO, //USB Extra Port Toggle Auto Detect / Always Active - U_T_AGCR, //USB Toggle Automatic GCR control - DBG_TOG, //DEBUG Toggle On / Off - DBG_MTRX, //DEBUG Toggle Matrix Prints - DBG_KBD, //DEBUG Toggle Keyboard Prints - DBG_MOU, //DEBUG Toggle Mouse Prints - MD_BOOT, //Restart into bootloader after hold timeout + U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active + U_T_AGCR, //USB Toggle Automatic GCR control + DBG_TOG, //DEBUG Toggle On / Off + DBG_MTRX, //DEBUG Toggle Matrix Prints + DBG_KBD, //DEBUG Toggle Keyboard Prints + DBG_MOU, //DEBUG Toggle Mouse Prints + MD_BOOT, //Restart into bootloader after hold timeout }; #define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode @@ -35,19 +23,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT \ ), [1] = LAYOUT( - KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_MUTE, \ - L_T_BR, L_PSD, L_BRI, L_PSI, KC_TRNS, KC_TRNS, KC_TRNS, U_T_AUTO,U_T_AGCR,KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, KC_END, \ - L_T_PTD, L_PTP, L_BRD, L_PTN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU, \ - KC_TRNS, L_T_MD, L_T_ONF, KC_TRNS, KC_TRNS, MD_BOOT, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_VOLD, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END \ + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MUTE, \ + _______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \ + _______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, \ + _______, RGB_TOG, _______, _______, _______, MD_BOOT, TG_NKRO, DBG_TOG, _______, _______, _______, _______, KC_PGUP, KC_VOLD, \ + _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END \ ), /* [X] = LAYOUT( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______ \ ), */ }; @@ -68,82 +56,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { static uint32_t key_timer; switch (keycode) { - case L_BRI: - if (record->event.pressed) { - if (LED_GCR_STEP > LED_GCR_MAX - gcr_desired) gcr_desired = LED_GCR_MAX; - else gcr_desired += LED_GCR_STEP; - if (led_animation_breathing) gcr_breathe = gcr_desired; - } - return false; - case L_BRD: - if (record->event.pressed) { - if (LED_GCR_STEP > gcr_desired) gcr_desired = 0; - else gcr_desired -= LED_GCR_STEP; - if (led_animation_breathing) gcr_breathe = gcr_desired; - } - return false; - case L_PTN: - if (record->event.pressed) { - if (led_animation_id == led_setups_count - 1) led_animation_id = 0; - else led_animation_id++; - } - return false; - case L_PTP: - if (record->event.pressed) { - if (led_animation_id == 0) led_animation_id = led_setups_count - 1; - else led_animation_id--; - } - return false; - case L_PSI: - if (record->event.pressed) { - led_animation_speed += ANIMATION_SPEED_STEP; - } - return false; - case L_PSD: - if (record->event.pressed) { - led_animation_speed -= ANIMATION_SPEED_STEP; - if (led_animation_speed < 0) led_animation_speed = 0; - } - return false; - case L_T_MD: - if (record->event.pressed) { - led_lighting_mode++; - if (led_lighting_mode > LED_MODE_MAX_INDEX) led_lighting_mode = LED_MODE_NORMAL; - } - return false; - case L_T_ONF: - if (record->event.pressed) { - led_enabled = !led_enabled; - I2C3733_Control_Set(led_enabled); - } - return false; - case L_ON: - if (record->event.pressed) { - led_enabled = 1; - I2C3733_Control_Set(led_enabled); - } - return false; - case L_OFF: - if (record->event.pressed) { - led_enabled = 0; - I2C3733_Control_Set(led_enabled); - } - return false; - case L_T_BR: - if (record->event.pressed) { - led_animation_breathing = !led_animation_breathing; - if (led_animation_breathing) { - gcr_breathe = gcr_desired; - led_animation_breathe_cur = BREATHE_MIN_STEP; - breathe_dir = 1; - } - } - return false; - case L_T_PTD: - if (record->event.pressed) { - led_animation_direction = !led_animation_direction; - } - return false; case U_T_AUTO: if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode"); diff --git a/keyboards/massdrop/alt/keymaps/mac/keymap.c b/keyboards/massdrop/alt/keymaps/mac/keymap.c index 639eb2da75ed..26a1c6d01488 100644 --- a/keyboards/massdrop/alt/keymaps/mac/keymap.c +++ b/keyboards/massdrop/alt/keymaps/mac/keymap.c @@ -1,25 +1,13 @@ #include QMK_KEYBOARD_H enum alt_keycodes { - L_BRI = SAFE_RANGE, //LED Brightness Increase - L_BRD, //LED Brightness Decrease - L_PTN, //LED Pattern Select Next - L_PTP, //LED Pattern Select Previous - L_PSI, //LED Pattern Speed Increase - L_PSD, //LED Pattern Speed Decrease - L_T_MD, //LED Toggle Mode - L_T_ONF, //LED Toggle On / Off - L_ON, //LED On - L_OFF, //LED Off - L_T_BR, //LED Toggle Breath Effect - L_T_PTD, //LED Toggle Scrolling Pattern Direction - U_T_AUTO, //USB Extra Port Toggle Auto Detect / Always Active - U_T_AGCR, //USB Toggle Automatic GCR control - DBG_TOG, //DEBUG Toggle On / Off - DBG_MTRX, //DEBUG Toggle Matrix Prints - DBG_KBD, //DEBUG Toggle Keyboard Prints - DBG_MOU, //DEBUG Toggle Mouse Prints - MD_BOOT, //Restart into bootloader after hold timeout + U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active + U_T_AGCR, //USB Toggle Automatic GCR control + DBG_TOG, //DEBUG Toggle On / Off + DBG_MTRX, //DEBUG Toggle Matrix Prints + DBG_KBD, //DEBUG Toggle Keyboard Prints + DBG_MOU, //DEBUG Toggle Mouse Prints + MD_BOOT, //Restart into bootloader after hold timeout }; #define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode @@ -35,19 +23,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(1), KC_LEFT, KC_DOWN, KC_RGHT \ ), [1] = LAYOUT( - KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_MUTE, \ - L_T_BR, L_PSD, L_BRI, L_PSI, KC_TRNS, KC_TRNS, KC_TRNS, U_T_AUTO,U_T_AGCR,KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, KC_END, \ - L_T_PTD, L_PTP, L_BRD, L_PTN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU, \ - KC_TRNS, L_T_MD, L_T_ONF, KC_TRNS, KC_TRNS, MD_BOOT, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_VOLD, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END \ + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MUTE, \ + _______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \ + _______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, \ + _______, RGB_TOG, _______, _______, _______, MD_BOOT, TG_NKRO, DBG_TOG, _______, _______, _______, _______, KC_PGUP, KC_VOLD, \ + _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END \ ), /* [X] = LAYOUT( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______ \ ), */ }; @@ -68,82 +56,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { static uint32_t key_timer; switch (keycode) { - case L_BRI: - if (record->event.pressed) { - if (LED_GCR_STEP > LED_GCR_MAX - gcr_desired) gcr_desired = LED_GCR_MAX; - else gcr_desired += LED_GCR_STEP; - if (led_animation_breathing) gcr_breathe = gcr_desired; - } - return false; - case L_BRD: - if (record->event.pressed) { - if (LED_GCR_STEP > gcr_desired) gcr_desired = 0; - else gcr_desired -= LED_GCR_STEP; - if (led_animation_breathing) gcr_breathe = gcr_desired; - } - return false; - case L_PTN: - if (record->event.pressed) { - if (led_animation_id == led_setups_count - 1) led_animation_id = 0; - else led_animation_id++; - } - return false; - case L_PTP: - if (record->event.pressed) { - if (led_animation_id == 0) led_animation_id = led_setups_count - 1; - else led_animation_id--; - } - return false; - case L_PSI: - if (record->event.pressed) { - led_animation_speed += ANIMATION_SPEED_STEP; - } - return false; - case L_PSD: - if (record->event.pressed) { - led_animation_speed -= ANIMATION_SPEED_STEP; - if (led_animation_speed < 0) led_animation_speed = 0; - } - return false; - case L_T_MD: - if (record->event.pressed) { - led_lighting_mode++; - if (led_lighting_mode > LED_MODE_MAX_INDEX) led_lighting_mode = LED_MODE_NORMAL; - } - return false; - case L_T_ONF: - if (record->event.pressed) { - led_enabled = !led_enabled; - I2C3733_Control_Set(led_enabled); - } - return false; - case L_ON: - if (record->event.pressed) { - led_enabled = 1; - I2C3733_Control_Set(led_enabled); - } - return false; - case L_OFF: - if (record->event.pressed) { - led_enabled = 0; - I2C3733_Control_Set(led_enabled); - } - return false; - case L_T_BR: - if (record->event.pressed) { - led_animation_breathing = !led_animation_breathing; - if (led_animation_breathing) { - gcr_breathe = gcr_desired; - led_animation_breathe_cur = BREATHE_MIN_STEP; - breathe_dir = 1; - } - } - return false; - case L_T_PTD: - if (record->event.pressed) { - led_animation_direction = !led_animation_direction; - } - return false; case U_T_AUTO: if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode"); diff --git a/keyboards/massdrop/alt/keymaps/prilik/keymap.c b/keyboards/massdrop/alt/keymaps/prilik/keymap.c new file mode 100644 index 000000000000..5c847d995612 --- /dev/null +++ b/keyboards/massdrop/alt/keymaps/prilik/keymap.c @@ -0,0 +1,137 @@ +#include QMK_KEYBOARD_H +#include "process_unicode.h" + +enum alt_keycodes { + U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active + U_T_AGCR, //USB Toggle Automatic GCR control + DBG_TOG, //DEBUG Toggle On / Off + DBG_MTRX, //DEBUG Toggle Matrix Prints + DBG_KBD, //DEBUG Toggle Keyboard Prints + DBG_MOU, //DEBUG Toggle Mouse Prints + MD_BOOT, //Restart into bootloader after hold timeout + + UC_HELP, // URL for QMK unicode help + UC_SHRG, // shrug - ¯\_(ツ)_/¯ +#define UC_BBB X(E_BBB) // dat B - 🅱️ +#define UC_100 X(E_100) // hundo - 💯 +#define UC_EYES X(E_EYES) // shifty eyes - 👀 +}; + +enum unicode_names { + E_BBB, + E_100, + E_EYES, +}; +const uint32_t PROGMEM unicode_map[] = { + [E_BBB] = 0x1F171, + [E_100] = 0x1F4AF, + [E_EYES] = 0x1F440, +}; + +enum alt_layers { + _QWERTY, + _ACTIONS, + _MEMES, +}; + +#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode +#define ___X___ XXXXXXX // KC_NO + +keymap_config_t keymap_config; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT( + KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_HOME, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT \ + ), + [_ACTIONS] = LAYOUT( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MUTE, \ + _______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \ + _______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, \ + _______, RGB_TOG, _______, _______, _______, MD_BOOT, TG_NKRO, DBG_TOG, KC_MPRV, KC_MNXT, KC_MPLY, _______, _______, KC_VOLD, \ + _______, _______, _______, KC_MPLY, MO(2), _______, _______, _______, _______ \ + ), + [_MEMES] = LAYOUT( + ___X___, UC_100, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, \ + ___X___, ___X___, ___X___, UC_EYES, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, \ + ___X___, ___X___, UC_SHRG, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, \ + ___X___, ___X___, ___X___, ___X___, ___X___, UC_BBB, ___X___, ___X___, ___X___, ___X___, UC_HELP, ___X___, ___X___, ___X___, \ + UC_M_OS, UC_M_WC, UC_M_LN, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___ \ + ), + /* + [X] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ), + */ +}; + +#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT)) +#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL)) +#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT)) + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + static uint32_t key_timer; + + switch (keycode) { + case UC_HELP: + if (record->event.pressed) { + SEND_STRING("https://beta.docs.qmk.fm/features/feature_unicode#input-modes" SS_TAP(X_ENTER)); + } + return false; + case UC_SHRG: // ¯\_(ツ)_/¯ + if (record->event.pressed) { + send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF"); + } + return false; + + /* Massdrop debug */ + case U_T_AUTO: + if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { + TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode"); + } + return false; + case U_T_AGCR: + if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { + TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode"); + } + return false; + case DBG_TOG: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode"); + } + return false; + case DBG_MTRX: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix"); + } + return false; + case DBG_KBD: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard"); + } + return false; + case DBG_MOU: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse"); + } + return false; + case MD_BOOT: + if (record->event.pressed) { + key_timer = timer_read32(); + } else { + if (timer_elapsed32(key_timer) >= 500) { + reset_keyboard(); + } + } + return false; + default: + return true; //Process all other keycodes normally + } +} diff --git a/keyboards/massdrop/alt/keymaps/prilik/rules.mk b/keyboards/massdrop/alt/keymaps/prilik/rules.mk new file mode 100644 index 000000000000..cf42a8acf900 --- /dev/null +++ b/keyboards/massdrop/alt/keymaps/prilik/rules.mk @@ -0,0 +1,38 @@ +# project specific files +SRC = matrix.c +SRC += config_led.c + +#For platform and packs +ARM_ATSAM = SAMD51J18A +MCU = cortex-m4 + +CUSTOM_MATRIX = yes + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches +HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) +VIRTSER_ENABLE = no # USB Serial Driver +RAW_ENABLE = no # Raw device +AUTO_SHIFT_ENABLE = no # Auto Shift + +# Unicode +UNICODEMAP_ENABLE = yes + +# Custom RGB matrix handling +RGB_MATRIX_ENABLE = custom diff --git a/keyboards/massdrop/alt/keymaps/reywood/README.md b/keyboards/massdrop/alt/keymaps/reywood/README.md new file mode 100644 index 000000000000..5ee630dfb803 --- /dev/null +++ b/keyboards/massdrop/alt/keymaps/reywood/README.md @@ -0,0 +1,5 @@ +# THIS KEYMAP IS BROKEN + +The CTRL and ALT have both been switched to using the QMK RGB Matrix system, +rendering any custom effects that used the old, custom Massdrop lighting system, +BROKEN. diff --git a/keyboards/massdrop/alt/rules.mk b/keyboards/massdrop/alt/rules.mk index c5539158f580..aa45c68056d8 100644 --- a/keyboards/massdrop/alt/rules.mk +++ b/keyboards/massdrop/alt/rules.mk @@ -1,6 +1,6 @@ # project specific files -SRC = led_programs.c -SRC += matrix.c +SRC = matrix.c +SRC += config_led.c #For platform and packs ARM_ATSAM = SAMD51J18A @@ -31,3 +31,6 @@ HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) VIRTSER_ENABLE = no # USB Serial Driver RAW_ENABLE = no # Raw device AUTO_SHIFT_ENABLE = no # Auto Shift + +# Custom RGB matrix handling +RGB_MATRIX_ENABLE = custom diff --git a/keyboards/massdrop/ctrl/config.h b/keyboards/massdrop/ctrl/config.h index 71ccac0f3991..e592d2e803b6 100644 --- a/keyboards/massdrop/ctrl/config.h +++ b/keyboards/massdrop/ctrl/config.h @@ -119,3 +119,5 @@ along with this program. If not, see . //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION + +#include "config_led.h" diff --git a/keyboards/massdrop/ctrl/config_led.c b/keyboards/massdrop/ctrl/config_led.c new file mode 100644 index 000000000000..afdbf3a2227b --- /dev/null +++ b/keyboards/massdrop/ctrl/config_led.c @@ -0,0 +1,144 @@ +#ifdef RGB_MATRIX_ENABLE +#include "ctrl.h" + +#include "led_matrix.h" +#include "rgb_matrix.h" +#include "config_led.h" + +const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { + // KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS + { { 0|(0<<4) }, { 7, 5 }, 0 }, + { { 0|(1<<4) }, { 31, 5 }, 0 }, + { { 0|(2<<4) }, { 43, 5 }, 0 }, + { { 0|(3<<4) }, { 55, 5 }, 0 }, + { { 0|(4<<4) }, { 67, 5 }, 0 }, + { { 0|(5<<4) }, { 85, 5 }, 0 }, + { { 0|(6<<4) }, { 97, 5 }, 0 }, + { { 0|(7<<4) }, { 109, 5 }, 0 }, + { { 6|(0<<4) }, { 121, 5 }, 0 }, + { { 6|(1<<4) }, { 139, 5 }, 0 }, + { { 6|(2<<4) }, { 151, 5 }, 0 }, + { { 6|(3<<4) }, { 163, 5 }, 0 }, + { { 6|(4<<4) }, { 175, 5 }, 0 }, + { { 6|(5<<4) }, { 193, 5 }, 0 }, + { { 6|(6<<4) }, { 205, 5 }, 1 }, + { { 6|(7<<4) }, { 217, 5 }, 0 }, + // KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP + { { 1|(0<<4) }, { 7, 20 }, 0 }, + { { 1|(1<<4) }, { 19, 20 }, 0 }, + { { 1|(2<<4) }, { 31, 20 }, 0 }, + { { 1|(3<<4) }, { 43, 20 }, 0 }, + { { 1|(4<<4) }, { 55, 20 }, 0 }, + { { 1|(5<<4) }, { 67, 20 }, 0 }, + { { 1|(6<<4) }, { 79, 20 }, 0 }, + { { 1|(7<<4) }, { 91, 20 }, 0 }, + { { 7|(0<<4) }, { 103, 20 }, 0 }, + { { 7|(1<<4) }, { 115, 20 }, 0 }, + { { 7|(2<<4) }, { 127, 20 }, 0 }, + { { 7|(3<<4) }, { 139, 20 }, 0 }, + { { 7|(4<<4) }, { 151, 20 }, 0 }, + { { 7|(5<<4) }, { 169, 20 }, 0 }, + { { 7|(6<<4) }, { 193, 20 }, 0 }, + { { 7|(7<<4) }, { 205, 20 }, 0 }, + { { 9|(7<<4) }, { 217, 20 }, 0 }, + // KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN + { { 2|(0<<4) }, { 10, 30 }, 0 }, + { { 2|(1<<4) }, { 25, 30 }, 0 }, + { { 2|(2<<4) }, { 37, 30 }, 0 }, + { { 2|(3<<4) }, { 49, 30 }, 0 }, + { { 2|(4<<4) }, { 61, 30 }, 0 }, + { { 2|(5<<4) }, { 73, 30 }, 0 }, + { { 2|(6<<4) }, { 85, 30 }, 0 }, + { { 2|(7<<4) }, { 97, 30 }, 0 }, + { { 8|(0<<4) }, { 109, 30 }, 0 }, + { { 8|(1<<4) }, { 121, 30 }, 0 }, + { { 8|(2<<4) }, { 133, 30 }, 0 }, + { { 8|(3<<4) }, { 145, 30 }, 0 }, + { { 8|(4<<4) }, { 157, 30 }, 0 }, + { { 8|(5<<4) }, { 172, 30 }, 0 }, + { { 8|(6<<4) }, { 193, 30 }, 0 }, + { { 8|(7<<4) }, { 205, 30 }, 0 }, + { { 9|(6<<4) }, { 217, 30 }, 0 }, + // KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT + { { 3|(0<<4) }, { 11, 39 }, 1 }, + { { 3|(1<<4) }, { 28, 39 }, 0 }, + { { 3|(2<<4) }, { 40, 39 }, 0 }, + { { 3|(3<<4) }, { 52, 39 }, 0 }, + { { 3|(4<<4) }, { 64, 39 }, 0 }, + { { 3|(5<<4) }, { 76, 39 }, 0 }, + { { 3|(6<<4) }, { 88, 39 }, 0 }, + { { 3|(7<<4) }, { 100, 39 }, 0 }, + { { 9|(0<<4) }, { 112, 39 }, 0 }, + { { 9|(1<<4) }, { 124, 39 }, 0 }, + { { 9|(2<<4) }, { 136, 39 }, 0 }, + { { 9|(3<<4) }, { 148, 39 }, 0 }, + { { 9|(4<<4) }, { 168, 39 }, 0 }, + // KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP + { { 4|(0<<4) }, { 14, 49 }, 0 }, + { { 4|(1<<4) }, { 34, 49 }, 0 }, + { { 4|(2<<4) }, { 46, 49 }, 0 }, + { { 4|(3<<4) }, { 58, 49 }, 0 }, + { { 4|(4<<4) }, { 70, 49 }, 0 }, + { { 4|(5<<4) }, { 82, 49 }, 0 }, + { { 4|(6<<4) }, { 94, 49 }, 0 }, + { { 4|(7<<4) }, { 106, 49 }, 0 }, + { { 10|(0<<4) }, { 118, 49 }, 0 }, + { { 10|(1<<4) }, { 130, 49 }, 0 }, + { { 10|(2<<4) }, { 142, 49 }, 0 }, + { { 10|(3<<4) }, { 165, 49 }, 0 }, + { { 9|(5<<4) }, { 205, 49 }, 0 }, + // KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + { { 5|(0<<4) }, { 8, 59 }, 0 }, + { { 5|(1<<4) }, { 23, 59 }, 0 }, + { { 5|(2<<4) }, { 38, 59 }, 0 }, + { { 5|(3<<4) }, { 83, 59 }, 0 }, + { { 5|(4<<4) }, { 129, 59 }, 0 }, + { { 5|(5<<4) }, { 144, 59 }, 0 }, + { { 5|(6<<4) }, { 159, 59 }, 0 }, + { { 5|(7<<4) }, { 174, 59 }, 0 }, + { { 10|(4<<4) }, { 193, 59 }, 0 }, + { { 10|(5<<4) }, { 205, 59 }, 0 }, + { { 10|(6<<4) }, { 217, 59 }, 0 }, + // Underglow / Border + { { 0xFF }, { 222, 64 }, 0 }, + { { 0xFF }, { 204, 64 }, 0 }, + { { 0xFF }, { 186, 64 }, 0 }, + { { 0xFF }, { 167, 64 }, 0 }, + { { 0xFF }, { 149, 64 }, 0 }, + { { 0xFF }, { 130, 64 }, 0 }, + { { 0xFF }, { 112, 64 }, 0 }, + { { 0xFF }, { 94, 64 }, 0 }, + { { 0xFF }, { 75, 64 }, 0 }, + { { 0xFF }, { 57, 64 }, 0 }, + { { 0xFF }, { 38, 64 }, 0 }, + { { 0xFF }, { 20, 64 }, 0 }, + { { 0xFF }, { 0, 64 }, 0 }, + { { 0xFF }, { 0, 47 }, 0 }, + { { 0xFF }, { 0, 32 }, 0 }, + { { 0xFF }, { 0, 17 }, 0 }, + { { 0xFF }, { 0, 0 }, 0 }, + { { 0xFF }, { 20, 0 }, 0 }, + { { 0xFF }, { 38, 0 }, 0 }, + { { 0xFF }, { 57, 0 }, 0 }, + { { 0xFF }, { 75, 0 }, 0 }, + { { 0xFF }, { 94, 0 }, 0 }, + { { 0xFF }, { 112, 0 }, 0 }, + { { 0xFF }, { 130, 0 }, 0 }, + { { 0xFF }, { 149, 0 }, 0 }, + { { 0xFF }, { 167, 0 }, 0 }, + { { 0xFF }, { 186, 0 }, 0 }, + { { 0xFF }, { 204, 0 }, 0 }, + { { 0xFF }, { 222, 1 }, 0 }, + { { 0xFF }, { 224, 17 }, 0 }, + { { 0xFF }, { 224, 32 }, 0 }, + { { 0xFF }, { 224, 47 }, 0 }, +}; + +#ifdef USB_LED_INDICATOR_ENABLE +void rgb_matrix_indicators_kb(void) +{ + led_matrix_indicators(); +} +#endif // USB_LED_INDICATOR_ENABLE + +#endif diff --git a/keyboards/massdrop/ctrl/config_led.h b/keyboards/massdrop/ctrl/config_led.h index 471ab7007d1f..2c2771b1a65e 100644 --- a/keyboards/massdrop/ctrl/config_led.h +++ b/keyboards/massdrop/ctrl/config_led.h @@ -15,11 +15,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef _config_led_h_ -#define _config_led_h_ +#pragma once //Define number of ISSI3733 drivers being used (1...16) #define ISSI3733_DRIVER_COUNT 2 +#define DRIVER_LED_TOTAL ISSI3733_LED_COUNT //Hardware address of each driver (Refer to ISSI3733 pdf "Table 1 Slave Address" and keyboard schematic) #define ISSI3773_DRIVER_ADDRESSES { 0xA0, 0xBE } @@ -30,22 +30,17 @@ along with this program. If not, see . //Count of LED bodies #define ISSI3733_LED_COUNT 119 -//Default Global Current Register value (Default brightness 0 - 255) -#define ISSI3733_GCR_DEFAULT 128 - #define LED_GCR_MAX 165 //Max GCR value (0 - 255) WARNING: Raising this value may overload the LED drivers and USB bus #define LED_GCR_STEP 10 //GCR increment/decrement value +//Default Global Current Register value (Default brightness 0 - 255) +#define ISSI3733_GCR_DEFAULT LED_GCR_MAX + //Automatic power rollback and recovery #define V5_HIGH 2540 //5V high level (After low power detect, point at which LEDs are allowed to use more power ) #define V5_LOW 2480 //5V low level (LED power rolled back to stay above this limit) #define V5_CAT 2200 //5V catastrophic level (Host USB port potential to shut down) -#define ANIMATION_SPEED_STEP 1 - -#define BREATHE_MIN_STEP 0 -#define BREATHE_MAX_STEP 255 - //LED Mapping - More practically generated from a spreadsheet program //id: ID of the LED (Sync with PCB callouts) //x: Physical X coordinate of LED (units do not matter) @@ -188,4 +183,5 @@ along with this program. If not, see . #define USB_LED_KANA_SCANCODE 255 #endif //USB_LED_INDICATOR_ENABLE -#endif //_config_led_h_ +#define RGB_MATRIX_SKIP_FRAMES 1 +#define RGB_MATRIX_EXTRA_TOG diff --git a/keyboards/massdrop/ctrl/keymaps/default/keymap.c b/keyboards/massdrop/ctrl/keymaps/default/keymap.c index cdb627f9c4b5..182abbbad4fa 100644 --- a/keyboards/massdrop/ctrl/keymaps/default/keymap.c +++ b/keyboards/massdrop/ctrl/keymaps/default/keymap.c @@ -1,25 +1,13 @@ #include QMK_KEYBOARD_H enum ctrl_keycodes { - L_BRI = SAFE_RANGE, //LED Brightness Increase - L_BRD, //LED Brightness Decrease - L_PTN, //LED Pattern Select Next - L_PTP, //LED Pattern Select Previous - L_PSI, //LED Pattern Speed Increase - L_PSD, //LED Pattern Speed Decrease - L_T_MD, //LED Toggle Mode - L_T_ONF, //LED Toggle On / Off - L_ON, //LED On - L_OFF, //LED Off - L_T_BR, //LED Toggle Breath Effect - L_T_PTD, //LED Toggle Scrolling Pattern Direction - U_T_AUTO, //USB Extra Port Toggle Auto Detect / Always Active - U_T_AGCR, //USB Toggle Automatic GCR control - DBG_TOG, //DEBUG Toggle On / Off - DBG_MTRX, //DEBUG Toggle Matrix Prints - DBG_KBD, //DEBUG Toggle Keyboard Prints - DBG_MOU, //DEBUG Toggle Mouse Prints - MD_BOOT, //Restart into bootloader after hold timeout + U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active + U_T_AGCR, //USB Toggle Automatic GCR control + DBG_TOG, //DEBUG Toggle On / Off + DBG_MTRX, //DEBUG Toggle Matrix Prints + DBG_KBD, //DEBUG Toggle Keyboard Prints + DBG_MOU, //DEBUG Toggle Mouse Prints + MD_BOOT, //Restart into bootloader after hold timeout }; #define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode @@ -36,21 +24,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \ ), [1] = LAYOUT( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, KC_MSTP, KC_VOLU, \ - L_T_BR, L_PSD, L_BRI, L_PSI, KC_TRNS, KC_TRNS, KC_TRNS, U_T_AUTO,U_T_AGCR,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_VOLD, \ - L_T_PTD, L_PTP, L_BRD, L_PTN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, L_T_MD, L_T_ONF, KC_TRNS, KC_TRNS, MD_BOOT, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU, \ + _______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \ + _______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, \ + _______, RGB_TOG, _______, _______, _______, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ ), /* [X] = LAYOUT( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ ), */ }; @@ -71,82 +59,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { static uint32_t key_timer; switch (keycode) { - case L_BRI: - if (record->event.pressed) { - if (LED_GCR_STEP > LED_GCR_MAX - gcr_desired) gcr_desired = LED_GCR_MAX; - else gcr_desired += LED_GCR_STEP; - if (led_animation_breathing) gcr_breathe = gcr_desired; - } - return false; - case L_BRD: - if (record->event.pressed) { - if (LED_GCR_STEP > gcr_desired) gcr_desired = 0; - else gcr_desired -= LED_GCR_STEP; - if (led_animation_breathing) gcr_breathe = gcr_desired; - } - return false; - case L_PTN: - if (record->event.pressed) { - if (led_animation_id == led_setups_count - 1) led_animation_id = 0; - else led_animation_id++; - } - return false; - case L_PTP: - if (record->event.pressed) { - if (led_animation_id == 0) led_animation_id = led_setups_count - 1; - else led_animation_id--; - } - return false; - case L_PSI: - if (record->event.pressed) { - led_animation_speed += ANIMATION_SPEED_STEP; - } - return false; - case L_PSD: - if (record->event.pressed) { - led_animation_speed -= ANIMATION_SPEED_STEP; - if (led_animation_speed < 0) led_animation_speed = 0; - } - return false; - case L_T_MD: - if (record->event.pressed) { - led_lighting_mode++; - if (led_lighting_mode > LED_MODE_MAX_INDEX) led_lighting_mode = LED_MODE_NORMAL; - } - return false; - case L_T_ONF: - if (record->event.pressed) { - led_enabled = !led_enabled; - I2C3733_Control_Set(led_enabled); - } - return false; - case L_ON: - if (record->event.pressed) { - led_enabled = 1; - I2C3733_Control_Set(led_enabled); - } - return false; - case L_OFF: - if (record->event.pressed) { - led_enabled = 0; - I2C3733_Control_Set(led_enabled); - } - return false; - case L_T_BR: - if (record->event.pressed) { - led_animation_breathing = !led_animation_breathing; - if (led_animation_breathing) { - gcr_breathe = gcr_desired; - led_animation_breathe_cur = BREATHE_MIN_STEP; - breathe_dir = 1; - } - } - return false; - case L_T_PTD: - if (record->event.pressed) { - led_animation_direction = !led_animation_direction; - } - return false; case U_T_AUTO: if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode"); diff --git a/keyboards/massdrop/ctrl/keymaps/mac/keymap.c b/keyboards/massdrop/ctrl/keymaps/mac/keymap.c index e41b5eba20ce..41cf82757240 100644 --- a/keyboards/massdrop/ctrl/keymaps/mac/keymap.c +++ b/keyboards/massdrop/ctrl/keymaps/mac/keymap.c @@ -1,25 +1,13 @@ #include QMK_KEYBOARD_H enum ctrl_keycodes { - L_BRI = SAFE_RANGE, //LED Brightness Increase - L_BRD, //LED Brightness Decrease - L_PTN, //LED Pattern Select Next - L_PTP, //LED Pattern Select Previous - L_PSI, //LED Pattern Speed Increase - L_PSD, //LED Pattern Speed Decrease - L_T_MD, //LED Toggle Mode - L_T_ONF, //LED Toggle On / Off - L_ON, //LED On - L_OFF, //LED Off - L_T_BR, //LED Toggle Breath Effect - L_T_PTD, //LED Toggle Scrolling Pattern Direction - U_T_AUTO, //USB Extra Port Toggle Auto Detect / Always Active - U_T_AGCR, //USB Toggle Automatic GCR control - DBG_TOG, //DEBUG Toggle On / Off - DBG_MTRX, //DEBUG Toggle Matrix Prints - DBG_KBD, //DEBUG Toggle Keyboard Prints - DBG_MOU, //DEBUG Toggle Mouse Prints - MD_BOOT, //Restart into bootloader after hold timeout + U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active + U_T_AGCR, //USB Toggle Automatic GCR control + DBG_TOG, //DEBUG Toggle On / Off + DBG_MTRX, //DEBUG Toggle Matrix Prints + DBG_KBD, //DEBUG Toggle Keyboard Prints + DBG_MOU, //DEBUG Toggle Mouse Prints + MD_BOOT, //Restart into bootloader after hold timeout }; #define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode @@ -36,21 +24,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \ ), [1] = LAYOUT( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, KC_MSTP, KC_VOLU, \ - L_T_BR, L_PSD, L_BRI, L_PSI, KC_TRNS, KC_TRNS, KC_TRNS, U_T_AUTO,U_T_AGCR,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_VOLD, \ - L_T_PTD, L_PTP, L_BRD, L_PTN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, L_T_MD, L_T_ONF, KC_TRNS, KC_TRNS, MD_BOOT, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU, \ + _______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \ + _______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, \ + _______, RGB_TOG, _______, _______, _______, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ ), /* [X] = LAYOUT( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ ), */ }; @@ -71,82 +59,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { static uint32_t key_timer; switch (keycode) { - case L_BRI: - if (record->event.pressed) { - if (LED_GCR_STEP > LED_GCR_MAX - gcr_desired) gcr_desired = LED_GCR_MAX; - else gcr_desired += LED_GCR_STEP; - if (led_animation_breathing) gcr_breathe = gcr_desired; - } - return false; - case L_BRD: - if (record->event.pressed) { - if (LED_GCR_STEP > gcr_desired) gcr_desired = 0; - else gcr_desired -= LED_GCR_STEP; - if (led_animation_breathing) gcr_breathe = gcr_desired; - } - return false; - case L_PTN: - if (record->event.pressed) { - if (led_animation_id == led_setups_count - 1) led_animation_id = 0; - else led_animation_id++; - } - return false; - case L_PTP: - if (record->event.pressed) { - if (led_animation_id == 0) led_animation_id = led_setups_count - 1; - else led_animation_id--; - } - return false; - case L_PSI: - if (record->event.pressed) { - led_animation_speed += ANIMATION_SPEED_STEP; - } - return false; - case L_PSD: - if (record->event.pressed) { - led_animation_speed -= ANIMATION_SPEED_STEP; - if (led_animation_speed < 0) led_animation_speed = 0; - } - return false; - case L_T_MD: - if (record->event.pressed) { - led_lighting_mode++; - if (led_lighting_mode > LED_MODE_MAX_INDEX) led_lighting_mode = LED_MODE_NORMAL; - } - return false; - case L_T_ONF: - if (record->event.pressed) { - led_enabled = !led_enabled; - I2C3733_Control_Set(led_enabled); - } - return false; - case L_ON: - if (record->event.pressed) { - led_enabled = 1; - I2C3733_Control_Set(led_enabled); - } - return false; - case L_OFF: - if (record->event.pressed) { - led_enabled = 0; - I2C3733_Control_Set(led_enabled); - } - return false; - case L_T_BR: - if (record->event.pressed) { - led_animation_breathing = !led_animation_breathing; - if (led_animation_breathing) { - gcr_breathe = gcr_desired; - led_animation_breathe_cur = BREATHE_MIN_STEP; - breathe_dir = 1; - } - } - return false; - case L_T_PTD: - if (record->event.pressed) { - led_animation_direction = !led_animation_direction; - } - return false; case U_T_AUTO: if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode"); diff --git a/keyboards/massdrop/ctrl/keymaps/responsive_pattern/README.md b/keyboards/massdrop/ctrl/keymaps/responsive_pattern/README.md new file mode 100644 index 000000000000..5ee630dfb803 --- /dev/null +++ b/keyboards/massdrop/ctrl/keymaps/responsive_pattern/README.md @@ -0,0 +1,5 @@ +# THIS KEYMAP IS BROKEN + +The CTRL and ALT have both been switched to using the QMK RGB Matrix system, +rendering any custom effects that used the old, custom Massdrop lighting system, +BROKEN. diff --git a/keyboards/massdrop/ctrl/led_programs.c b/keyboards/massdrop/ctrl/led_programs.c deleted file mode 100644 index ca27016454dc..000000000000 --- a/keyboards/massdrop/ctrl/led_programs.c +++ /dev/null @@ -1,120 +0,0 @@ -/* -Copyright 2018 Massdrop Inc. - -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 . -*/ - -#include "ctrl.h" -#include "led_matrix.h" - -//Teal <-> Salmon -led_setup_t leds_teal_salmon[] = { - { .hs = 0, .he = 33, .rs = 24, .re = 24, .gs = 215, .ge = 215, .bs = 204, .be = 204, .ef = EF_NONE }, - { .hs = 33, .he = 66, .rs = 24, .re = 255, .gs = 215, .ge = 114, .bs = 204, .be = 118, .ef = EF_NONE }, - { .hs = 66, .he = 100, .rs = 255, .re = 255, .gs = 114, .ge = 114, .bs = 118, .be = 118, .ef = EF_NONE }, - { .end = 1 }, -}; - -//Yellow -led_setup_t leds_yellow[] = { - { .hs = 0, .he = 100, .rs = 255, .re = 255, .gs = 255, .ge = 255, .bs = 0, .be = 0, .ef = EF_NONE }, - { .end = 1 }, -}; - -//Off -led_setup_t leds_off[] = { - { .hs = 0, .he = 100, .rs = 0, .re = 0, .gs = 0, .ge = 0, .bs = 0, .be = 0, .ef = EF_NONE }, - { .end = 1 }, -}; - -//Red -led_setup_t leds_red[] = { - { .hs = 0, .he = 100, .rs = 255, .re = 255, .gs = 0, .ge = 0, .bs = 0, .be = 0, .ef = EF_NONE }, - { .end = 1 }, -}; - -//Green -led_setup_t leds_green[] = { - { .hs = 0, .he = 100, .rs = 0, .re = 0, .gs = 255, .ge = 255, .bs = 0, .be = 0, .ef = EF_NONE }, - { .end = 1 }, -}; - -//Blue -led_setup_t leds_blue[] = { - { .hs = 0, .he = 100, .rs = 0, .re = 0, .gs = 0, .ge = 0, .bs = 255, .be = 255, .ef = EF_NONE }, - { .end = 1 }, -}; - -//White -led_setup_t leds_white[] = { - { .hs = 0, .he = 100, .rs = 255, .re = 255, .gs = 255, .ge = 255, .bs = 255, .be = 255, .ef = EF_NONE }, - { .end = 1 }, -}; - -//White with moving red stripe -led_setup_t leds_white_with_red_stripe[] = { - { .hs = 0, .he = 100, .rs = 255, .re = 255, .gs = 255, .ge = 255, .bs = 255, .be = 255, .ef = EF_NONE }, - { .hs = 0, .he = 15, .rs = 0, .re = 0, .gs = 0, .ge = 255, .bs = 0, .be = 255, .ef = EF_SCR_R | EF_SUBTRACT }, - { .hs = 15, .he = 30, .rs = 0, .re = 0, .gs = 255, .ge = 0, .bs = 255, .be = 0, .ef = EF_SCR_R | EF_SUBTRACT }, - { .end = 1 }, -}; - -//Black with moving red stripe -led_setup_t leds_black_with_red_stripe[] = { - { .hs = 0, .he = 15, .rs = 0, .re = 255, .gs = 0, .ge = 0, .bs = 0, .be = 0, .ef = EF_SCR_R }, - { .hs = 15, .he = 30, .rs = 255, .re = 0, .gs = 0, .ge = 0, .bs = 0, .be = 0, .ef = EF_SCR_R }, - { .end = 1 }, -}; - -//Rainbow no scrolling -led_setup_t leds_rainbow_ns[] = { - { .hs = 0, .he = 16.67, .rs = 255, .re = 255, .gs = 0, .ge = 255, .bs = 0, .be = 0, .ef = EF_OVER }, - { .hs = 16.67, .he = 33.33, .rs = 255, .re = 0, .gs = 255, .ge = 255, .bs = 0, .be = 0, .ef = EF_OVER }, - { .hs = 33.33, .he = 50, .rs = 0, .re = 0, .gs = 255, .ge = 255, .bs = 0, .be = 255, .ef = EF_OVER }, - { .hs = 50, .he = 66.67, .rs = 0, .re = 0, .gs = 255, .ge = 0, .bs = 255, .be = 255, .ef = EF_OVER }, - { .hs = 66.67, .he = 83.33, .rs = 0, .re = 255, .gs = 0, .ge = 0, .bs = 255, .be = 255, .ef = EF_OVER }, - { .hs = 83.33, .he = 100, .rs = 255, .re = 255, .gs = 0, .ge = 0, .bs = 255, .be = 0, .ef = EF_OVER }, - { .end = 1 }, -}; - -//Rainbow scrolling -led_setup_t leds_rainbow_s[] = { - { .hs = 0, .he = 16.67, .rs = 255, .re = 255, .gs = 0, .ge = 255, .bs = 0, .be = 0, .ef = EF_OVER | EF_SCR_R }, - { .hs = 16.67, .he = 33.33, .rs = 255, .re = 0, .gs = 255, .ge = 255, .bs = 0, .be = 0, .ef = EF_OVER | EF_SCR_R }, - { .hs = 33.33, .he = 50, .rs = 0, .re = 0, .gs = 255, .ge = 255, .bs = 0, .be = 255, .ef = EF_OVER | EF_SCR_R }, - { .hs = 50, .he = 66.67, .rs = 0, .re = 0, .gs = 255, .ge = 0, .bs = 255, .be = 255, .ef = EF_OVER | EF_SCR_R }, - { .hs = 66.67, .he = 83.33, .rs = 0, .re = 255, .gs = 0, .ge = 0, .bs = 255, .be = 255, .ef = EF_OVER | EF_SCR_R }, - { .hs = 83.33, .he = 100, .rs = 255, .re = 255, .gs = 0, .ge = 0, .bs = 255, .be = 0, .ef = EF_OVER | EF_SCR_R }, - { .end = 1 }, -}; - -//Add new LED animations here using one from above as example -//The last entry must be { .end = 1 } -//Add the new animation name to the list below following its format - -void *led_setups[] = { - leds_rainbow_s, - leds_rainbow_ns, - leds_teal_salmon, - leds_yellow, - leds_red, - leds_green, - leds_blue, - leds_white, - leds_white_with_red_stripe, - leds_black_with_red_stripe, - leds_off -}; - -const uint8_t led_setups_count = sizeof(led_setups) / sizeof(led_setups[0]); diff --git a/keyboards/massdrop/ctrl/rules.mk b/keyboards/massdrop/ctrl/rules.mk index c5539158f580..aa45c68056d8 100644 --- a/keyboards/massdrop/ctrl/rules.mk +++ b/keyboards/massdrop/ctrl/rules.mk @@ -1,6 +1,6 @@ # project specific files -SRC = led_programs.c -SRC += matrix.c +SRC = matrix.c +SRC += config_led.c #For platform and packs ARM_ATSAM = SAMD51J18A @@ -31,3 +31,6 @@ HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) VIRTSER_ENABLE = no # USB Serial Driver RAW_ENABLE = no # Raw device AUTO_SHIFT_ENABLE = no # Auto Shift + +# Custom RGB matrix handling +RGB_MATRIX_ENABLE = custom diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index 2ed36304dca5..79da72420a6a 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix.c @@ -107,6 +107,7 @@ void eeconfig_debug_rgb_matrix(void) { // Last led hit #define LED_HITS_TO_REMEMBER 8 +#define MAX_SEARCH_LEDS 8 uint8_t g_last_led_hit[LED_HITS_TO_REMEMBER] = {255}; uint8_t g_last_led_count = 0; @@ -114,7 +115,7 @@ void map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led_i, uint8_t rgb_led led; *led_count = 0; - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { + for (uint8_t i = 0; i < DRIVER_LED_TOTAL && *led_count < MAX_SEARCH_LEDS; i++) { // map_index_to_led(i, &led); led = g_rgb_leds[i]; if (row == led.matrix_co.row && column == led.matrix_co.col) { @@ -129,11 +130,28 @@ void rgb_matrix_update_pwm_buffers(void) { } void rgb_matrix_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) { +#ifdef RGB_MATRIX_EXTRA_TOG + const bool is_key = g_rgb_leds[index].matrix_co.raw != 0xff; + if ( + (rgb_matrix_config.enable == RGB_ZONE_KEYS && !is_key) || + (rgb_matrix_config.enable == RGB_ZONE_UNDER && is_key) + ) { + rgb_matrix_driver.set_color(index, 0, 0, 0); + return; + } +#endif + rgb_matrix_driver.set_color(index, red, green, blue); } void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) { +#ifdef RGB_MATRIX_EXTRA_TOG + for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + rgb_matrix_set_color(i, red, green, blue); + } +#else rgb_matrix_driver.set_color_all(red, green, blue); +#endif } bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) { @@ -341,6 +359,8 @@ void rgb_matrix_cycle_all(void) { HSV hsv = { .h = offset+offset2, .s = 255, .v = rgb_matrix_config.val }; RGB rgb = hsv_to_rgb( hsv ); rgb_matrix_set_color( i, rgb.r, rgb.g, rgb.b ); + } else { + rgb_matrix_set_color( i, 0, 0, 0 ); } } } @@ -365,6 +385,8 @@ void rgb_matrix_cycle_left_right(void) { hsv.h = point.x + offset + offset2; rgb = hsv_to_rgb( hsv ); rgb_matrix_set_color( i, rgb.r, rgb.g, rgb.b ); + } else { + rgb_matrix_set_color( i, 0, 0, 0 ); } } } @@ -539,6 +561,22 @@ void rgb_matrix_digital_rain( const bool initialize ) { } } +void rgb_matrix_breathing(void) { + uint8_t offset = ( g_tick << rgb_matrix_config.speed ) & 0xFF; + uint8_t breathing_step = offset << 1; // Going up + if (offset >> 7) breathing_step = 0xFF - breathing_step; // Going down + float f_step = (float)breathing_step; + float f_ratio = (f_step * f_step) / (255.f * 255.f); + float v = (float)rgb_matrix_config.val * f_ratio; + HSV hsv = { + .h = rgb_matrix_config.hue, + .s = rgb_matrix_config.sat, + .v = (uint8_t)v, + }; + RGB rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color_all(rgb.r, rgb.g, rgb.b); +} + void rgb_matrix_multisplash(void) { // if (g_any_key_hit < 0xFF) { HSV hsv = { .h = rgb_matrix_config.hue, .s = rgb_matrix_config.sat, .v = rgb_matrix_config.val }; @@ -749,6 +787,11 @@ void rgb_matrix_task(void) { rgb_matrix_digital_rain( initialize ); break; #endif + #ifndef DISABLE_RGB_MATRIX_BREATHING + case RGB_MATRIX_BREATHING: + rgb_matrix_breathing(); + break; + #endif #ifdef RGB_MATRIX_KEYPRESSES #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE case RGB_MATRIX_SOLID_REACTIVE: @@ -888,7 +931,7 @@ uint32_t rgb_matrix_get_tick(void) { } void rgb_matrix_toggle(void) { - rgb_matrix_config.enable ^= 1; + rgb_matrix_config.enable++; eeconfig_update_rgb_matrix(rgb_matrix_config.raw); } diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h index e43532d11e77..afde1ea49f0f 100644 --- a/quantum/rgb_matrix.h +++ b/quantum/rgb_matrix.h @@ -56,11 +56,23 @@ typedef struct uint8_t index; } rgb_indicator; +typedef enum { + RGB_ZONE_OFF = 0, + RGB_ZONE_ALL, + RGB_ZONE_KEYS, + RGB_ZONE_UNDER, +} rgb_zone_t; + typedef union { uint32_t raw; struct { - bool enable :1; +#ifdef RGB_MATRIX_EXTRA_TOG + uint8_t enable :2; + uint8_t mode :5; +#else + uint8_t enable :1; uint8_t mode :6; +#endif uint16_t hue :9; uint8_t sat :8; uint8_t val :8; @@ -106,6 +118,9 @@ enum rgb_matrix_effects { #ifndef DISABLE_RGB_MATRIX_DIGITAL_RAIN RGB_MATRIX_DIGITAL_RAIN, #endif +#ifndef DISABLE_RGB_MATRIX_BREATHING + RGB_MATRIX_BREATHING, +#endif #ifdef RGB_MATRIX_KEYPRESSES #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE RGB_MATRIX_SOLID_REACTIVE, @@ -220,4 +235,6 @@ typedef struct { extern const rgb_matrix_driver_t rgb_matrix_driver; +extern rgb_config_t rgb_matrix_config; + #endif diff --git a/tmk_core/common/arm_atsam/suspend.c b/tmk_core/common/arm_atsam/suspend.c index e34965df64e1..9c2c47d5610c 100644 --- a/tmk_core/common/arm_atsam/suspend.c +++ b/tmk_core/common/arm_atsam/suspend.c @@ -35,7 +35,9 @@ void suspend_power_down_kb(void) { */ void suspend_power_down(void) { +#ifdef RGB_MATRIX_ENABLE I2C3733_Control_Set(0); //Disable LED driver +#endif suspend_power_down_kb(); } @@ -75,10 +77,9 @@ void suspend_wakeup_init_kb(void) { * FIXME: needs doc */ void suspend_wakeup_init(void) { - /* If LEDs are set to enabled, enable the hardware */ - if (led_enabled) { - I2C3733_Control_Set(1); - } +#ifdef RGB_MATRIX_ENABLE + I2C3733_Control_Set(1); +#endif suspend_wakeup_init_kb(); } diff --git a/tmk_core/protocol/arm_atsam.mk b/tmk_core/protocol/arm_atsam.mk index 04e02790a0dc..8d6f724f0996 100644 --- a/tmk_core/protocol/arm_atsam.mk +++ b/tmk_core/protocol/arm_atsam.mk @@ -4,7 +4,10 @@ SRC += $(ARM_ATSAM_DIR)/adc.c SRC += $(ARM_ATSAM_DIR)/clks.c SRC += $(ARM_ATSAM_DIR)/d51_util.c SRC += $(ARM_ATSAM_DIR)/i2c_master.c -SRC += $(ARM_ATSAM_DIR)/led_matrix.c +ifeq ($(RGB_MATRIX_ENABLE),custom) + SRC += $(ARM_ATSAM_DIR)/led_matrix_programs.c + SRC += $(ARM_ATSAM_DIR)/led_matrix.c +endif SRC += $(ARM_ATSAM_DIR)/main_arm_atsam.c SRC += $(ARM_ATSAM_DIR)/spi.c SRC += $(ARM_ATSAM_DIR)/startup.c diff --git a/tmk_core/protocol/arm_atsam/arm_atsam_protocol.h b/tmk_core/protocol/arm_atsam/arm_atsam_protocol.h index 928af8c7e170..88109186aad9 100644 --- a/tmk_core/protocol/arm_atsam/arm_atsam_protocol.h +++ b/tmk_core/protocol/arm_atsam/arm_atsam_protocol.h @@ -34,7 +34,10 @@ along with this program. If not, see . #ifndef MD_BOOTLOADER #include "main_arm_atsam.h" +#ifdef RGB_MATRIX_ENABLE #include "led_matrix.h" +#include "rgb_matrix.h" +#endif #include "issi3733_driver.h" #include "./usb/compiler.h" #include "./usb/udc.h" diff --git a/tmk_core/protocol/arm_atsam/i2c_master.c b/tmk_core/protocol/arm_atsam/i2c_master.c index d91a851f3776..1741d9ac5b02 100644 --- a/tmk_core/protocol/arm_atsam/i2c_master.c +++ b/tmk_core/protocol/arm_atsam/i2c_master.c @@ -17,7 +17,7 @@ along with this program. If not, see . #include "arm_atsam_protocol.h" -#ifndef MD_BOOTLOADER +#if !defined(MD_BOOTLOADER) && defined(RGB_MATRIX_ENABLE) #include @@ -37,7 +37,7 @@ static uint8_t dma_sendbuf[I2C_DMA_MAX_SEND]; //Data being written to I2C volatile uint8_t i2c_led_q_running; -#endif //MD_BOOTLOADER +#endif // !defined(MD_BOOTLOADER) && defined(RGB_MATRIX_ENABLE) void i2c0_init(void) { @@ -112,7 +112,7 @@ void i2c0_stop(void) } } -#ifndef MD_BOOTLOADER +#if !defined(MD_BOOTLOADER) && defined(RGB_MATRIX_ENABLE) void i2c1_init(void) { DBGC(DC_I2C1_INIT_BEGIN); @@ -583,4 +583,4 @@ uint8_t i2c_led_q_run(void) return 1; } -#endif //MD_BOOTLOADER +#endif // !defined(MD_BOOTLOADER) && defined(RGB_MATRIX_ENABLE) diff --git a/tmk_core/protocol/arm_atsam/led_matrix.c b/tmk_core/protocol/arm_atsam/led_matrix.c index 04d05af6db65..57f00bef1dd2 100644 --- a/tmk_core/protocol/arm_atsam/led_matrix.c +++ b/tmk_core/protocol/arm_atsam/led_matrix.c @@ -17,9 +17,16 @@ along with this program. If not, see . #include "arm_atsam_protocol.h" #include "tmk_core/common/led.h" +#include "rgb_matrix.h" #include #include +#ifdef USE_MASSDROP_CONFIGURATOR +__attribute__((weak)) +led_instruction_t led_instructions[] = { { .end = 1 } }; +static void led_matrix_massdrop_config_override(int i); +#endif // USE_MASSDROP_CONFIGURATOR + void SERCOM1_0_Handler( void ) { if (SERCOM1->I2CM.INTFLAG.bit.ERROR) @@ -51,12 +58,10 @@ void DMAC_0_Handler( void ) issi3733_driver_t issidrv[ISSI3733_DRIVER_COUNT]; -issi3733_led_t led_map[ISSI3733_LED_COUNT+1] = ISSI3733_LED_MAP; -issi3733_led_t *lede = led_map + ISSI3733_LED_COUNT; //End pointer of mapping +issi3733_led_t led_map[ISSI3733_LED_COUNT] = ISSI3733_LED_MAP; +RGB led_buffer[ISSI3733_LED_COUNT]; uint8_t gcr_desired; -uint8_t gcr_breathe; -uint8_t gcr_use; uint8_t gcr_actual; uint8_t gcr_actual_last; @@ -74,11 +79,6 @@ void gcr_compute(void) { uint8_t action = ACT_GCR_NONE; - if (led_animation_breathing) - gcr_use = gcr_breathe; - else - gcr_use = gcr_desired; - //If the 5v takes a catastrophic hit, disable the LED drivers briefly, assert auto gcr mode, min gcr and let the auto take over if (v_5v < V5_CAT) { @@ -105,13 +105,13 @@ void gcr_compute(void) if (usb_gcr_auto) { if (v_5v_avg < V5_LOW) action = ACT_GCR_DEC; - else if (v_5v_avg > V5_HIGH && gcr_actual < gcr_use) action = ACT_GCR_INC; - else if (gcr_actual > gcr_use) action = ACT_GCR_DEC; + else if (v_5v_avg > V5_HIGH && gcr_actual < gcr_desired) action = ACT_GCR_INC; + else if (gcr_actual > gcr_desired) action = ACT_GCR_DEC; } else { - if (gcr_actual < gcr_use) action = ACT_GCR_INC; - else if (gcr_actual > gcr_use) action = ACT_GCR_DEC; + if (gcr_actual < gcr_desired) action = ACT_GCR_INC; + else if (gcr_actual > gcr_desired) action = ACT_GCR_DEC; } if (action == ACT_GCR_NONE) @@ -150,22 +150,10 @@ void gcr_compute(void) //Power successfully cut back from LED drivers gcr_actual -= LED_GCR_STEP_AUTO; gcr_min_counter = 0; - - //If breathe mode is active, the top end can fluctuate if the host can not supply enough current - //So set the breathe GCR to where it becomes stable - if (led_animation_breathing == 1) - { - gcr_breathe = gcr_actual; - //PS: At this point, setting breathing to exhale makes a noticebly shorter cycle - // and the same would happen maybe one or two more times. Therefore I'm favoring - // powering through one full breathe and letting gcr settle completely - } } } } -led_disp_t disp; - void issi3733_prepare_arrays(void) { memset(issidrv,0,sizeof(issi3733_driver_t) * ISSI3733_DRIVER_COUNT); @@ -178,361 +166,278 @@ void issi3733_prepare_arrays(void) issidrv[i].addr = addrs[i]; } - issi3733_led_t *cur = led_map; - - while (cur < lede) + for (uint8_t i = 0; i < ISSI3733_LED_COUNT; i++) { //BYTE: 1 + (SW-1)*16 + (CS-1) - cur->rgb.g = issidrv[cur->adr.drv-1].pwm + 1 + ((cur->adr.swg-1)*16 + (cur->adr.cs-1)); - cur->rgb.r = issidrv[cur->adr.drv-1].pwm + 1 + ((cur->adr.swr-1)*16 + (cur->adr.cs-1)); - cur->rgb.b = issidrv[cur->adr.drv-1].pwm + 1 + ((cur->adr.swb-1)*16 + (cur->adr.cs-1)); + led_map[i].rgb.g = issidrv[led_map[i].adr.drv-1].pwm + 1 + ((led_map[i].adr.swg-1)*16 + (led_map[i].adr.cs-1)); + led_map[i].rgb.r = issidrv[led_map[i].adr.drv-1].pwm + 1 + ((led_map[i].adr.swr-1)*16 + (led_map[i].adr.cs-1)); + led_map[i].rgb.b = issidrv[led_map[i].adr.drv-1].pwm + 1 + ((led_map[i].adr.swb-1)*16 + (led_map[i].adr.cs-1)); //BYTE: 1 + (SW-1)*2 + (CS-1)/8 //BIT: (CS-1)%8 - *(issidrv[cur->adr.drv-1].onoff + 1 + (cur->adr.swg-1)*2+(cur->adr.cs-1)/8) |= (1<<((cur->adr.cs-1)%8)); - *(issidrv[cur->adr.drv-1].onoff + 1 + (cur->adr.swr-1)*2+(cur->adr.cs-1)/8) |= (1<<((cur->adr.cs-1)%8)); - *(issidrv[cur->adr.drv-1].onoff + 1 + (cur->adr.swb-1)*2+(cur->adr.cs-1)/8) |= (1<<((cur->adr.cs-1)%8)); - - cur++; + *(issidrv[led_map[i].adr.drv-1].onoff + 1 + (led_map[i].adr.swg-1)*2+(led_map[i].adr.cs-1)/8) |= (1<<((led_map[i].adr.cs-1)%8)); + *(issidrv[led_map[i].adr.drv-1].onoff + 1 + (led_map[i].adr.swr-1)*2+(led_map[i].adr.cs-1)/8) |= (1<<((led_map[i].adr.cs-1)%8)); + *(issidrv[led_map[i].adr.drv-1].onoff + 1 + (led_map[i].adr.swb-1)*2+(led_map[i].adr.cs-1)/8) |= (1<<((led_map[i].adr.cs-1)%8)); } } -void disp_calc_extents(void) +void led_matrix_prepare(void) { - issi3733_led_t *cur = led_map; - - disp.left = 1e10; - disp.right = -1e10; - disp.top = -1e10; - disp.bottom = 1e10; - - while (cur < lede) + for (uint8_t i = 0; i < ISSI3733_LED_COUNT; i++) { - if (cur->x < disp.left) disp.left = cur->x; - if (cur->x > disp.right) disp.right = cur->x; - if (cur->y < disp.bottom) disp.bottom = cur->y; - if (cur->y > disp.top) disp.top = cur->y; - - cur++; + *led_map[i].rgb.r = 0; + *led_map[i].rgb.g = 0; + *led_map[i].rgb.b = 0; } - - disp.width = disp.right - disp.left; - disp.height = disp.top - disp.bottom; - disp.max_distance = sqrtf(powf(disp.width, 2) + powf(disp.height, 2)); } -void disp_pixel_setup(void) +void led_set_one(int i, uint8_t r, uint8_t g, uint8_t b) { - issi3733_led_t *cur = led_map; - - while (cur < lede) + if (i < ISSI3733_LED_COUNT) { - cur->px = (cur->x - disp.left) / disp.width * 100; - cur->py = (cur->y - disp.bottom) / disp.height * 100; - *cur->rgb.r = 0; - *cur->rgb.g = 0; - *cur->rgb.b = 0; - - cur++; + led_buffer[i].r = r; + led_buffer[i].g = g; + led_buffer[i].b = b; +#ifdef USE_MASSDROP_CONFIGURATOR + led_matrix_massdrop_config_override(i); +#endif // USE_MASSDROP_CONFIGURATOR } } -void led_matrix_prepare(void) +void led_set_all(uint8_t r, uint8_t g, uint8_t b) { - disp_calc_extents(); - disp_pixel_setup(); + for (uint8_t i = 0; i < ISSI3733_LED_COUNT; i++) + { + led_set_one(i, r, g, b); + } } -uint8_t led_enabled; -float led_animation_speed; -uint8_t led_animation_direction; -uint8_t led_animation_orientation; -uint8_t led_animation_breathing; -uint8_t led_animation_breathe_cur; -uint8_t breathe_step; -uint8_t breathe_dir; -uint8_t led_animation_circular; -uint64_t led_next_run; - -uint8_t led_animation_id; -uint8_t led_lighting_mode; - -issi3733_led_t *led_cur; -uint8_t led_per_run = 15; -float breathe_mult; - -__attribute__ ((weak)) -void led_matrix_run(void) +void init(void) { - float ro; - float go; - float bo; - float po; - - uint8_t led_this_run = 0; - led_setup_t *f = (led_setup_t*)led_setups[led_animation_id]; + DBGC(DC_LED_MATRIX_INIT_BEGIN); - if (led_cur == 0) //Denotes start of new processing cycle in the case of chunked processing - { - led_cur = led_map; + issi3733_prepare_arrays(); - disp.frame += 1; + led_matrix_prepare(); - breathe_mult = 1; + gcr_min_counter = 0; + v_5v_cat_hit = 0; - if (led_animation_breathing) - { - led_animation_breathe_cur += breathe_step * breathe_dir; + DBGC(DC_LED_MATRIX_INIT_COMPLETE); +} - if (led_animation_breathe_cur >= BREATHE_MAX_STEP) - breathe_dir = -1; - else if (led_animation_breathe_cur <= BREATHE_MIN_STEP) - breathe_dir = 1; +void flush(void) +{ + // Wait for previous transfer to complete + while (i2c_led_q_running) + { + CLK_delay_ms(20); + } - //Brightness curve created for 256 steps, 0 - ~98% - breathe_mult = 0.000015 * led_animation_breathe_cur * led_animation_breathe_cur; - if (breathe_mult > 1) breathe_mult = 1; - else if (breathe_mult < 0) breathe_mult = 0; - } + // Copy buffer to live DMA region + for (uint8_t i = 0; i < ISSI3733_LED_COUNT; i++) + { + *led_map[i].rgb.r = led_buffer[i].r; + *led_map[i].rgb.g = led_buffer[i].g; + *led_map[i].rgb.b = led_buffer[i].b; } - uint8_t fcur = 0; - uint8_t fmax = 0; + uint8_t drvid; - //Frames setup - while (f[fcur].end != 1) + //NOTE: GCR does not need to be timed with LED processing, but there is really no harm + if (gcr_actual != gcr_actual_last) { - fcur++; //Count frames + for (drvid=0;drvidscan == 255) - { - //Do not act on this LED - } - else if (led_lighting_mode == LED_MODE_NON_KEYS_ONLY && led_cur->scan != 255) - { - //Do not act on this LED - } - else if (led_lighting_mode == LED_MODE_INDICATORS_ONLY) - { - //Do not act on this LED (Only show indicators) - } - else +void led_matrix_indicators(void) +{ + uint8_t kbled = keyboard_leds(); + if (kbled && rgb_matrix_config.enable) + { + for (uint8_t i = 0; i < ISSI3733_LED_COUNT; i++) { - //Act on LED - for (fcur = 0; fcur < fmax; fcur++) + if ( + #if USB_LED_NUM_LOCK_SCANCODE != 255 + (led_map[i].scan == USB_LED_NUM_LOCK_SCANCODE && (kbled & (1<x - disp.left)), 2) + powf(fabsf((disp.height / 2) - (led_cur->y - disp.bottom)), 2))) / disp.max_distance * 100; - } - else { - if (led_animation_orientation) - { - po = led_cur->py; - } - else - { - po = led_cur->px; - } - } +const rgb_matrix_driver_t rgb_matrix_driver = { + .init = init, + .flush = flush, + .set_color = led_set_one, + .set_color_all = led_set_all +}; - float pomod; - pomod = (float)(disp.frame % (uint32_t)(1000.0f / led_animation_speed)) / 10.0f * led_animation_speed; +/*============================================================================== += Legacy Lighting Support = +==============================================================================*/ - //Add in any moving effects - if ((!led_animation_direction && f[fcur].ef & EF_SCR_R) || (led_animation_direction && (f[fcur].ef & EF_SCR_L))) - { - pomod *= 100.0f; - pomod = (uint32_t)pomod % 10000; - pomod /= 100.0f; +#ifdef USE_MASSDROP_CONFIGURATOR +// Ported from Massdrop QMK Github Repo - po -= pomod; +// TODO?: wire these up to keymap.c +bool led_animation_direction = false; +bool led_animation_orientation = false; - if (po > 100) po -= 100; - else if (po < 0) po += 100; - } - else if ((!led_animation_direction && f[fcur].ef & EF_SCR_L) || (led_animation_direction && (f[fcur].ef & EF_SCR_R))) - { - pomod *= 100.0f; - pomod = (uint32_t)pomod % 10000; - pomod /= 100.0f; - po += pomod; +static void led_run_pattern(led_setup_t *f, float* ro, float* go, float* bo, float pos) { + float pomod; + pomod = (float)(g_tick % (uint32_t)(1000.0f / (1 << rgb_matrix_config.speed))) / 10.0f * (1 << rgb_matrix_config.speed); + pomod *= 100.0f; + pomod = (uint32_t)pomod % 10000; + pomod /= 100.0f; - if (po > 100) po -= 100; - else if (po < 0) po += 100; - } + float po; - //Check if LED's po is in current frame - if (po < f[fcur].hs) continue; - if (po > f[fcur].he) continue; - //note: < 0 or > 100 continue + while (f->end != 1) + { + po = pos; //Reset po for new frame - //Calculate the po within the start-stop percentage for color blending - po = (po - f[fcur].hs) / (f[fcur].he - f[fcur].hs); + //Add in any moving effects + if ((!led_animation_direction && f->ef & EF_SCR_R) || (led_animation_direction && (f->ef & EF_SCR_L))) + { + po -= pomod; - //Add in any color effects - if (f[fcur].ef & EF_OVER) - { - ro = (po * (f[fcur].re - f[fcur].rs)) + f[fcur].rs;// + 0.5; - go = (po * (f[fcur].ge - f[fcur].gs)) + f[fcur].gs;// + 0.5; - bo = (po * (f[fcur].be - f[fcur].bs)) + f[fcur].bs;// + 0.5; - } - else if (f[fcur].ef & EF_SUBTRACT) - { - ro -= (po * (f[fcur].re - f[fcur].rs)) + f[fcur].rs;// + 0.5; - go -= (po * (f[fcur].ge - f[fcur].gs)) + f[fcur].gs;// + 0.5; - bo -= (po * (f[fcur].be - f[fcur].bs)) + f[fcur].bs;// + 0.5; - } - else - { - ro += (po * (f[fcur].re - f[fcur].rs)) + f[fcur].rs;// + 0.5; - go += (po * (f[fcur].ge - f[fcur].gs)) + f[fcur].gs;// + 0.5; - bo += (po * (f[fcur].be - f[fcur].bs)) + f[fcur].bs;// + 0.5; - } - } + if (po > 100) po -= 100; + else if (po < 0) po += 100; } - - //Clamp values 0-255 - if (ro > 255) ro = 255; else if (ro < 0) ro = 0; - if (go > 255) go = 255; else if (go < 0) go = 0; - if (bo > 255) bo = 255; else if (bo < 0) bo = 0; - - if (led_animation_breathing) + else if ((!led_animation_direction && f->ef & EF_SCR_L) || (led_animation_direction && (f->ef & EF_SCR_R))) { - ro *= breathe_mult; - go *= breathe_mult; - bo *= breathe_mult; + po += pomod; + + if (po > 100) po -= 100; + else if (po < 0) po += 100; } - *led_cur->rgb.r = (uint8_t)ro; - *led_cur->rgb.g = (uint8_t)go; - *led_cur->rgb.b = (uint8_t)bo; + //Check if LED's po is in current frame + if (po < f->hs) { f++; continue; } + if (po > f->he) { f++; continue; } + //note: < 0 or > 100 continue -#ifdef USB_LED_INDICATOR_ENABLE - if (keyboard_leds()) + //Calculate the po within the start-stop percentage for color blending + po = (po - f->hs) / (f->he - f->hs); + + //Add in any color effects + if (f->ef & EF_OVER) { - uint8_t kbled = keyboard_leds(); - if ( - #if USB_LED_NUM_LOCK_SCANCODE != 255 - (led_cur->scan == USB_LED_NUM_LOCK_SCANCODE && kbled & (1<scan == USB_LED_CAPS_LOCK_SCANCODE && kbled & (1<scan == USB_LED_SCROLL_LOCK_SCANCODE && kbled & (1<scan == USB_LED_COMPOSE_SCANCODE && kbled & (1<scan == USB_LED_KANA_SCANCODE && kbled & (1<rgb.r > 127) *led_cur->rgb.r = 0; - else *led_cur->rgb.r = 255; - if (*led_cur->rgb.g > 127) *led_cur->rgb.g = 0; - else *led_cur->rgb.g = 255; - if (*led_cur->rgb.b > 127) *led_cur->rgb.b = 0; - else *led_cur->rgb.b = 255; - } + *ro = (po * (f->re - f->rs)) + f->rs;// + 0.5; + *go = (po * (f->ge - f->gs)) + f->gs;// + 0.5; + *bo = (po * (f->be - f->bs)) + f->bs;// + 0.5; + } + else if (f->ef & EF_SUBTRACT) + { + *ro -= (po * (f->re - f->rs)) + f->rs;// + 0.5; + *go -= (po * (f->ge - f->gs)) + f->gs;// + 0.5; + *bo -= (po * (f->be - f->bs)) + f->bs;// + 0.5; + } + else + { + *ro += (po * (f->re - f->rs)) + f->rs;// + 0.5; + *go += (po * (f->ge - f->gs)) + f->gs;// + 0.5; + *bo += (po * (f->be - f->bs)) + f->bs;// + 0.5; } -#endif //USB_LED_INDICATOR_ENABLE - led_cur++; - led_this_run++; + f++; } } -uint8_t led_matrix_init(void) +static void led_matrix_massdrop_config_override(int i) { - DBGC(DC_LED_MATRIX_INIT_BEGIN); - - issi3733_prepare_arrays(); - - led_matrix_prepare(); - - disp.frame = 0; - led_next_run = 0; - - led_enabled = 1; - led_animation_id = 0; - led_lighting_mode = LED_MODE_NORMAL; - led_animation_speed = 4.0f; - led_animation_direction = 0; - led_animation_orientation = 0; - led_animation_breathing = 0; - led_animation_breathe_cur = BREATHE_MIN_STEP; - breathe_step = 1; - breathe_dir = 1; - led_animation_circular = 0; - - gcr_min_counter = 0; - v_5v_cat_hit = 0; - - //Run led matrix code once for initial LED coloring - led_cur = 0; - rgb_matrix_init_user(); - led_matrix_run(); - - DBGC(DC_LED_MATRIX_INIT_COMPLETE); +#ifdef RGB_MATRIX_EXTRA_TOG + const bool is_key = g_rgb_leds[i].matrix_co.raw != 0xff; + if ((rgb_matrix_config.enable == RGB_ZONE_KEYS && !is_key) || + (rgb_matrix_config.enable == RGB_ZONE_UNDER && is_key)) + { + return; + } +#endif - return 0; -} + bool do_override = false; -__attribute__ ((weak)) -void rgb_matrix_init_user(void) { + float ro = 0; + float go = 0; + float bo = 0; -} + float po = (led_animation_orientation) + ? (float)g_rgb_leds[i].point.y / 64.f * 100 + : (float)g_rgb_leds[i].point.x / 224.f * 100; -#define LED_UPDATE_RATE 10 //ms + const uint8_t highest_active_layer = biton32(layer_state); -//led data processing can take time, so process data in chunks to free up the processor -//this is done through led_cur and lede -void led_matrix_task(void) -{ - if (led_enabled) - { - //If an update may run and frame processing has completed - if (timer_read64() >= led_next_run && led_cur == lede) + const led_instruction_t* led_cur_instruction = led_instructions; + while (!led_cur_instruction->end) { + // Check if this applies to current layer + if ((led_cur_instruction->flags & LED_FLAG_MATCH_LAYER) && + (led_cur_instruction->layer != highest_active_layer)) { - uint8_t drvid; + goto next_iter; + } - led_next_run = timer_read64() + LED_UPDATE_RATE; //Set next frame update time + // Check if this applies to current index + if (led_cur_instruction->flags & LED_FLAG_MATCH_ID) { + const uint8_t modid = i / 32; //PS: Calculate which id# contains the led bit + const uint32_t modidbit = 1 << (i % 32); //PS: Calculate the bit within the id# + const uint32_t* bitfield = &led_cur_instruction->id0 + modid; //PS: Add modid as offset to id0 address. *bitfield is now idX of the led id + if (~(*bitfield) & modidbit) //PS: Check if led bit is not set in idX + goto next_iter; + } - //NOTE: GCR does not need to be timed with LED processing, but there is really no harm - if (gcr_actual != gcr_actual_last) - { - for (drvid=0;drvidflags & LED_FLAG_USE_RGB) { + ro = led_cur_instruction->r; + go = led_cur_instruction->g; + bo = led_cur_instruction->b; + do_override = true; + } else if (led_cur_instruction->flags & LED_FLAG_USE_PATTERN) { + led_run_pattern(led_setups[led_cur_instruction->pattern_id], &ro, &go, &bo, po); + do_override = true; + } else if (led_cur_instruction->flags & LED_FLAG_USE_ROTATE_PATTERN) { + // no override + do_override = false; + } - for (drvid=0;drvid 255) ro = 255; else if (ro < 0) ro = 0; + if (go > 255) go = 255; else if (go < 0) go = 0; + if (bo > 255) bo = 255; else if (bo < 0) bo = 0; - //Process more data if not finished - if (led_cur != lede) - { - //DBG_1_OFF; //debug profiling - led_matrix_run(); - //DBG_1_ON; //debug profiling - } + led_buffer[i].r = (uint8_t)ro; + led_buffer[i].g = (uint8_t)go; + led_buffer[i].b = (uint8_t)bo; } +#endif // USE_MASSDROP_CONFIGURATOR diff --git a/tmk_core/protocol/arm_atsam/led_matrix.h b/tmk_core/protocol/arm_atsam/led_matrix.h index 4513234e7f37..c8798305de3f 100644 --- a/tmk_core/protocol/arm_atsam/led_matrix.h +++ b/tmk_core/protocol/arm_atsam/led_matrix.h @@ -18,6 +18,8 @@ along with this program. If not, see . #ifndef _LED_MATRIX_H_ #define _LED_MATRIX_H_ +#include "quantum.h" + //From keyboard #include "config_led.h" @@ -75,25 +77,20 @@ typedef struct issi3733_led_s { uint8_t scan; //Key scan code from wiring (set 0xFF if no key) } issi3733_led_t; -typedef struct led_disp_s { - uint64_t frame; - float left; - float right; - float top; - float bottom; - float width; - float height; - float max_distance; -} led_disp_t; - -uint8_t led_matrix_init(void); -void rgb_matrix_init_user(void); - -#define LED_MODE_NORMAL 0 //Must be 0 -#define LED_MODE_KEYS_ONLY 1 -#define LED_MODE_NON_KEYS_ONLY 2 -#define LED_MODE_INDICATORS_ONLY 3 -#define LED_MODE_MAX_INDEX LED_MODE_INDICATORS_ONLY //Must be highest value +extern issi3733_driver_t issidrv[ISSI3733_DRIVER_COUNT]; + +extern uint8_t gcr_desired; +extern uint8_t gcr_breathe; +extern uint8_t gcr_actual; +extern uint8_t gcr_actual_last; + +void gcr_compute(void); + +void led_matrix_indicators(void); + +/*------------------------- Legacy Lighting Support ------------------------*/ + +#ifdef USE_MASSDROP_CONFIGURATOR #define EF_NONE 0x00000000 //No effect #define EF_OVER 0x00000001 //Overwrite any previous color information with new @@ -114,33 +111,33 @@ typedef struct led_setup_s { uint8_t end; //Set to signal end of the setup } led_setup_t; -extern issi3733_driver_t issidrv[ISSI3733_DRIVER_COUNT]; - -extern uint8_t gcr_desired; -extern uint8_t gcr_breathe; -extern uint8_t gcr_actual; -extern uint8_t gcr_actual_last; - -extern uint8_t led_animation_id; -extern uint8_t led_enabled; -extern float led_animation_speed; -extern uint8_t led_lighting_mode; -extern uint8_t led_animation_direction; -extern uint8_t led_animation_orientation; -extern uint8_t led_animation_breathing; -extern uint8_t led_animation_breathe_cur; -extern uint8_t breathe_dir; -extern uint8_t led_animation_circular; extern const uint8_t led_setups_count; - extern void *led_setups[]; -extern issi3733_led_t *led_cur; -extern issi3733_led_t *lede; - -void led_matrix_run(void); -void led_matrix_task(void); - -void gcr_compute(void); +//LED Extra Instructions +#define LED_FLAG_NULL 0x00 +#define LED_FLAG_MATCH_ID 0x01 +#define LED_FLAG_MATCH_LAYER 0x02 +#define LED_FLAG_USE_RGB 0x10 +#define LED_FLAG_USE_PATTERN 0x20 +#define LED_FLAG_USE_ROTATE_PATTERN 0x40 + +typedef struct led_instruction_s { + uint16_t flags; // Bitfield for LED instructions + uint32_t id0; // Bitwise id, IDs 0-31 + uint32_t id1; // Bitwise id, IDs 32-63 + uint32_t id2; // Bitwise id, IDs 64-95 + uint32_t id3; // Bitwise id, IDs 96-127 + uint8_t layer; + uint8_t r; + uint8_t g; + uint8_t b; + uint8_t pattern_id; + uint8_t end; +} led_instruction_t; + +extern led_instruction_t led_instructions[]; + +#endif // USE_MASSDROP_CONFIGURATOR #endif //_LED_MATRIX_H_ diff --git a/keyboards/massdrop/alt/led_programs.c b/tmk_core/protocol/arm_atsam/led_matrix_programs.c similarity index 99% rename from keyboards/massdrop/alt/led_programs.c rename to tmk_core/protocol/arm_atsam/led_matrix_programs.c index b3b7a7e90e76..cf7478dc312e 100644 --- a/keyboards/massdrop/alt/led_programs.c +++ b/tmk_core/protocol/arm_atsam/led_matrix_programs.c @@ -15,7 +15,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "alt.h" +#ifdef USE_MASSDROP_CONFIGURATOR + #include "led_matrix.h" //Teal <-> Salmon @@ -118,3 +119,5 @@ void *led_setups[] = { }; const uint8_t led_setups_count = sizeof(led_setups) / sizeof(led_setups[0]); + +#endif diff --git a/tmk_core/protocol/arm_atsam/main_arm_atsam.c b/tmk_core/protocol/arm_atsam/main_arm_atsam.c index eaad66e9fc8e..0974a230d4c1 100644 --- a/tmk_core/protocol/arm_atsam/main_arm_atsam.c +++ b/tmk_core/protocol/arm_atsam/main_arm_atsam.c @@ -203,13 +203,6 @@ void main_subtask_usb_state(void) } } -void main_subtask_led(void) -{ - if (g_usb_state != USB_FSMSTATUS_FSMSTATE_ON_Val) return; //Only run LED tasks if USB is operating - - led_matrix_task(); -} - void main_subtask_power_check(void) { static uint64_t next_5v_checkup = 0; @@ -221,7 +214,9 @@ void main_subtask_power_check(void) v_5v = adc_get(ADC_5V); v_5v_avg = 0.9 * v_5v_avg + 0.1 * v_5v; +#ifdef RGB_MATRIX_ENABLE gcr_compute(); +#endif } } @@ -240,7 +235,6 @@ void main_subtask_usb_extra_device(void) void main_subtasks(void) { main_subtask_usb_state(); - main_subtask_led(); main_subtask_power_check(); main_subtask_usb_extra_device(); } @@ -263,7 +257,9 @@ int main(void) SR_EXP_Init(); +#ifdef RGB_MATRIX_ENABLE i2c1_init(); +#endif // RGB_MATRIX_ENABLE matrix_init(); @@ -281,8 +277,7 @@ int main(void) DBG_LED_OFF; - led_matrix_init(); - +#ifdef RGB_MATRIX_ENABLE while (I2C3733_Init_Control() != 1) {} while (I2C3733_Init_Drivers() != 1) {} @@ -292,6 +287,7 @@ int main(void) for (uint8_t drvid = 0; drvid < ISSI3733_DRIVER_COUNT; drvid++) I2C_LED_Q_ONOFF(drvid); //Queue data +#endif // RGB_MATRIX_ENABLE keyboard_setup(); diff --git a/tmk_core/protocol/arm_atsam/usb/usb2422.c b/tmk_core/protocol/arm_atsam/usb/usb2422.c index d6e192242910..9831d7fad9e7 100644 --- a/tmk_core/protocol/arm_atsam/usb/usb2422.c +++ b/tmk_core/protocol/arm_atsam/usb/usb2422.c @@ -366,7 +366,6 @@ void USB_ExtraSetState(uint8_t state) else if (usb_extra_state == USB_EXTRA_STATE_DISABLED) { CDC_print("USB: Extra disabled\r\n"); - if (led_animation_breathing) gcr_breathe = gcr_desired; } else if (usb_extra_state == USB_EXTRA_STATE_DISABLED_UNTIL_REPLUG) CDC_print("USB: Extra disabled until replug\r\n"); else CDC_print("USB: Extra state unknown\r\n"); From 22e568c022d16cbf6bf4dc211b06bf659097d5fb Mon Sep 17 00:00:00 2001 From: patrickmt <40182064+patrickmt@users.noreply.github.com> Date: Fri, 1 Mar 2019 15:17:30 -0500 Subject: [PATCH 2/5] Massdrop lighting support working This commit is to get the Massdrop lighting code working again through use of the compilation define USE_MASSDROP_CONFIGURATOR added to a keymap's rules.mk. Added keymaps for both CTRL and ALT named default_md and mac_md. These should be used if the Massdrop style lighting is desired. --- keyboards/massdrop/alt/config_led.h | 9 +- .../massdrop/alt/keymaps/default_md/keymap.c | 223 +++++++++++++++++ .../massdrop/alt/keymaps/default_md/rules.mk | 2 + .../massdrop/alt/keymaps/mac_md/keymap.c | 193 +++++++++++++++ .../massdrop/alt/keymaps/mac_md/rules.mk | 2 + .../massdrop/alt/keymaps/reywood/rules.mk | 5 +- keyboards/massdrop/ctrl/config_led.h | 8 + .../massdrop/ctrl/keymaps/default_md/keymap.c | 226 ++++++++++++++++++ .../massdrop/ctrl/keymaps/default_md/rules.mk | 2 + .../massdrop/ctrl/keymaps/mac_md/keymap.c | 196 +++++++++++++++ .../massdrop/ctrl/keymaps/mac_md/rules.mk | 2 + .../ctrl/keymaps/responsive_pattern/keymap.c | 5 +- .../ctrl/keymaps/responsive_pattern/rules.mk | 2 + quantum/rgb_matrix.h | 1 + tmk_core/protocol/arm_atsam/led_matrix.c | 189 +++++++++------ tmk_core/protocol/arm_atsam/led_matrix.h | 27 ++- 16 files changed, 1012 insertions(+), 80 deletions(-) create mode 100644 keyboards/massdrop/alt/keymaps/default_md/keymap.c create mode 100644 keyboards/massdrop/alt/keymaps/default_md/rules.mk create mode 100644 keyboards/massdrop/alt/keymaps/mac_md/keymap.c create mode 100644 keyboards/massdrop/alt/keymaps/mac_md/rules.mk create mode 100644 keyboards/massdrop/ctrl/keymaps/default_md/keymap.c create mode 100644 keyboards/massdrop/ctrl/keymaps/default_md/rules.mk create mode 100644 keyboards/massdrop/ctrl/keymaps/mac_md/keymap.c create mode 100644 keyboards/massdrop/ctrl/keymaps/mac_md/rules.mk create mode 100644 keyboards/massdrop/ctrl/keymaps/responsive_pattern/rules.mk diff --git a/keyboards/massdrop/alt/config_led.h b/keyboards/massdrop/alt/config_led.h index 7b8b786801de..352924ee4967 100644 --- a/keyboards/massdrop/alt/config_led.h +++ b/keyboards/massdrop/alt/config_led.h @@ -33,6 +33,14 @@ along with this program. If not, see . #define LED_GCR_MAX 165 //Max GCR value (0 - 255) WARNING: Raising this value may overload the LED drivers and USB bus #define LED_GCR_STEP 10 //GCR increment/decrement value +#ifdef USE_MASSDROP_CONFIGURATOR +#define ANIMATION_SPEED_STEP 1 + +#define BREATHE_STEP 1 +#define BREATHE_MIN_STEP 0 +#define BREATHE_MAX_STEP 255 +#endif + //Default Global Current Register value (Default brightness 0 - 255) #define ISSI3733_GCR_DEFAULT LED_GCR_MAX @@ -170,7 +178,6 @@ along with this program. If not, see . #define USB_LED_KANA_SCANCODE 255 #endif //USB_LED_INDICATOR_ENABLE -#define RGB_MATRIX_KEYPRESSES #define RGB_MATRIX_SKIP_FRAMES 1 #define RGB_MATRIX_EXTRA_TOG diff --git a/keyboards/massdrop/alt/keymaps/default_md/keymap.c b/keyboards/massdrop/alt/keymaps/default_md/keymap.c new file mode 100644 index 000000000000..7969583df4b0 --- /dev/null +++ b/keyboards/massdrop/alt/keymaps/default_md/keymap.c @@ -0,0 +1,223 @@ +#include QMK_KEYBOARD_H + +enum alt_keycodes { + L_BRI = SAFE_RANGE, //LED Brightness Increase //Working + L_BRD, //LED Brightness Decrease //Working + L_PTN, //LED Pattern Select Next //Working + L_PTP, //LED Pattern Select Previous //Working + L_PSI, //LED Pattern Speed Increase //Working + L_PSD, //LED Pattern Speed Decrease //Working + L_T_MD, //LED Toggle Mode //Working + L_T_ONF, //LED Toggle On / Off //Broken + L_ON, //LED On //Broken + L_OFF, //LED Off //Broken + L_T_BR, //LED Toggle Breath Effect //Working + L_T_PTD, //LED Toggle Scrolling Pattern Direction //Working + U_T_AGCR, //USB Toggle Automatic GCR control //Working + DBG_TOG, //DEBUG Toggle On / Off // + DBG_MTRX, //DEBUG Toggle Matrix Prints // + DBG_KBD, //DEBUG Toggle Keyboard Prints // + DBG_MOU, //DEBUG Toggle Mouse Prints // + MD_BOOT //Restart into bootloader after hold timeout //Working +}; + +#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode + +keymap_config_t keymap_config; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_HOME, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT \ + ), + [1] = LAYOUT( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MUTE, \ + L_T_BR, L_PSD, L_BRI, L_PSI, _______, _______, _______, _______, U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \ + L_T_PTD, L_PTP, L_BRD, L_PTN, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, \ + _______, L_T_MD, L_T_ONF, _______, _______, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, KC_PGUP, KC_VOLD, \ + _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END \ + ), + /* + [X] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ), + */ +}; + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { +}; + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void) { +}; + +#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT)) +#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL)) +#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT)) + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + static uint32_t key_timer; + + switch (keycode) { + case L_BRI: + if (record->event.pressed) { + if (LED_GCR_STEP > LED_GCR_MAX - gcr_desired) gcr_desired = LED_GCR_MAX; + else gcr_desired += LED_GCR_STEP; + if (led_animation_breathing) gcr_breathe = gcr_desired; + } + return false; + case L_BRD: + if (record->event.pressed) { + if (LED_GCR_STEP > gcr_desired) gcr_desired = 0; + else gcr_desired -= LED_GCR_STEP; + if (led_animation_breathing) gcr_breathe = gcr_desired; + } + return false; + case L_PTN: + if (record->event.pressed) { + if (led_animation_id == led_setups_count - 1) led_animation_id = 0; + else led_animation_id++; + } + return false; + case L_PTP: + if (record->event.pressed) { + if (led_animation_id == 0) led_animation_id = led_setups_count - 1; + else led_animation_id--; + } + return false; + case L_PSI: + if (record->event.pressed) { + led_animation_speed += ANIMATION_SPEED_STEP; + } + return false; + case L_PSD: + if (record->event.pressed) { + led_animation_speed -= ANIMATION_SPEED_STEP; + if (led_animation_speed < 0) led_animation_speed = 0; + } + return false; + case L_T_MD: + if (record->event.pressed) { + led_lighting_mode++; + if (led_lighting_mode > LED_MODE_MAX_INDEX) led_lighting_mode = LED_MODE_NORMAL; + } + return false; + case L_T_ONF: + if (record->event.pressed) { + led_enabled = !led_enabled; + I2C3733_Control_Set(led_enabled); + } + return false; + case L_ON: + if (record->event.pressed) { + led_enabled = 1; + I2C3733_Control_Set(led_enabled); + } + return false; + case L_OFF: + if (record->event.pressed) { + led_enabled = 0; + I2C3733_Control_Set(led_enabled); + } + return false; + case L_T_BR: + if (record->event.pressed) { + led_animation_breathing = !led_animation_breathing; + if (led_animation_breathing) { + gcr_breathe = gcr_desired; + led_animation_breathe_cur = BREATHE_MIN_STEP; + breathe_dir = 1; + } + } + return false; + case L_T_PTD: + if (record->event.pressed) { + led_animation_direction = !led_animation_direction; + } + return false; + case U_T_AGCR: + if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { + TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode"); + } + return false; + case DBG_TOG: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode"); + } + return false; + case DBG_MTRX: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix"); + } + return false; + case DBG_KBD: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard"); + } + return false; + case DBG_MOU: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse"); + } + return false; + case MD_BOOT: + if (record->event.pressed) { + key_timer = timer_read32(); + } else { + if (timer_elapsed32(key_timer) >= 500) { + reset_keyboard(); + } + } + return false; + default: + return true; //Process all other keycodes normally + } +} + +led_instruction_t led_instructions[] = { + //LEDs are normally inactive, no processing is performed on them + //Flags are used in matching criteria for an LED to be active and indicate how to color it + //Flags can be found in tmk_core/protocol/arm_atsam/led_matrix.h (prefixed with LED_FLAG_) + //LED IDs can be found in config_led.h in the keyboard's directory + //Examples are below + + //All LEDs use the user's selected pattern (this is the factory default) + { .flags = LED_FLAG_USE_ROTATE_PATTERN }, + + //Specific LEDs use the user's selected pattern while all others are off + // { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_ROTATE_PATTERN, .id0 = 0xFFFFFFFF, .id1 = 0xAAAAAAAA, .id2 = 0x55555555, .id3 = 0x11111111 }, + + //Specific LEDs use specified RGB values while all others are off + // { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0xFF, .id1 = 0x00FF, .id2 = 0x0000FF00, .id3 = 0xFF000000, .r = 75, .g = 150, .b = 225 }, + + //All LEDs use the user's selected pattern + //On layer 1, all key LEDs (except the top row which keeps active pattern) are red while all edge LEDs are green + //When layer 1 is active, key LEDs use red (id0 32 - 16: 1111 1111 1111 1111 1000 0000 0000 0000 = 0xFFFF8000) (except top row 15 - 1) + //When layer 1 is active, key LEDs use red (id1 64 - 33: 1111 1111 1111 1111 1111 1111 1111 1111 = 0xFFFFFFFF) + //When layer 1 is active, key LEDs use red (id2 67 - 65: 0000 0000 0000 0000 0000 0000 0000 0111 = 0x00000007) + //When layer 1 is active, edge LEDs use green (id2 95 - 68: 1111 1111 1111 1111 1111 1111 1111 1000 = 0xFFFFFFF8) + //When layer 1 is active, edge LEDs use green (id3 105 - 96: 0000 0000 0000 0000 0000 0011 1111 1111 = 0x000003FF) + // { .flags = LED_FLAG_USE_ROTATE_PATTERN }, + // { .flags = LED_FLAG_MATCH_ID | LED_FLAG_MATCH_LAYER | LED_FLAG_USE_RGB, .id0 = 0xFFFF8000, .id1 = 0xFFFFFFFF, .id2 = 0x00000007, .r = 255, .layer = 1 }, + // { .flags = LED_FLAG_MATCH_ID | LED_FLAG_MATCH_LAYER | LED_FLAG_USE_RGB, .id2 = 0xFFFFFFF8, .id3 = 0x000003FF, .g = 127, .layer = 1 }, + + //All key LEDs use red while edge LEDs use the active pattern + //All key LEDs use red (id0 32 - 1: 1111 1111 1111 1111 1111 1111 1111 1111 = 0xFFFFFFFF) + //All key LEDs use red (id1 64 - 33: 1111 1111 1111 1111 1111 1111 1111 1111 = 0xFFFFFFFF) + //All key LEDs use red (id2 67 - 65: 0000 0000 0000 0000 0000 0000 0000 0111 = 0x00000007) + //Edge uses active pattern (id2 95 - 68: 1111 1111 1111 1111 1111 1111 1111 1000 = 0xFFFFFFF8) + //Edge uses active pattern (id3 105 - 96: 0000 0000 0000 0000 0000 0011 1111 1111 = 0x000003FF) + // { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0xFFFFFFFF, .id1 = 0xFFFFFFFF, .id2 = 0x00000007, .r = 255 }, + // { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_ROTATE_PATTERN , .id2 = 0xFFFFFFF8, .id3 = 0x000003FF }, + + //end must be set to 1 to indicate end of instruction set + { .end = 1 } +}; diff --git a/keyboards/massdrop/alt/keymaps/default_md/rules.mk b/keyboards/massdrop/alt/keymaps/default_md/rules.mk new file mode 100644 index 000000000000..064a6f54c1fa --- /dev/null +++ b/keyboards/massdrop/alt/keymaps/default_md/rules.mk @@ -0,0 +1,2 @@ +# This keymap requires Massdrop Configurator support +OPT_DEFS += -DUSE_MASSDROP_CONFIGURATOR diff --git a/keyboards/massdrop/alt/keymaps/mac_md/keymap.c b/keyboards/massdrop/alt/keymaps/mac_md/keymap.c new file mode 100644 index 000000000000..8a052cc250ee --- /dev/null +++ b/keyboards/massdrop/alt/keymaps/mac_md/keymap.c @@ -0,0 +1,193 @@ +#include QMK_KEYBOARD_H + +enum alt_keycodes { + L_BRI = SAFE_RANGE, //LED Brightness Increase //Working + L_BRD, //LED Brightness Decrease //Working + L_PTN, //LED Pattern Select Next //Working + L_PTP, //LED Pattern Select Previous //Working + L_PSI, //LED Pattern Speed Increase //Working + L_PSD, //LED Pattern Speed Decrease //Working + L_T_MD, //LED Toggle Mode //Working + L_T_ONF, //LED Toggle On / Off //Broken + L_ON, //LED On //Broken + L_OFF, //LED Off //Broken + L_T_BR, //LED Toggle Breath Effect //Working + L_T_PTD, //LED Toggle Scrolling Pattern Direction //Working + U_T_AGCR, //USB Toggle Automatic GCR control //Working + DBG_TOG, //DEBUG Toggle On / Off // + DBG_MTRX, //DEBUG Toggle Matrix Prints // + DBG_KBD, //DEBUG Toggle Keyboard Prints // + DBG_MOU, //DEBUG Toggle Mouse Prints // + MD_BOOT //Restart into bootloader after hold timeout //Working +}; + +#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode + +keymap_config_t keymap_config; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_HOME, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, \ + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(1), KC_LEFT, KC_DOWN, KC_RGHT \ + ), + [1] = LAYOUT( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MUTE, \ + L_T_BR, L_PSD, L_BRI, L_PSI, _______, _______, _______, _______, U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \ + L_T_PTD, L_PTP, L_BRD, L_PTN, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, \ + _______, L_T_MD, L_T_ONF, _______, _______, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, KC_PGUP, KC_VOLD, \ + _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END \ + ), + /* + [X] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ), + */ +}; + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { +}; + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void) { +}; + +#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT)) +#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL)) +#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT)) + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + static uint32_t key_timer; + + switch (keycode) { + case L_BRI: + if (record->event.pressed) { + if (LED_GCR_STEP > LED_GCR_MAX - gcr_desired) gcr_desired = LED_GCR_MAX; + else gcr_desired += LED_GCR_STEP; + if (led_animation_breathing) gcr_breathe = gcr_desired; + } + return false; + case L_BRD: + if (record->event.pressed) { + if (LED_GCR_STEP > gcr_desired) gcr_desired = 0; + else gcr_desired -= LED_GCR_STEP; + if (led_animation_breathing) gcr_breathe = gcr_desired; + } + return false; + case L_PTN: + if (record->event.pressed) { + if (led_animation_id == led_setups_count - 1) led_animation_id = 0; + else led_animation_id++; + } + return false; + case L_PTP: + if (record->event.pressed) { + if (led_animation_id == 0) led_animation_id = led_setups_count - 1; + else led_animation_id--; + } + return false; + case L_PSI: + if (record->event.pressed) { + led_animation_speed += ANIMATION_SPEED_STEP; + } + return false; + case L_PSD: + if (record->event.pressed) { + led_animation_speed -= ANIMATION_SPEED_STEP; + if (led_animation_speed < 0) led_animation_speed = 0; + } + return false; + case L_T_MD: + if (record->event.pressed) { + led_lighting_mode++; + if (led_lighting_mode > LED_MODE_MAX_INDEX) led_lighting_mode = LED_MODE_NORMAL; + } + return false; + case L_T_ONF: + if (record->event.pressed) { + led_enabled = !led_enabled; + I2C3733_Control_Set(led_enabled); + } + return false; + case L_ON: + if (record->event.pressed) { + led_enabled = 1; + I2C3733_Control_Set(led_enabled); + } + return false; + case L_OFF: + if (record->event.pressed) { + led_enabled = 0; + I2C3733_Control_Set(led_enabled); + } + return false; + case L_T_BR: + if (record->event.pressed) { + led_animation_breathing = !led_animation_breathing; + if (led_animation_breathing) { + gcr_breathe = gcr_desired; + led_animation_breathe_cur = BREATHE_MIN_STEP; + breathe_dir = 1; + } + } + return false; + case L_T_PTD: + if (record->event.pressed) { + led_animation_direction = !led_animation_direction; + } + return false; + case U_T_AGCR: + if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { + TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode"); + } + return false; + case DBG_TOG: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode"); + } + return false; + case DBG_MTRX: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix"); + } + return false; + case DBG_KBD: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard"); + } + return false; + case DBG_MOU: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse"); + } + return false; + case MD_BOOT: + if (record->event.pressed) { + key_timer = timer_read32(); + } else { + if (timer_elapsed32(key_timer) >= 500) { + reset_keyboard(); + } + } + return false; + default: + return true; //Process all other keycodes normally + } +} + +led_instruction_t led_instructions[] = { + //Please see ../default_md/keymap.c for examples + + //All LEDs use the user's selected pattern (this is the factory default) + { .flags = LED_FLAG_USE_ROTATE_PATTERN }, + + //end must be set to 1 to indicate end of instruction set + { .end = 1 } +}; diff --git a/keyboards/massdrop/alt/keymaps/mac_md/rules.mk b/keyboards/massdrop/alt/keymaps/mac_md/rules.mk new file mode 100644 index 000000000000..064a6f54c1fa --- /dev/null +++ b/keyboards/massdrop/alt/keymaps/mac_md/rules.mk @@ -0,0 +1,2 @@ +# This keymap requires Massdrop Configurator support +OPT_DEFS += -DUSE_MASSDROP_CONFIGURATOR diff --git a/keyboards/massdrop/alt/keymaps/reywood/rules.mk b/keyboards/massdrop/alt/keymaps/reywood/rules.mk index b5b961a0f3b2..956d1c700c29 100644 --- a/keyboards/massdrop/alt/keymaps/reywood/rules.mk +++ b/keyboards/massdrop/alt/keymaps/reywood/rules.mk @@ -1,6 +1,4 @@ # project specific files -SRC = led_programs.c -SRC += matrix.c SRC += rgb_matrix_user.c #For platform and packs @@ -32,3 +30,6 @@ HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) VIRTSER_ENABLE = no # USB Serial Driver RAW_ENABLE = no # Raw device AUTO_SHIFT_ENABLE = no # Auto Shift + +# This keymap requires Massdrop Configurator support +OPT_DEFS += -DUSE_MASSDROP_CONFIGURATOR diff --git a/keyboards/massdrop/ctrl/config_led.h b/keyboards/massdrop/ctrl/config_led.h index 2c2771b1a65e..9397bf2f8a6a 100644 --- a/keyboards/massdrop/ctrl/config_led.h +++ b/keyboards/massdrop/ctrl/config_led.h @@ -33,6 +33,14 @@ along with this program. If not, see . #define LED_GCR_MAX 165 //Max GCR value (0 - 255) WARNING: Raising this value may overload the LED drivers and USB bus #define LED_GCR_STEP 10 //GCR increment/decrement value +#ifdef USE_MASSDROP_CONFIGURATOR +#define ANIMATION_SPEED_STEP 1 + +#define BREATHE_STEP 1 +#define BREATHE_MIN_STEP 0 +#define BREATHE_MAX_STEP 255 +#endif + //Default Global Current Register value (Default brightness 0 - 255) #define ISSI3733_GCR_DEFAULT LED_GCR_MAX diff --git a/keyboards/massdrop/ctrl/keymaps/default_md/keymap.c b/keyboards/massdrop/ctrl/keymaps/default_md/keymap.c new file mode 100644 index 000000000000..16f88ffe1dc4 --- /dev/null +++ b/keyboards/massdrop/ctrl/keymaps/default_md/keymap.c @@ -0,0 +1,226 @@ +#include QMK_KEYBOARD_H + +enum ctrl_keycodes { + L_BRI = SAFE_RANGE, //LED Brightness Increase //Working + L_BRD, //LED Brightness Decrease //Working + L_PTN, //LED Pattern Select Next //Working + L_PTP, //LED Pattern Select Previous //Working + L_PSI, //LED Pattern Speed Increase //Working + L_PSD, //LED Pattern Speed Decrease //Working + L_T_MD, //LED Toggle Mode //Working + L_T_ONF, //LED Toggle On / Off //Broken + L_ON, //LED On //Broken + L_OFF, //LED Off //Broken + L_T_BR, //LED Toggle Breath Effect //Working + L_T_PTD, //LED Toggle Scrolling Pattern Direction //Working + U_T_AGCR, //USB Toggle Automatic GCR control //Working + DBG_TOG, //DEBUG Toggle On / Off // + DBG_MTRX, //DEBUG Toggle Matrix Prints // + DBG_KBD, //DEBUG Toggle Keyboard Prints // + DBG_MOU, //DEBUG Toggle Mouse Prints // + MD_BOOT //Restart into bootloader after hold timeout //Working +}; + +#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode + +keymap_config_t keymap_config; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \ + ), + [1] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU, \ + L_T_BR, L_PSD, L_BRI, L_PSI, _______, _______, _______, _______, U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \ + L_T_PTD, L_PTP, L_BRD, L_PTN, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, L_T_MD, L_T_ONF, _______, _______, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ), + /* + [X] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ), + */ +}; + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { +}; + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void) { +}; + +#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT)) +#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL)) +#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT)) + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + static uint32_t key_timer; + + switch (keycode) { + case L_BRI: + if (record->event.pressed) { + if (LED_GCR_STEP > LED_GCR_MAX - gcr_desired) gcr_desired = LED_GCR_MAX; + else gcr_desired += LED_GCR_STEP; + if (led_animation_breathing) gcr_breathe = gcr_desired; + } + return false; + case L_BRD: + if (record->event.pressed) { + if (LED_GCR_STEP > gcr_desired) gcr_desired = 0; + else gcr_desired -= LED_GCR_STEP; + if (led_animation_breathing) gcr_breathe = gcr_desired; + } + return false; + case L_PTN: + if (record->event.pressed) { + if (led_animation_id == led_setups_count - 1) led_animation_id = 0; + else led_animation_id++; + } + return false; + case L_PTP: + if (record->event.pressed) { + if (led_animation_id == 0) led_animation_id = led_setups_count - 1; + else led_animation_id--; + } + return false; + case L_PSI: + if (record->event.pressed) { + led_animation_speed += ANIMATION_SPEED_STEP; + } + return false; + case L_PSD: + if (record->event.pressed) { + led_animation_speed -= ANIMATION_SPEED_STEP; + if (led_animation_speed < 0) led_animation_speed = 0; + } + return false; + case L_T_MD: + if (record->event.pressed) { + led_lighting_mode++; + if (led_lighting_mode > LED_MODE_MAX_INDEX) led_lighting_mode = LED_MODE_NORMAL; + } + return false; + case L_T_ONF: + if (record->event.pressed) { + led_enabled = !led_enabled; + I2C3733_Control_Set(led_enabled); + } + return false; + case L_ON: + if (record->event.pressed) { + led_enabled = 1; + I2C3733_Control_Set(led_enabled); + } + return false; + case L_OFF: + if (record->event.pressed) { + led_enabled = 0; + I2C3733_Control_Set(led_enabled); + } + return false; + case L_T_BR: + if (record->event.pressed) { + led_animation_breathing = !led_animation_breathing; + if (led_animation_breathing) { + gcr_breathe = gcr_desired; + led_animation_breathe_cur = BREATHE_MIN_STEP; + breathe_dir = 1; + } + } + return false; + case L_T_PTD: + if (record->event.pressed) { + led_animation_direction = !led_animation_direction; + } + return false; + case U_T_AGCR: + if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { + TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode"); + } + return false; + case DBG_TOG: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode"); + } + return false; + case DBG_MTRX: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix"); + } + return false; + case DBG_KBD: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard"); + } + return false; + case DBG_MOU: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse"); + } + return false; + case MD_BOOT: + if (record->event.pressed) { + key_timer = timer_read32(); + } else { + if (timer_elapsed32(key_timer) >= 500) { + reset_keyboard(); + } + } + return false; + default: + return true; //Process all other keycodes normally + } +} + +led_instruction_t led_instructions[] = { + //LEDs are normally inactive, no processing is performed on them + //Flags are used in matching criteria for an LED to be active and indicate how to color it + //Flags can be found in tmk_core/protocol/arm_atsam/led_matrix.h (prefixed with LED_FLAG_) + //LED IDs can be found in config_led.h in the keyboard's directory + //Examples are below + + //All LEDs use the user's selected pattern (this is the factory default) + { .flags = LED_FLAG_USE_ROTATE_PATTERN }, + + //Specific LEDs use the user's selected pattern while all others are off + // { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_ROTATE_PATTERN, .id0 = 0xFFFFFFFF, .id1 = 0xAAAAAAAA, .id2 = 0x55555555, .id3 = 0x11111111 }, + + //Specific LEDs use specified RGB values while all others are off + // { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0xFF, .id1 = 0x00FF, .id2 = 0x0000FF00, .id3 = 0xFF000000, .r = 75, .g = 150, .b = 225 }, + + //All LEDs use the user's selected pattern + //On layer 1, all key LEDs (except the top row which keeps active pattern) are red while all edge LEDs are green + //When layer 1 is active, key LEDs use red (id0 32 - 17: 1111 1111 1111 1111 0000 0000 0000 0000 = 0xFFFF0000) (except top row 16 - 1) + //When layer 1 is active, key LEDs use red (id1 64 - 33: 1111 1111 1111 1111 1111 1111 1111 1111 = 0xFFFFFFFF) + //When layer 1 is active, key LEDs use red (id2 87 - 65: 0000 0000 0111 1111 1111 1111 1111 1111 = 0x007FFFFF) + //When layer 1 is active, edge LEDs use green (id2 95 - 88: 1111 1111 1000 0000 0000 0000 0000 0000 = 0xFF800000) + //When layer 1 is active, edge LEDs use green (id3 119 - 96: 0000 0000 1111 1111 1111 1111 1111 1111 = 0x00FFFFFF) + // { .flags = LED_FLAG_USE_ROTATE_PATTERN }, + // { .flags = LED_FLAG_MATCH_ID | LED_FLAG_MATCH_LAYER | LED_FLAG_USE_RGB, .id0 = 0xFFFF0000, .id1 = 0xFFFFFFFF, .id2 = 0x007FFFFF, .r = 255, .layer = 1 }, + // { .flags = LED_FLAG_MATCH_ID | LED_FLAG_MATCH_LAYER | LED_FLAG_USE_RGB, .id2 = 0xFF800000, .id3 = 0x00FFFFFF, .g = 127, .layer = 1 }, + + //All key LEDs use red while edge LEDs use the active pattern + //All key LEDs use red (id0 32 - 1: 1111 1111 1111 1111 1111 1111 1111 1111 = 0xFFFFFFFF) + //All key LEDs use red (id1 64 - 33: 1111 1111 1111 1111 1111 1111 1111 1111 = 0xFFFFFFFF) + //All key LEDs use red (id2 87 - 65: 0000 0000 0111 1111 1111 1111 1111 1111 = 0x007FFFFF) + //Edge uses active pattern (id2 95 - 88: 1111 1111 1000 0000 0000 0000 0000 0000 = 0xFF800000) + //Edge uses active pattern (id3 119 - 96: 0000 0000 1111 1111 1111 1111 1111 1111 = 0x00FFFFFF) + // { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0xFFFFFFFF, .id1 = 0xFFFFFFFF, .id2 = 0x007FFFFF, .r = 255 }, + // { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_ROTATE_PATTERN , .id2 = 0xFF800000, .id3 = 0x00FFFFFF }, + + //end must be set to 1 to indicate end of instruction set + { .end = 1 } +}; diff --git a/keyboards/massdrop/ctrl/keymaps/default_md/rules.mk b/keyboards/massdrop/ctrl/keymaps/default_md/rules.mk new file mode 100644 index 000000000000..064a6f54c1fa --- /dev/null +++ b/keyboards/massdrop/ctrl/keymaps/default_md/rules.mk @@ -0,0 +1,2 @@ +# This keymap requires Massdrop Configurator support +OPT_DEFS += -DUSE_MASSDROP_CONFIGURATOR diff --git a/keyboards/massdrop/ctrl/keymaps/mac_md/keymap.c b/keyboards/massdrop/ctrl/keymaps/mac_md/keymap.c new file mode 100644 index 000000000000..6dfc21378627 --- /dev/null +++ b/keyboards/massdrop/ctrl/keymaps/mac_md/keymap.c @@ -0,0 +1,196 @@ +#include QMK_KEYBOARD_H + +enum ctrl_keycodes { + L_BRI = SAFE_RANGE, //LED Brightness Increase //Working + L_BRD, //LED Brightness Decrease //Working + L_PTN, //LED Pattern Select Next //Working + L_PTP, //LED Pattern Select Previous //Working + L_PSI, //LED Pattern Speed Increase //Working + L_PSD, //LED Pattern Speed Decrease //Working + L_T_MD, //LED Toggle Mode //Working + L_T_ONF, //LED Toggle On / Off //Broken + L_ON, //LED On //Broken + L_OFF, //LED Off //Broken + L_T_BR, //LED Toggle Breath Effect //Working + L_T_PTD, //LED Toggle Scrolling Pattern Direction //Working + U_T_AGCR, //USB Toggle Automatic GCR control //Working + DBG_TOG, //DEBUG Toggle On / Off // + DBG_MTRX, //DEBUG Toggle Matrix Prints // + DBG_KBD, //DEBUG Toggle Keyboard Prints // + DBG_MOU, //DEBUG Toggle Mouse Prints // + MD_BOOT //Restart into bootloader after hold timeout //Working +}; + +#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode + +keymap_config_t keymap_config; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, \ + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \ + ), + [1] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU, \ + L_T_BR, L_PSD, L_BRI, L_PSI, _______, _______, _______, _______, U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \ + L_T_PTD, L_PTP, L_BRD, L_PTN, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, L_T_MD, L_T_ONF, _______, _______, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ), + /* + [X] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ), + */ +}; + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { +}; + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void) { +}; + +#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT)) +#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL)) +#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT)) + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + static uint32_t key_timer; + + switch (keycode) { + case L_BRI: + if (record->event.pressed) { + if (LED_GCR_STEP > LED_GCR_MAX - gcr_desired) gcr_desired = LED_GCR_MAX; + else gcr_desired += LED_GCR_STEP; + if (led_animation_breathing) gcr_breathe = gcr_desired; + } + return false; + case L_BRD: + if (record->event.pressed) { + if (LED_GCR_STEP > gcr_desired) gcr_desired = 0; + else gcr_desired -= LED_GCR_STEP; + if (led_animation_breathing) gcr_breathe = gcr_desired; + } + return false; + case L_PTN: + if (record->event.pressed) { + if (led_animation_id == led_setups_count - 1) led_animation_id = 0; + else led_animation_id++; + } + return false; + case L_PTP: + if (record->event.pressed) { + if (led_animation_id == 0) led_animation_id = led_setups_count - 1; + else led_animation_id--; + } + return false; + case L_PSI: + if (record->event.pressed) { + led_animation_speed += ANIMATION_SPEED_STEP; + } + return false; + case L_PSD: + if (record->event.pressed) { + led_animation_speed -= ANIMATION_SPEED_STEP; + if (led_animation_speed < 0) led_animation_speed = 0; + } + return false; + case L_T_MD: + if (record->event.pressed) { + led_lighting_mode++; + if (led_lighting_mode > LED_MODE_MAX_INDEX) led_lighting_mode = LED_MODE_NORMAL; + } + return false; + case L_T_ONF: + if (record->event.pressed) { + led_enabled = !led_enabled; + I2C3733_Control_Set(led_enabled); + } + return false; + case L_ON: + if (record->event.pressed) { + led_enabled = 1; + I2C3733_Control_Set(led_enabled); + } + return false; + case L_OFF: + if (record->event.pressed) { + led_enabled = 0; + I2C3733_Control_Set(led_enabled); + } + return false; + case L_T_BR: + if (record->event.pressed) { + led_animation_breathing = !led_animation_breathing; + if (led_animation_breathing) { + gcr_breathe = gcr_desired; + led_animation_breathe_cur = BREATHE_MIN_STEP; + breathe_dir = 1; + } + } + return false; + case L_T_PTD: + if (record->event.pressed) { + led_animation_direction = !led_animation_direction; + } + return false; + case U_T_AGCR: + if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { + TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode"); + } + return false; + case DBG_TOG: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode"); + } + return false; + case DBG_MTRX: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix"); + } + return false; + case DBG_KBD: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard"); + } + return false; + case DBG_MOU: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse"); + } + return false; + case MD_BOOT: + if (record->event.pressed) { + key_timer = timer_read32(); + } else { + if (timer_elapsed32(key_timer) >= 500) { + reset_keyboard(); + } + } + return false; + default: + return true; //Process all other keycodes normally + } +} + +led_instruction_t led_instructions[] = { + //Please see ../default_md/keymap.c for examples + + //All LEDs use the user's selected pattern (this is the factory default) + { .flags = LED_FLAG_USE_ROTATE_PATTERN }, + + //end must be set to 1 to indicate end of instruction set + { .end = 1 } +}; diff --git a/keyboards/massdrop/ctrl/keymaps/mac_md/rules.mk b/keyboards/massdrop/ctrl/keymaps/mac_md/rules.mk new file mode 100644 index 000000000000..064a6f54c1fa --- /dev/null +++ b/keyboards/massdrop/ctrl/keymaps/mac_md/rules.mk @@ -0,0 +1,2 @@ +# This keymap requires Massdrop Configurator support +OPT_DEFS += -DUSE_MASSDROP_CONFIGURATOR diff --git a/keyboards/massdrop/ctrl/keymaps/responsive_pattern/keymap.c b/keyboards/massdrop/ctrl/keymaps/responsive_pattern/keymap.c index 0bdc15214016..58911aa75741 100644 --- a/keyboards/massdrop/ctrl/keymaps/responsive_pattern/keymap.c +++ b/keyboards/massdrop/ctrl/keymaps/responsive_pattern/keymap.c @@ -15,7 +15,6 @@ extern issi3733_led_t *lede; extern issi3733_led_t led_map[]; -extern led_disp_t disp; enum ctrl_keycodes { L_BRI = SAFE_RANGE, //LED Brightness Increase @@ -238,8 +237,6 @@ void led_matrix_run(void) { led_cur = led_map; - disp.frame += 1; - breathe_mult = 1; if (led_animation_breathing) @@ -314,7 +311,7 @@ void led_matrix_run(void) } float pomod; - pomod = (float)(disp.frame % (uint32_t)(1000.0f / led_animation_speed)) / 10.0f * led_animation_speed; + pomod = (float)(g_tick % (uint32_t)(1000.0f / led_animation_speed)) / 10.0f * led_animation_speed; //Add in any moving effects if ((!led_animation_direction && f[fcur].ef & EF_SCR_R) || (led_animation_direction && (f[fcur].ef & EF_SCR_L))) diff --git a/keyboards/massdrop/ctrl/keymaps/responsive_pattern/rules.mk b/keyboards/massdrop/ctrl/keymaps/responsive_pattern/rules.mk new file mode 100644 index 000000000000..064a6f54c1fa --- /dev/null +++ b/keyboards/massdrop/ctrl/keymaps/responsive_pattern/rules.mk @@ -0,0 +1,2 @@ +# This keymap requires Massdrop Configurator support +OPT_DEFS += -DUSE_MASSDROP_CONFIGURATOR diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h index afde1ea49f0f..21f8c570d67d 100644 --- a/quantum/rgb_matrix.h +++ b/quantum/rgb_matrix.h @@ -236,5 +236,6 @@ typedef struct { extern const rgb_matrix_driver_t rgb_matrix_driver; extern rgb_config_t rgb_matrix_config; +extern uint32_t g_tick; #endif diff --git a/tmk_core/protocol/arm_atsam/led_matrix.c b/tmk_core/protocol/arm_atsam/led_matrix.c index 57f00bef1dd2..ae597761e64d 100644 --- a/tmk_core/protocol/arm_atsam/led_matrix.c +++ b/tmk_core/protocol/arm_atsam/led_matrix.c @@ -64,6 +64,11 @@ RGB led_buffer[ISSI3733_LED_COUNT]; uint8_t gcr_desired; uint8_t gcr_actual; uint8_t gcr_actual_last; +#ifdef USE_MASSDROP_CONFIGURATOR +uint8_t gcr_breathe; +float breathe_mult; +float pomod; +#endif #define ACT_GCR_NONE 0 #define ACT_GCR_INC 1 @@ -78,6 +83,14 @@ static uint8_t v_5v_cat_hit; void gcr_compute(void) { uint8_t action = ACT_GCR_NONE; + uint8_t gcr_use = gcr_desired; + +#ifdef USE_MASSDROP_CONFIGURATOR + if (led_animation_breathing) + { + gcr_use = gcr_breathe; + } +#endif //If the 5v takes a catastrophic hit, disable the LED drivers briefly, assert auto gcr mode, min gcr and let the auto take over if (v_5v < V5_CAT) @@ -105,13 +118,13 @@ void gcr_compute(void) if (usb_gcr_auto) { if (v_5v_avg < V5_LOW) action = ACT_GCR_DEC; - else if (v_5v_avg > V5_HIGH && gcr_actual < gcr_desired) action = ACT_GCR_INC; - else if (gcr_actual > gcr_desired) action = ACT_GCR_DEC; + else if (v_5v_avg > V5_HIGH && gcr_actual < gcr_use) action = ACT_GCR_INC; + else if (gcr_actual > gcr_use) action = ACT_GCR_DEC; } else { - if (gcr_actual < gcr_desired) action = ACT_GCR_INC; - else if (gcr_actual > gcr_desired) action = ACT_GCR_DEC; + if (gcr_actual < gcr_use) action = ACT_GCR_INC; + else if (gcr_actual > gcr_use) action = ACT_GCR_DEC; } if (action == ACT_GCR_NONE) @@ -150,6 +163,18 @@ void gcr_compute(void) //Power successfully cut back from LED drivers gcr_actual -= LED_GCR_STEP_AUTO; gcr_min_counter = 0; + +#ifdef USE_MASSDROP_CONFIGURATOR + //If breathe mode is active, the top end can fluctuate if the host can not supply enough current + //So set the breathe GCR to where it becomes stable + if (led_animation_breathing == 1) + { + gcr_breathe = gcr_actual; + //PS: At this point, setting breathing to exhale makes a noticebly shorter cycle + // and the same would happen maybe one or two more times. Therefore I'm favoring + // powering through one full breathe and letting gcr settle completely + } +#endif } } } @@ -195,12 +220,13 @@ void led_set_one(int i, uint8_t r, uint8_t g, uint8_t b) { if (i < ISSI3733_LED_COUNT) { +#ifdef USE_MASSDROP_CONFIGURATOR + led_matrix_massdrop_config_override(i); +#else led_buffer[i].r = r; led_buffer[i].g = g; led_buffer[i].b = b; -#ifdef USE_MASSDROP_CONFIGURATOR - led_matrix_massdrop_config_override(i); -#endif // USE_MASSDROP_CONFIGURATOR +#endif } } @@ -228,11 +254,14 @@ void init(void) void flush(void) { +#ifdef USE_MASSDROP_CONFIGURATOR + if (!led_enabled) { return; } //Prevent calculations and I2C traffic if LED drivers are not enabled +#else + if (!sr_exp_data.bit.SDB_N) { return; } //Prevent calculations and I2C traffic if LED drivers are not enabled +#endif + // Wait for previous transfer to complete - while (i2c_led_q_running) - { - CLK_delay_ms(20); - } + while (i2c_led_q_running) {} // Copy buffer to live DMA region for (uint8_t i = 0; i < ISSI3733_LED_COUNT; i++) @@ -242,6 +271,33 @@ void flush(void) *led_map[i].rgb.b = led_buffer[i].b; } +#ifdef USE_MASSDROP_CONFIGURATOR + breathe_mult = 1; + + if (led_animation_breathing) + { + //+60us 119 LED + led_animation_breathe_cur += BREATHE_STEP * breathe_dir; + + if (led_animation_breathe_cur >= BREATHE_MAX_STEP) + breathe_dir = -1; + else if (led_animation_breathe_cur <= BREATHE_MIN_STEP) + breathe_dir = 1; + + //Brightness curve created for 256 steps, 0 - ~98% + breathe_mult = 0.000015 * led_animation_breathe_cur * led_animation_breathe_cur; + if (breathe_mult > 1) breathe_mult = 1; + else if (breathe_mult < 0) breathe_mult = 0; + } + + //This should only be performed once per frame + pomod = (float)(g_tick % (uint32_t)(1000.0f / led_animation_speed)) / 10.0f * led_animation_speed; + pomod *= 100.0f; + pomod = (uint32_t)pomod % 10000; + pomod /= 100.0f; + +#endif // USE_MASSDROP_CONFIGURATOR + uint8_t drvid; //NOTE: GCR does not need to be timed with LED processing, but there is really no harm @@ -306,16 +362,17 @@ const rgb_matrix_driver_t rgb_matrix_driver = { // Ported from Massdrop QMK Github Repo // TODO?: wire these up to keymap.c -bool led_animation_direction = false; -bool led_animation_orientation = false; +uint8_t led_animation_orientation = 0; +uint8_t led_animation_direction = 0; +uint8_t led_animation_breathing = 0; +uint8_t led_animation_id = 0; +float led_animation_speed = 4.0f; +uint8_t led_lighting_mode = LED_MODE_NORMAL; +uint8_t led_enabled = 1; +uint8_t led_animation_breathe_cur = BREATHE_MIN_STEP; +uint8_t breathe_dir = 1; static void led_run_pattern(led_setup_t *f, float* ro, float* go, float* bo, float pos) { - float pomod; - pomod = (float)(g_tick % (uint32_t)(1000.0f / (1 << rgb_matrix_config.speed))) / 10.0f * (1 << rgb_matrix_config.speed); - pomod *= 100.0f; - pomod = (uint32_t)pomod % 10000; - pomod /= 100.0f; - float po; while (f->end != 1) @@ -372,17 +429,6 @@ static void led_run_pattern(led_setup_t *f, float* ro, float* go, float* bo, flo static void led_matrix_massdrop_config_override(int i) { -#ifdef RGB_MATRIX_EXTRA_TOG - const bool is_key = g_rgb_leds[i].matrix_co.raw != 0xff; - if ((rgb_matrix_config.enable == RGB_ZONE_KEYS && !is_key) || - (rgb_matrix_config.enable == RGB_ZONE_UNDER && is_key)) - { - return; - } -#endif - - bool do_override = false; - float ro = 0; float go = 0; float bo = 0; @@ -391,49 +437,58 @@ static void led_matrix_massdrop_config_override(int i) ? (float)g_rgb_leds[i].point.y / 64.f * 100 : (float)g_rgb_leds[i].point.x / 224.f * 100; - const uint8_t highest_active_layer = biton32(layer_state); + uint8_t highest_active_layer = biton32(layer_state); + + if (led_lighting_mode == LED_MODE_KEYS_ONLY && g_rgb_leds[i].matrix_co.raw == 0xff) { + //Do not act on this LED + } else if (led_lighting_mode == LED_MODE_NON_KEYS_ONLY && g_rgb_leds[i].matrix_co.raw != 0xff) { + //Do not act on this LED + } else if (led_lighting_mode == LED_MODE_INDICATORS_ONLY) { + //Do not act on this LED (Only show indicators) + } else { + led_instruction_t* led_cur_instruction = led_instructions; + while (!led_cur_instruction->end) { + // Check if this applies to current layer + if ((led_cur_instruction->flags & LED_FLAG_MATCH_LAYER) && + (led_cur_instruction->layer != highest_active_layer)) { + goto next_iter; + } - const led_instruction_t* led_cur_instruction = led_instructions; - while (!led_cur_instruction->end) { - // Check if this applies to current layer - if ((led_cur_instruction->flags & LED_FLAG_MATCH_LAYER) && - (led_cur_instruction->layer != highest_active_layer)) - { - goto next_iter; - } + // Check if this applies to current index + if (led_cur_instruction->flags & LED_FLAG_MATCH_ID) { + uint8_t modid = i / 32; //Calculate which id# contains the led bit + uint32_t modidbit = 1 << (i % 32); //Calculate the bit within the id# + uint32_t *bitfield = &led_cur_instruction->id0 + modid; //Add modid as offset to id0 address. *bitfield is now idX of the led id + if (~(*bitfield) & modidbit) { //Check if led bit is not set in idX + goto next_iter; + } + } - // Check if this applies to current index - if (led_cur_instruction->flags & LED_FLAG_MATCH_ID) { - const uint8_t modid = i / 32; //PS: Calculate which id# contains the led bit - const uint32_t modidbit = 1 << (i % 32); //PS: Calculate the bit within the id# - const uint32_t* bitfield = &led_cur_instruction->id0 + modid; //PS: Add modid as offset to id0 address. *bitfield is now idX of the led id - if (~(*bitfield) & modidbit) //PS: Check if led bit is not set in idX - goto next_iter; - } + if (led_cur_instruction->flags & LED_FLAG_USE_RGB) { + ro = led_cur_instruction->r; + go = led_cur_instruction->g; + bo = led_cur_instruction->b; + } else if (led_cur_instruction->flags & LED_FLAG_USE_PATTERN) { + led_run_pattern(led_setups[led_cur_instruction->pattern_id], &ro, &go, &bo, po); + } else if (led_cur_instruction->flags & LED_FLAG_USE_ROTATE_PATTERN) { + led_run_pattern(led_setups[led_animation_id], &ro, &go, &bo, po); + } - if (led_cur_instruction->flags & LED_FLAG_USE_RGB) { - ro = led_cur_instruction->r; - go = led_cur_instruction->g; - bo = led_cur_instruction->b; - do_override = true; - } else if (led_cur_instruction->flags & LED_FLAG_USE_PATTERN) { - led_run_pattern(led_setups[led_cur_instruction->pattern_id], &ro, &go, &bo, po); - do_override = true; - } else if (led_cur_instruction->flags & LED_FLAG_USE_ROTATE_PATTERN) { - // no override - do_override = false; + next_iter: + led_cur_instruction++; } - next_iter: - led_cur_instruction++; - } - - if (!do_override) - return; + if (ro > 255) ro = 255; else if (ro < 0) ro = 0; + if (go > 255) go = 255; else if (go < 0) go = 0; + if (bo > 255) bo = 255; else if (bo < 0) bo = 0; - if (ro > 255) ro = 255; else if (ro < 0) ro = 0; - if (go > 255) go = 255; else if (go < 0) go = 0; - if (bo > 255) bo = 255; else if (bo < 0) bo = 0; + if (led_animation_breathing) + { + ro *= breathe_mult; + go *= breathe_mult; + bo *= breathe_mult; + } + } led_buffer[i].r = (uint8_t)ro; led_buffer[i].g = (uint8_t)go; diff --git a/tmk_core/protocol/arm_atsam/led_matrix.h b/tmk_core/protocol/arm_atsam/led_matrix.h index c8798305de3f..1316efd9a4fd 100644 --- a/tmk_core/protocol/arm_atsam/led_matrix.h +++ b/tmk_core/protocol/arm_atsam/led_matrix.h @@ -115,12 +115,12 @@ extern const uint8_t led_setups_count; extern void *led_setups[]; //LED Extra Instructions -#define LED_FLAG_NULL 0x00 -#define LED_FLAG_MATCH_ID 0x01 -#define LED_FLAG_MATCH_LAYER 0x02 -#define LED_FLAG_USE_RGB 0x10 -#define LED_FLAG_USE_PATTERN 0x20 -#define LED_FLAG_USE_ROTATE_PATTERN 0x40 +#define LED_FLAG_NULL 0x00 //Matching and coloring not used (default) +#define LED_FLAG_MATCH_ID 0x01 //Match on the ID of the LED (set id#'s to desired bit pattern, first LED is id 1) +#define LED_FLAG_MATCH_LAYER 0x02 //Match on the current active layer (set layer to desired match layer) +#define LED_FLAG_USE_RGB 0x10 //Use a specific RGB value (set r, g, b to desired output color values) +#define LED_FLAG_USE_PATTERN 0x20 //Use a specific pattern ID (set pattern_id to desired output pattern) +#define LED_FLAG_USE_ROTATE_PATTERN 0x40 //Use pattern the user has cycled to manually typedef struct led_instruction_s { uint16_t flags; // Bitfield for LED instructions @@ -138,6 +138,21 @@ typedef struct led_instruction_s { extern led_instruction_t led_instructions[]; +extern uint8_t led_animation_breathing; +extern uint8_t led_animation_id; +extern float led_animation_speed; +extern uint8_t led_lighting_mode; +extern uint8_t led_enabled; +extern uint8_t led_animation_breathe_cur; +extern uint8_t led_animation_direction; +extern uint8_t breathe_dir; + +#define LED_MODE_NORMAL 0 //Must be 0 +#define LED_MODE_KEYS_ONLY 1 +#define LED_MODE_NON_KEYS_ONLY 2 +#define LED_MODE_INDICATORS_ONLY 3 +#define LED_MODE_MAX_INDEX LED_MODE_INDICATORS_ONLY //Must be highest value + #endif // USE_MASSDROP_CONFIGURATOR #endif //_LED_MATRIX_H_ From 96fab9c983302f051d993b9f4943d6e7039015e5 Mon Sep 17 00:00:00 2001 From: Ryan Caltabiano Date: Tue, 2 Apr 2019 21:24:12 -0500 Subject: [PATCH 3/5] Updating config based on testing results with patrickmt & compile errors --- keyboards/massdrop/alt/config_led.h | 3 ++- keyboards/massdrop/ctrl/config_led.h | 3 ++- tmk_core/protocol/arm_atsam/led_matrix.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/keyboards/massdrop/alt/config_led.h b/keyboards/massdrop/alt/config_led.h index 352924ee4967..72b7de7ddc1f 100644 --- a/keyboards/massdrop/alt/config_led.h +++ b/keyboards/massdrop/alt/config_led.h @@ -178,6 +178,7 @@ along with this program. If not, see . #define USB_LED_KANA_SCANCODE 255 #endif //USB_LED_INDICATOR_ENABLE -#define RGB_MATRIX_SKIP_FRAMES 1 +#define RGB_MATRIX_KEYPRESSES +#define RGB_MATRIX_LED_PROCESS_LIMIT 15 #define RGB_MATRIX_EXTRA_TOG diff --git a/keyboards/massdrop/ctrl/config_led.h b/keyboards/massdrop/ctrl/config_led.h index 9397bf2f8a6a..8b4fec1ac269 100644 --- a/keyboards/massdrop/ctrl/config_led.h +++ b/keyboards/massdrop/ctrl/config_led.h @@ -191,5 +191,6 @@ along with this program. If not, see . #define USB_LED_KANA_SCANCODE 255 #endif //USB_LED_INDICATOR_ENABLE -#define RGB_MATRIX_SKIP_FRAMES 1 +#define RGB_MATRIX_KEYPRESSES +#define RGB_MATRIX_LED_PROCESS_LIMIT 15 #define RGB_MATRIX_EXTRA_TOG diff --git a/tmk_core/protocol/arm_atsam/led_matrix.c b/tmk_core/protocol/arm_atsam/led_matrix.c index 17b7dbce9c62..e29fb6587c9f 100644 --- a/tmk_core/protocol/arm_atsam/led_matrix.c +++ b/tmk_core/protocol/arm_atsam/led_matrix.c @@ -28,6 +28,7 @@ static void led_matrix_massdrop_config_override(int i); #endif // USE_MASSDROP_CONFIGURATOR extern rgb_config_t rgb_matrix_config; +extern rgb_counters_t g_rgb_counters; void SERCOM1_0_Handler( void ) { @@ -293,7 +294,7 @@ void flush(void) } //This should only be performed once per frame - pomod = (float)(g_tick % (uint32_t)(1000.0f / led_animation_speed)) / 10.0f * led_animation_speed; + pomod = (float)((g_rgb_counters.tick / 10) % (uint32_t)(1000.0f / led_animation_speed)) / 10.0f * led_animation_speed; pomod *= 100.0f; pomod = (uint32_t)pomod % 10000; pomod /= 100.0f; From 0c8538886bfb09bdea7242b8038a5dbcae234b12 Mon Sep 17 00:00:00 2001 From: patrickmt <40182064+patrickmt@users.noreply.github.com> Date: Wed, 3 Apr 2019 13:58:40 -0700 Subject: [PATCH 4/5] Updates for PR5328 For CTRL and ALT: Moved location of new RGB Matrix macros from config_led.h to config.h. Added RGB_MATRIX_LED_FLUSH_LIMIT (time between flushes) to config.h for correct LED driver update timing. Re-added missing breathing code for when Massdrop configurator mode is defined. --- keyboards/massdrop/alt/config.h | 5 +++++ keyboards/massdrop/alt/config_led.h | 5 ----- keyboards/massdrop/ctrl/config.h | 5 +++++ keyboards/massdrop/ctrl/config_led.h | 4 ---- tmk_core/protocol/arm_atsam/usb/usb2422.c | 5 ++++- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/keyboards/massdrop/alt/config.h b/keyboards/massdrop/alt/config.h index 92f664b96938..f63c38bf6f85 100644 --- a/keyboards/massdrop/alt/config.h +++ b/keyboards/massdrop/alt/config.h @@ -120,4 +120,9 @@ along with this program. If not, see . //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION +#define RGB_MATRIX_KEYPRESSES +#define RGB_MATRIX_LED_PROCESS_LIMIT 15 +#define RGB_MATRIX_LED_FLUSH_LIMIT 10 +#define RGB_MATRIX_EXTRA_TOG + #include "config_led.h" diff --git a/keyboards/massdrop/alt/config_led.h b/keyboards/massdrop/alt/config_led.h index 72b7de7ddc1f..82117b33279e 100644 --- a/keyboards/massdrop/alt/config_led.h +++ b/keyboards/massdrop/alt/config_led.h @@ -177,8 +177,3 @@ along with this program. If not, see . #define USB_LED_COMPOSE_SCANCODE 255 #define USB_LED_KANA_SCANCODE 255 #endif //USB_LED_INDICATOR_ENABLE - -#define RGB_MATRIX_KEYPRESSES -#define RGB_MATRIX_LED_PROCESS_LIMIT 15 -#define RGB_MATRIX_EXTRA_TOG - diff --git a/keyboards/massdrop/ctrl/config.h b/keyboards/massdrop/ctrl/config.h index e592d2e803b6..df2e50921631 100644 --- a/keyboards/massdrop/ctrl/config.h +++ b/keyboards/massdrop/ctrl/config.h @@ -120,4 +120,9 @@ along with this program. If not, see . //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION +#define RGB_MATRIX_KEYPRESSES +#define RGB_MATRIX_LED_PROCESS_LIMIT 15 +#define RGB_MATRIX_LED_FLUSH_LIMIT 10 +#define RGB_MATRIX_EXTRA_TOG + #include "config_led.h" diff --git a/keyboards/massdrop/ctrl/config_led.h b/keyboards/massdrop/ctrl/config_led.h index 8b4fec1ac269..0c91a0c80baf 100644 --- a/keyboards/massdrop/ctrl/config_led.h +++ b/keyboards/massdrop/ctrl/config_led.h @@ -190,7 +190,3 @@ along with this program. If not, see . #define USB_LED_COMPOSE_SCANCODE 255 #define USB_LED_KANA_SCANCODE 255 #endif //USB_LED_INDICATOR_ENABLE - -#define RGB_MATRIX_KEYPRESSES -#define RGB_MATRIX_LED_PROCESS_LIMIT 15 -#define RGB_MATRIX_EXTRA_TOG diff --git a/tmk_core/protocol/arm_atsam/usb/usb2422.c b/tmk_core/protocol/arm_atsam/usb/usb2422.c index 9831d7fad9e7..76ec3aaaa76f 100644 --- a/tmk_core/protocol/arm_atsam/usb/usb2422.c +++ b/tmk_core/protocol/arm_atsam/usb/usb2422.c @@ -365,7 +365,10 @@ void USB_ExtraSetState(uint8_t state) if (usb_extra_state == USB_EXTRA_STATE_ENABLED) CDC_print("USB: Extra enabled\r\n"); else if (usb_extra_state == USB_EXTRA_STATE_DISABLED) { - CDC_print("USB: Extra disabled\r\n"); + CDC_print("USB: Extra disabled\r\n"); +#ifdef USE_MASSDROP_CONFIGURATOR + if (led_animation_breathing) gcr_breathe = gcr_desired; +#endif } else if (usb_extra_state == USB_EXTRA_STATE_DISABLED_UNTIL_REPLUG) CDC_print("USB: Extra disabled until replug\r\n"); else CDC_print("USB: Extra state unknown\r\n"); From e5065e5080e017119b439188775b10018c491f59 Mon Sep 17 00:00:00 2001 From: Daniel Prilik Date: Wed, 3 Apr 2019 13:59:51 -0700 Subject: [PATCH 5/5] remove prilik keymap form PR --- .../massdrop/alt/keymaps/prilik/keymap.c | 137 ------------------ .../massdrop/alt/keymaps/prilik/rules.mk | 38 ----- 2 files changed, 175 deletions(-) delete mode 100644 keyboards/massdrop/alt/keymaps/prilik/keymap.c delete mode 100644 keyboards/massdrop/alt/keymaps/prilik/rules.mk diff --git a/keyboards/massdrop/alt/keymaps/prilik/keymap.c b/keyboards/massdrop/alt/keymaps/prilik/keymap.c deleted file mode 100644 index 5c847d995612..000000000000 --- a/keyboards/massdrop/alt/keymaps/prilik/keymap.c +++ /dev/null @@ -1,137 +0,0 @@ -#include QMK_KEYBOARD_H -#include "process_unicode.h" - -enum alt_keycodes { - U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active - U_T_AGCR, //USB Toggle Automatic GCR control - DBG_TOG, //DEBUG Toggle On / Off - DBG_MTRX, //DEBUG Toggle Matrix Prints - DBG_KBD, //DEBUG Toggle Keyboard Prints - DBG_MOU, //DEBUG Toggle Mouse Prints - MD_BOOT, //Restart into bootloader after hold timeout - - UC_HELP, // URL for QMK unicode help - UC_SHRG, // shrug - ¯\_(ツ)_/¯ -#define UC_BBB X(E_BBB) // dat B - 🅱️ -#define UC_100 X(E_100) // hundo - 💯 -#define UC_EYES X(E_EYES) // shifty eyes - 👀 -}; - -enum unicode_names { - E_BBB, - E_100, - E_EYES, -}; -const uint32_t PROGMEM unicode_map[] = { - [E_BBB] = 0x1F171, - [E_100] = 0x1F4AF, - [E_EYES] = 0x1F440, -}; - -enum alt_layers { - _QWERTY, - _ACTIONS, - _MEMES, -}; - -#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode -#define ___X___ XXXXXXX // KC_NO - -keymap_config_t keymap_config; - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_QWERTY] = LAYOUT( - KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, \ - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_HOME, \ - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, \ - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, \ - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT \ - ), - [_ACTIONS] = LAYOUT( - KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MUTE, \ - _______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \ - _______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, \ - _______, RGB_TOG, _______, _______, _______, MD_BOOT, TG_NKRO, DBG_TOG, KC_MPRV, KC_MNXT, KC_MPLY, _______, _______, KC_VOLD, \ - _______, _______, _______, KC_MPLY, MO(2), _______, _______, _______, _______ \ - ), - [_MEMES] = LAYOUT( - ___X___, UC_100, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, \ - ___X___, ___X___, ___X___, UC_EYES, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, \ - ___X___, ___X___, UC_SHRG, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, \ - ___X___, ___X___, ___X___, ___X___, ___X___, UC_BBB, ___X___, ___X___, ___X___, ___X___, UC_HELP, ___X___, ___X___, ___X___, \ - UC_M_OS, UC_M_WC, UC_M_LN, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___ \ - ), - /* - [X] = LAYOUT( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______ \ - ), - */ -}; - -#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT)) -#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL)) -#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT)) - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - static uint32_t key_timer; - - switch (keycode) { - case UC_HELP: - if (record->event.pressed) { - SEND_STRING("https://beta.docs.qmk.fm/features/feature_unicode#input-modes" SS_TAP(X_ENTER)); - } - return false; - case UC_SHRG: // ¯\_(ツ)_/¯ - if (record->event.pressed) { - send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF"); - } - return false; - - /* Massdrop debug */ - case U_T_AUTO: - if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { - TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode"); - } - return false; - case U_T_AGCR: - if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { - TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode"); - } - return false; - case DBG_TOG: - if (record->event.pressed) { - TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode"); - } - return false; - case DBG_MTRX: - if (record->event.pressed) { - TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix"); - } - return false; - case DBG_KBD: - if (record->event.pressed) { - TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard"); - } - return false; - case DBG_MOU: - if (record->event.pressed) { - TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse"); - } - return false; - case MD_BOOT: - if (record->event.pressed) { - key_timer = timer_read32(); - } else { - if (timer_elapsed32(key_timer) >= 500) { - reset_keyboard(); - } - } - return false; - default: - return true; //Process all other keycodes normally - } -} diff --git a/keyboards/massdrop/alt/keymaps/prilik/rules.mk b/keyboards/massdrop/alt/keymaps/prilik/rules.mk deleted file mode 100644 index cf42a8acf900..000000000000 --- a/keyboards/massdrop/alt/keymaps/prilik/rules.mk +++ /dev/null @@ -1,38 +0,0 @@ -# project specific files -SRC = matrix.c -SRC += config_led.c - -#For platform and packs -ARM_ATSAM = SAMD51J18A -MCU = cortex-m4 - -CUSTOM_MATRIX = yes - -# Build Options -# comment out to disable the options. -# -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = no # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = no # Console for debug(+400) -COMMAND_ENABLE = no # Commands for debug and configuration -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -NKRO_ENABLE = yes # USB Nkey Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) -BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -AUDIO_ENABLE = no # Audio output on port C6 -FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches -HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) -VIRTSER_ENABLE = no # USB Serial Driver -RAW_ENABLE = no # Raw device -AUTO_SHIFT_ENABLE = no # Auto Shift - -# Unicode -UNICODEMAP_ENABLE = yes - -# Custom RGB matrix handling -RGB_MATRIX_ENABLE = custom