From f2bc70a2643bd158eb9910c61b682dafab83d41d Mon Sep 17 00:00:00 2001 From: Kenneth Aloysius Date: Tue, 24 Jul 2018 02:11:56 +0700 Subject: [PATCH] ps2avrgb: fix incorrect avr ports specified (for numlock and capslock LEDs) (#3453) * Add M6-A keymap * Update XD60 keymap * Update XD60 keymap readme * Update JJ40 and Let's Split keymaps * Add readme for M6-A * Fix typo, update JJ40 README * Update jj40 readme * Cleanup jj40 keymap * Revert Let's Split QWERTY layer to default before #2010 * Update numpad layers * Fix: Let's Split keymap getting stuck mods due to having keycodes assigned on the Raise layer * Keep ASCII art consistent with keymap * Staryu: initial port * Add personal keymap * Added and updated READMEs * Fix: default keymap for staryu * Rudimentary backlight support. * Enabled mousekeys for default keymap * use QMK_KEYBOARD_H and LAYOUT * Update readme.md for NIU mini: flash using avrdude * Fix missing linebreaks for Staryu README * Update readme.md * Update PS2AVRGB boards with new matrix.c * Update canoe matrix.c; untested * Fix canoe.c for building (needs matrix_scan_user and matrix_init_user) * Add personal Iris keymap * Update keymap * Update keymap * Update keymap, disable backlighting and underglow * Move PrintScreen button * Add README * Update personal keymaps * Add INS key * Limit USB max power consumption, change Fn to MENU * Remove Numpad layer (easy to accidentally toggle) * Fix backlighting for ps2avrgb * Update comments to refer to actual pin naming * Possible fix for xyverz ortho keymap: define RGBLED_NUM * Make led_set_user in backlight.c overridable * Add changes to address points raised in code review, untested (don't have build env right now) --- keyboards/dz60/keymaps/krusli/config.h | 2 ++ keyboards/dz60/keymaps/krusli/keymap.c | 29 ++++++++++++++++ keyboards/dz60/keymaps/krusli/rules.mk | 15 +++++++++ keyboards/jj40/backlight.c | 9 ++--- keyboards/jj40/keymaps/krusli/keymap.c | 35 +++----------------- keyboards/jj40/keymaps/krusli/numpad.txt | 17 ++++++++++ keyboards/jj40/keymaps/oscillope/backlight.c | 9 ++--- keyboards/jj50/backlight.c | 9 ++--- keyboards/staryu/keymaps/krusli/keymap.c | 2 +- keyboards/ymd75/backlight.c | 5 +-- keyboards/ymd96/backlight.c | 5 +-- keyboards/ymdk_np21/backlight.c | 9 ++--- layouts/community/ortho_4x12/xyverz/config.h | 3 ++ 13 files changed, 97 insertions(+), 52 deletions(-) create mode 100644 keyboards/dz60/keymaps/krusli/config.h create mode 100644 keyboards/dz60/keymaps/krusli/keymap.c create mode 100644 keyboards/dz60/keymaps/krusli/rules.mk create mode 100644 keyboards/jj40/keymaps/krusli/numpad.txt diff --git a/keyboards/dz60/keymaps/krusli/config.h b/keyboards/dz60/keymaps/krusli/config.h new file mode 100644 index 000000000..e8cb446e2 --- /dev/null +++ b/keyboards/dz60/keymaps/krusli/config.h @@ -0,0 +1,2 @@ +#pragma once +#define USB_MAX_POWER_CONSUMPTION 100 diff --git a/keyboards/dz60/keymaps/krusli/keymap.c b/keyboards/dz60/keymaps/krusli/keymap.c new file mode 100644 index 000000000..c79cb7f91 --- /dev/null +++ b/keyboards/dz60/keymaps/krusli/keymap.c @@ -0,0 +1,29 @@ +#include QMK_KEYBOARD_H + +#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) +#define _______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + 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_BSLS, KC_GRV, + 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_BSPC, + KC_LCTL, 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_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1), + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RGUI, KC_RALT, KC_APP, KC_APP, KC_RCTL), + + 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_INS, KC_DEL, + KC_CAPS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_VAD, RGB_VAI, RGB_SAD, RGB_SAI, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______, RESET, + _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, + _______, KC_NO, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) +}; + +void led_set_user(uint8_t usb_led) { + if (usb_led & (1 << USB_LED_CAPS_LOCK)) { + DDRB |= (1 << 2); PORTB &= ~(1 << 2); + } else { + DDRB &= ~(1 << 2); PORTB &= ~(1 << 2); + } +} diff --git a/keyboards/dz60/keymaps/krusli/rules.mk b/keyboards/dz60/keymaps/krusli/rules.mk new file mode 100644 index 000000000..3138a24b6 --- /dev/null +++ b/keyboards/dz60/keymaps/krusli/rules.mk @@ -0,0 +1,15 @@ +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # 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 +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +AUDIO_ENABLE = no +RGBLIGHT_ENABLE = yes + +LAYOUTS = 60_ansi diff --git a/keyboards/jj40/backlight.c b/keyboards/jj40/backlight.c index 079c410ff..fbd241fa9 100644 --- a/keyboards/jj40/backlight.c +++ b/keyboards/jj40/backlight.c @@ -17,10 +17,10 @@ #include // Port D: digital pins of the AVR chipset -#define NUMLOCK_PORT (1 << 1) // 1st pin of Port D (digital) -#define CAPSLOCK_PORT (1 << 2) // 2nd pin -#define BACKLIGHT_PORT (1 << 4) // 4th pin -#define SCROLLLOCK_PORT (1 << 6) // 6th pin +#define NUMLOCK_PORT (1 << 0) // D0 +#define CAPSLOCK_PORT (1 << 1) // D1 +#define BACKLIGHT_PORT (1 << 4) // D4 +#define SCROLLLOCK_PORT (1 << 6) // D6 #define TIMER_CLK_DIV64 0x03 ///< Timer clocked at F_CPU/64 #define TIMER1PRESCALE TIMER_CLK_DIV64 ///< timer 1 prescaler default @@ -43,6 +43,7 @@ extern backlight_config_t backlight_config; // @Override // turn LEDs on and off depending on USB caps/num/scroll lock states. +__attribute__ ((weak)) void led_set_user(uint8_t usb_led) { if (usb_led & (1 << USB_LED_NUM_LOCK)) { // turn on diff --git a/keyboards/jj40/keymaps/krusli/keymap.c b/keyboards/jj40/keymaps/krusli/keymap.c index 73dd0b287..6fea9d314 100644 --- a/keyboards/jj40/keymaps/krusli/keymap.c +++ b/keyboards/jj40/keymaps/krusli/keymap.c @@ -3,7 +3,6 @@ #define _QWERTY 0 #define _LOWER 1 #define _RAISE 2 -#define _NUMPAD 3 enum custom_keycodes { QWERTY = SAFE_RANGE, @@ -15,14 +14,6 @@ void matrix_scan_user(void) { // runs at every matrix scan. } -// enum { -// TD_H_E = 0 -// }; -// -// qk_tap_dance_action_t tap_dance_actions[] = { -// [TD_H_E] = ACTION_TAP_DANCE_DOUBLE(KC_HOME, KC_END) -// }; - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Qwerty * ,-----------------------------------------------------------------------------------. @@ -36,10 +27,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_QWERTY] = LAYOUT_2U_space( \ - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ - KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ - TO(_NUMPAD),KC_LCTL, KC_LGUI, KC_LALT, MO(_LOWER), KC_SPC, MO(_RAISE), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ + _______, KC_LCTL, KC_LGUI, KC_LALT, MO(_LOWER), KC_SPC, MO(_RAISE), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ ), /* Lower @@ -76,23 +67,5 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_HOME, KC_END, KC_PGUP, KC_PGDN, _______, \ _______, KC_MRWD, KC_MPLY, KC_MNXT, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ - ), - - /* Numpad - * ,-----------------------------------------------------------------------------------. - * | Esc | 7 | 8 | 9 | * | / | | | | | | | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | <-- | 4 | 5 | 6 | + | - | | | | | | | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | 1 | 2 | 3 |Enter |Enter | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |Qwerty| 0 | . | . |Enter |Enter | | | | | | - * `-----------------------------------------------------------------------------------' - */ - [_NUMPAD] = LAYOUT_2U_space( \ - KC_ESC, KC_P7, KC_P8, KC_P9, KC_PAST, KC_PSLS, _______, _______, _______, _______, _______, _______, \ - KC_BSPC, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_PMNS, _______, _______, _______, _______, _______, _______, \ - _______, KC_P1, KC_P2, KC_P3, KC_PENT, KC_PENT, _______, _______, _______, _______, _______, _______, \ - TO(_QWERTY),KC_P0, KC_PDOT, KC_PDOT, KC_PENT, _______, _______, _______, _______, _______, _______ \ ) }; diff --git a/keyboards/jj40/keymaps/krusli/numpad.txt b/keyboards/jj40/keymaps/krusli/numpad.txt new file mode 100644 index 000000000..8fbdc1829 --- /dev/null +++ b/keyboards/jj40/keymaps/krusli/numpad.txt @@ -0,0 +1,17 @@ +/* Numpad + * ,-----------------------------------------------------------------------------------. + * | Esc | 7 | 8 | 9 | * | / | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | <-- | 4 | 5 | 6 | + | - | | | | | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | 1 | 2 | 3 |Enter |Enter | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Qwerty| 0 | . | . |Enter |Enter | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_NUMPAD] = LAYOUT_2U_space( \ + KC_ESC, KC_P7, KC_P8, KC_P9, KC_PAST, KC_PSLS, _______, _______, _______, _______, _______, _______, \ + KC_BSPC, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_PMNS, _______, _______, _______, _______, _______, _______, \ + _______, KC_P1, KC_P2, KC_P3, KC_PENT, KC_PENT, _______, _______, _______, _______, _______, _______, \ + TO(_QWERTY),KC_P0, KC_PDOT, KC_PDOT, KC_PENT, _______, _______, _______, _______, _______, _______ \ +) diff --git a/keyboards/jj40/keymaps/oscillope/backlight.c b/keyboards/jj40/keymaps/oscillope/backlight.c index a4cb66e0c..14c677cd6 100644 --- a/keyboards/jj40/keymaps/oscillope/backlight.c +++ b/keyboards/jj40/keymaps/oscillope/backlight.c @@ -9,10 +9,10 @@ #include // Port D: digital pins of the AVR chipset -#define NUMLOCK_PORT (1 << 1) // 1st pin of Port D (digital) -#define CAPSLOCK_PORT (1 << 2) // 2nd pin -#define BACKLIGHT_PORT (1 << 4) // 4th pin -#define SCROLLLOCK_PORT (1 << 6) // 6th pin +#define NUMLOCK_PORT (1 << 0) // D0 +#define CAPSLOCK_PORT (1 << 1) // D1 +#define BACKLIGHT_PORT (1 << 4) // D4 +#define SCROLLLOCK_PORT (1 << 6) // D6 /** * References @@ -25,6 +25,7 @@ // @Override // turn LEDs on and off depending on USB caps/num/scroll lock states. +__attribute__ ((weak)) void led_set_user(uint8_t usb_led) { /* It appears that these cause the v1 JJ40 PCB to hang. * I haven't looked into why, but I don't have any LEDs on my board anyway. */ diff --git a/keyboards/jj50/backlight.c b/keyboards/jj50/backlight.c index 079c410ff..fbd241fa9 100644 --- a/keyboards/jj50/backlight.c +++ b/keyboards/jj50/backlight.c @@ -17,10 +17,10 @@ #include // Port D: digital pins of the AVR chipset -#define NUMLOCK_PORT (1 << 1) // 1st pin of Port D (digital) -#define CAPSLOCK_PORT (1 << 2) // 2nd pin -#define BACKLIGHT_PORT (1 << 4) // 4th pin -#define SCROLLLOCK_PORT (1 << 6) // 6th pin +#define NUMLOCK_PORT (1 << 0) // D0 +#define CAPSLOCK_PORT (1 << 1) // D1 +#define BACKLIGHT_PORT (1 << 4) // D4 +#define SCROLLLOCK_PORT (1 << 6) // D6 #define TIMER_CLK_DIV64 0x03 ///< Timer clocked at F_CPU/64 #define TIMER1PRESCALE TIMER_CLK_DIV64 ///< timer 1 prescaler default @@ -43,6 +43,7 @@ extern backlight_config_t backlight_config; // @Override // turn LEDs on and off depending on USB caps/num/scroll lock states. +__attribute__ ((weak)) void led_set_user(uint8_t usb_led) { if (usb_led & (1 << USB_LED_NUM_LOCK)) { // turn on diff --git a/keyboards/staryu/keymaps/krusli/keymap.c b/keyboards/staryu/keymaps/krusli/keymap.c index 2879b68e5..c0fcd00d5 100644 --- a/keyboards/staryu/keymaps/krusli/keymap.c +++ b/keyboards/staryu/keymaps/krusli/keymap.c @@ -64,7 +64,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_LAYER0] = LAYOUT( \ KC_ESC, TO(_LAYER1), \ - KC_Z, KC_X, KC_SPACE \ + KC_Z, KC_X, KC_ENT \ ), [_LAYER1] = LAYOUT( \ MUTE, TO(_LAYER2), \ diff --git a/keyboards/ymd75/backlight.c b/keyboards/ymd75/backlight.c index 1f5e19638..cb0a97923 100644 --- a/keyboards/ymd75/backlight.c +++ b/keyboards/ymd75/backlight.c @@ -20,8 +20,8 @@ // Port D: digital pins of the AVR chipset //#define NUMLOCK_PORT (1 << 2) // 2nd pin of Port D (digital) #define CAPSLOCK_PORT (1 << 1) // 1st pin -#define BACKLIGHT_PORT (1 << 4) // 4th pin -//#define SCROLLLOCK_PORT (1 << 6) // 6th pin +#define BACKLIGHT_PORT (1 << 4) // D4 +//#define SCROLLLOCK_PORT (1 << 6) // D6 #define TIMER_CLK_DIV64 0x03 ///< Timer clocked at F_CPU/64 #define TIMER1PRESCALE TIMER_CLK_DIV64 ///< timer 1 prescaler default @@ -44,6 +44,7 @@ extern backlight_config_t backlight_config; // @Override // turn LEDs on and off depending on USB caps/num/scroll lock states. +__attribute__ ((weak)) void led_set_user(uint8_t usb_led) { /* if (usb_led & (1 << USB_LED_NUM_LOCK)) { diff --git a/keyboards/ymd96/backlight.c b/keyboards/ymd96/backlight.c index 36c556387..f3f2b7a05 100644 --- a/keyboards/ymd96/backlight.c +++ b/keyboards/ymd96/backlight.c @@ -19,8 +19,8 @@ // Port D: digital pins of the AVR chipset #define NUMLOCK_PORT (1 << 0) // 0th pin of Port D (digital) #define CAPSLOCK_PORT (1 << 1) // 1st pin -#define BACKLIGHT_PORT (1 << 4) // 4th pin -//#define SCROLLLOCK_PORT (1 << 6) // 6th pin +#define BACKLIGHT_PORT (1 << 4) // D4 +//#define SCROLLLOCK_PORT (1 << 6) // D6 #define TIMER_CLK_DIV64 0x03 ///< Timer clocked at F_CPU/64 #define TIMER1PRESCALE TIMER_CLK_DIV64 ///< timer 1 prescaler default @@ -43,6 +43,7 @@ extern backlight_config_t backlight_config; // @Override // turn LEDs on and off depending on USB caps/num/scroll lock states. +__attribute__ ((weak)) void led_set_user(uint8_t usb_led) { if (usb_led & (1 << USB_LED_NUM_LOCK)) { // turn on diff --git a/keyboards/ymdk_np21/backlight.c b/keyboards/ymdk_np21/backlight.c index 079c410ff..fbd241fa9 100644 --- a/keyboards/ymdk_np21/backlight.c +++ b/keyboards/ymdk_np21/backlight.c @@ -17,10 +17,10 @@ #include // Port D: digital pins of the AVR chipset -#define NUMLOCK_PORT (1 << 1) // 1st pin of Port D (digital) -#define CAPSLOCK_PORT (1 << 2) // 2nd pin -#define BACKLIGHT_PORT (1 << 4) // 4th pin -#define SCROLLLOCK_PORT (1 << 6) // 6th pin +#define NUMLOCK_PORT (1 << 0) // D0 +#define CAPSLOCK_PORT (1 << 1) // D1 +#define BACKLIGHT_PORT (1 << 4) // D4 +#define SCROLLLOCK_PORT (1 << 6) // D6 #define TIMER_CLK_DIV64 0x03 ///< Timer clocked at F_CPU/64 #define TIMER1PRESCALE TIMER_CLK_DIV64 ///< timer 1 prescaler default @@ -43,6 +43,7 @@ extern backlight_config_t backlight_config; // @Override // turn LEDs on and off depending on USB caps/num/scroll lock states. +__attribute__ ((weak)) void led_set_user(uint8_t usb_led) { if (usb_led & (1 << USB_LED_NUM_LOCK)) { // turn on diff --git a/layouts/community/ortho_4x12/xyverz/config.h b/layouts/community/ortho_4x12/xyverz/config.h index 1292911f2..ec32e71ce 100644 --- a/layouts/community/ortho_4x12/xyverz/config.h +++ b/layouts/community/ortho_4x12/xyverz/config.h @@ -18,6 +18,9 @@ #ifdef KEYBOARD_lets_split_rev2 #define RGBLED_NUM 8 #endif +#ifdef KEYBOARD_jj40 + #define RGBLED_NUM 5 +#endif #define RGBLIGHT_ANIMATIONS #define RGBLIGHT_HUE_STEP 8