From 8bdbac14a36f8da5da3175006cff5eb3a3d60c1d Mon Sep 17 00:00:00 2001 From: roguepullrequest Date: Wed, 17 Apr 2019 20:39:50 -0500 Subject: [PATCH 01/61] [Keymap] Roguepullrequest Planck layout update (#5640) * First publish of roguepullreqest programmer dvorak planck layout * Removed junk line * Update keyboards/planck/keymaps/roguepullrequest/keymap.c Co-Authored-By: roguepullrequest * Update keyboards/planck/keymaps/roguepullrequest/keymap.c Co-Authored-By: roguepullrequest * Update keyboards/planck/keymaps/roguepullrequest/keymap.c Co-Authored-By: roguepullrequest * Update keyboards/planck/keymaps/roguepullrequest/keymap.c Co-Authored-By: roguepullrequest * Removed layer songs Removed layer songs for cleanliness. Will use them later. * Update keyboards/planck/keymaps/roguepullrequest/readme.md Co-Authored-By: roguepullrequest * Made basic LSHIFT framework but is not working. Listed other tapdances. * Got LSHIFT to work * Added working RSHIFT * Added working TD_S * Cleaned up LEFT and RIGHT [ { ] } on the UPPER layer. * Cleaned up layout. * Reenabled audio space is not needed right now. --- .../planck/keymaps/roguepullrequest/keymap.c | 87 ++++++++++++++++--- 1 file changed, 77 insertions(+), 10 deletions(-) diff --git a/keyboards/planck/keymaps/roguepullrequest/keymap.c b/keyboards/planck/keymaps/roguepullrequest/keymap.c index 64d9cfb2b7..51c740dc4b 100644 --- a/keyboards/planck/keymaps/roguepullrequest/keymap.c +++ b/keyboards/planck/keymaps/roguepullrequest/keymap.c @@ -24,14 +24,18 @@ enum { // Tap dance enums enum { X_AT_FUN = 0, - SH_M_LPAREN, - SH_M_RPAREN + RSHIFT, + LSHIFT, + TD_S }; int cur_dance (qk_tap_dance_state_t *state); void x_finished (qk_tap_dance_state_t *state, void *user_data); void x_reset (qk_tap_dance_state_t *state, void *user_data); +void lshift_finished (qk_tap_dance_state_t *state, void *user_data); +void lshift_reset(qk_tap_dance_state_t *state, void *user_data); + bool is_alt_tab_active = false; uint16_t alt_tab_timer = 0; @@ -102,17 +106,18 @@ void matrix_scan_user(void) { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -/* Programmer Dvorak */ + + /* Programmer Dvorak */ [_PDVORAK] = LAYOUT_planck_grid( - KC_GESC, KC_SCOLON, KC_COMMA, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, - KC_LAST, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLASH, - KC_LSPO, KC_QUOT, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSPC, - TD(X_AT_FUN), KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, ALT_TAB, KC_SPACE, KC_ENTER, MT(MOD_LCTL | MOD_LSFT, KC_LGUI), KC_PGUP, KC_PGDN, LT(_LOWER, KC_PLUS) + KC_GESC, KC_SCOLON, KC_COMMA, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, + KC_LAST, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, TD(TD_S), KC_SLASH, + TD(LSHIFT), KC_QUOT, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, TD(RSHIFT), + TD(X_AT_FUN), KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, ALT_TAB, KC_SPACE, KC_ENTER, MT(MOD_LCTL | MOD_LSFT, KC_LGUI), KC_PGUP, KC_PGDN, LT(_LOWER, KC_PLUS) ), [_UPPER] = LAYOUT_planck_grid( - KC_GRAVE, KC_AMPR, KC_PERC, KC_LBRC, KC_LCBR, KC_EQL, KC_ASTR, KC_RCBR, KC_RBRC, KC_EXLM, KC_HASH, KC_TRNS, - KC_PLUS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MINUS, KC_BSLASH, + KC_GRAVE, KC_AMPR, KC_PERC, KC_NO, KC_NO, KC_EQL, KC_ASTR, KC_NO, KC_NO, KC_EXLM, KC_HASH, KC_TRNS, + KC_PLUS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BSLASH, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS ), @@ -145,6 +150,10 @@ int cur_dance (qk_tap_dance_state_t *state) { if (state->interrupted || !state->pressed) return DOUBLE_TAP; else return DOUBLE_HOLD; } + else if (state->count == 3) { + if (state->interrupted || !state->pressed)return TRIPLE_TAP; + else return TRIPLE_HOLD; + } else return 8; // magic number that i dont believe works. } @@ -164,6 +173,35 @@ void x_finished (qk_tap_dance_state_t *state, void *user_data) { case DOUBLE_HOLD: reset_keyboard(); break; } } + +void lshift_finished (qk_tap_dance_state_t *state, void *user_data) { + xtap_state.state = cur_dance(state); + switch (xtap_state.state) { + case SINGLE_TAP: register_code16(KC_LSFT); register_code16(KC_9); break; + case SINGLE_HOLD: register_code16(KC_LSFT); break; + case DOUBLE_TAP: register_code16(KC_LBRC); break; + case TRIPLE_TAP: register_code16(KC_LSFT); register_code16(KC_LBRC); break; + } +} +void s_finished (qk_tap_dance_state_t *state, void *user_data) { + xtap_state.state = cur_dance(state); + switch (xtap_state.state) { + case SINGLE_TAP: register_code16(KC_S); break; + case DOUBLE_TAP: register_code16(KC_MINUS); break; + case TRIPLE_TAP: register_code16(KC_LSFT); register_code16(KC_MINUS); break; + } +} + +void rshift_finished (qk_tap_dance_state_t *state, void *user_data) { + xtap_state.state = cur_dance(state); + switch (xtap_state.state) { + case SINGLE_TAP: register_code16(KC_LSFT); register_code16(KC_0); break; + case SINGLE_HOLD: register_code16(KC_RSFT); break; + case DOUBLE_TAP: register_code16(KC_RBRC); break; + case TRIPLE_TAP: register_code16(KC_LSFT); register_code16(KC_RBRC); break; + } +} + // forgetting keypresses void x_reset (qk_tap_dance_state_t *state, void *user_data) { @@ -175,9 +213,38 @@ void x_reset (qk_tap_dance_state_t *state, void *user_data) { } xtap_state.state = 0; } +void lshift_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (xtap_state.state) { + case SINGLE_TAP: unregister_code16(KC_9); unregister_code16(KC_LSFT); break; + case SINGLE_HOLD: unregister_code16(KC_LSFT); break; + case DOUBLE_TAP: unregister_code16(KC_LBRC); break; + case TRIPLE_TAP: unregister_code16(KC_LBRC); unregister_code16(KC_LSFT); break; + } + xtap_state.state = 0; +} +void rshift_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (xtap_state.state) { + case SINGLE_TAP: unregister_code16(KC_0); unregister_code16(KC_LSFT); break; + case SINGLE_HOLD: unregister_code16(KC_RSFT); break; + case DOUBLE_TAP: unregister_code16(KC_RBRC); break; + case TRIPLE_TAP: unregister_code16(KC_RBRC); unregister_code16(KC_LSFT); break; + } + xtap_state.state = 0; +} +void s_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (xtap_state.state) { + case SINGLE_TAP: unregister_code16(KC_S); break; + case DOUBLE_TAP: unregister_code16(KC_MINUS); break; + case TRIPLE_TAP: unregister_code16(KC_MINUS); unregister_code16(KC_LSFT); break; + } + xtap_state.state = 0; +} qk_tap_dance_action_t tap_dance_actions[] = { - [X_AT_FUN] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, x_finished, x_reset) + [X_AT_FUN] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, x_finished, x_reset), + [LSHIFT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, lshift_finished, lshift_reset), + [RSHIFT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, rshift_finished, rshift_reset), + [TD_S] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, s_finished, s_reset), }; void shutdown_user(void) { clear_keyboard(); } From 34239edcb043fe03f8e547ea94bac7b8ff07657c Mon Sep 17 00:00:00 2001 From: Florian Didron Date: Thu, 18 Apr 2019 10:49:13 +0900 Subject: [PATCH 02/61] Set default debounce to 5 --- keyboards/ergodox_ez/config.h | 1 - 1 file changed, 1 deletion(-) diff --git a/keyboards/ergodox_ez/config.h b/keyboards/ergodox_ez/config.h index a75edd4154..cbf7f8aaa2 100644 --- a/keyboards/ergodox_ez/config.h +++ b/keyboards/ergodox_ez/config.h @@ -98,7 +98,6 @@ along with this program. If not, see . * 5, which is now closer to 10ms, but still plenty according to * manufacturer specs. */ -#define DEBOUNCE 10 #define USB_MAX_POWER_CONSUMPTION 500 From 3542f594d9d6f81edf1de3ead435d19803d83092 Mon Sep 17 00:00:00 2001 From: patrickmt <40182064+patrickmt@users.noreply.github.com> Date: Thu, 18 Apr 2019 09:35:50 -0400 Subject: [PATCH 03/61] Fix wake from suspend LED functionality When waking from suspend, only enable the LED drivers if they were not previously set to disabled by the user. This functionality was removed by the recent updates to adapt Massdrop keyboards to QMK RGB Matrix. Affects Massdrop CTRL and ALT keyboards compiled using Massdrop Configurator mode. --- tmk_core/common/arm_atsam/suspend.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tmk_core/common/arm_atsam/suspend.c b/tmk_core/common/arm_atsam/suspend.c index 9c2c47d561..ecf8f0ed18 100644 --- a/tmk_core/common/arm_atsam/suspend.c +++ b/tmk_core/common/arm_atsam/suspend.c @@ -78,7 +78,13 @@ void suspend_wakeup_init_kb(void) { */ void suspend_wakeup_init(void) { #ifdef RGB_MATRIX_ENABLE +#ifdef USE_MASSDROP_CONFIGURATOR + if (led_enabled) { + I2C3733_Control_Set(1); + } +#else I2C3733_Control_Set(1); +#endif #endif suspend_wakeup_init_kb(); From 162a1d39b6ece786d31b934db3fb1b5721c05568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Wilhelmsen?= <46304257+oeywil@users.noreply.github.com> Date: Thu, 18 Apr 2019 22:27:05 +0200 Subject: [PATCH 04/61] Update readme.md (#5647) --- keyboards/planck/keymaps/oeywil/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/planck/keymaps/oeywil/readme.md b/keyboards/planck/keymaps/oeywil/readme.md index 5587b4b913..364f9422c7 100644 --- a/keyboards/planck/keymaps/oeywil/readme.md +++ b/keyboards/planck/keymaps/oeywil/readme.md @@ -1,4 +1,4 @@ About ------ -A simple Norwegian grid layout using Leader Key, Space Cadet Shift and audio. +A simple Norwegian grid layout using Leader Key, Tap Dance and audio. From a58c66df88d1da9c57e5e4ccffb78c7882b55706 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Thu, 18 Apr 2019 14:02:32 -0700 Subject: [PATCH 05/61] Reduce CRKBD firmware size by reducing layer numbers (#5471) * Reduce CRKBD firmware size by reducing layer numbers * Update layer output code based on mtei's suggestion/code * Fix spacing * Revert "Update layer output code based on mtei's suggestion/code" This reverts commit 036d347db309170afd5676e694adfda69f912615. Unfortunately, because this is NOT in the keymap itself, the layer macros aren't accessible and will error on commit * Add comment for future person --- keyboards/crkbd/keymaps/default/keymap.c | 7 +++---- keyboards/crkbd/keymaps/omgvee/keymap.c | 7 +++---- keyboards/crkbd/keymaps/thefrey/keymap.c | 7 +++---- keyboards/crkbd/lib/layer_state_reader.c | 9 +++++---- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/keyboards/crkbd/keymaps/default/keymap.c b/keyboards/crkbd/keymaps/default/keymap.c index 1e2e57a2b4..5bb89d2594 100644 --- a/keyboards/crkbd/keymaps/default/keymap.c +++ b/keyboards/crkbd/keymaps/default/keymap.c @@ -22,9 +22,9 @@ extern uint8_t is_master; // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. #define _QWERTY 0 -#define _LOWER 3 -#define _RAISE 4 -#define _ADJUST 16 +#define _LOWER 1 +#define _RAISE 2 +#define _ADJUST 3 enum custom_keycodes { QWERTY = SAFE_RANGE, @@ -246,4 +246,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - diff --git a/keyboards/crkbd/keymaps/omgvee/keymap.c b/keyboards/crkbd/keymaps/omgvee/keymap.c index 2f79250f81..2c33d8b8c5 100644 --- a/keyboards/crkbd/keymaps/omgvee/keymap.c +++ b/keyboards/crkbd/keymaps/omgvee/keymap.c @@ -22,9 +22,9 @@ extern uint8_t is_master; // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. #define _QWERTY 0 -#define _LOWER 3 -#define _RAISE 4 -#define _ADJUST 16 +#define _LOWER 1 +#define _RAISE 2 +#define _ADJUST 3 enum custom_keycodes { QWERTY = SAFE_RANGE, @@ -240,4 +240,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - diff --git a/keyboards/crkbd/keymaps/thefrey/keymap.c b/keyboards/crkbd/keymaps/thefrey/keymap.c index 5077bfc87c..9a142a924a 100644 --- a/keyboards/crkbd/keymaps/thefrey/keymap.c +++ b/keyboards/crkbd/keymaps/thefrey/keymap.c @@ -22,9 +22,9 @@ extern uint8_t is_master; // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. #define _QWERTY 0 -#define _LOWER 3 -#define _RAISE 4 -#define _ADJUST 16 +#define _LOWER 1 +#define _RAISE 2 +#define _ADJUST 3 enum custom_keycodes { QWERTY = SAFE_RANGE, @@ -241,4 +241,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - diff --git a/keyboards/crkbd/lib/layer_state_reader.c b/keyboards/crkbd/lib/layer_state_reader.c index eddb71337e..63d80b136c 100644 --- a/keyboards/crkbd/lib/layer_state_reader.c +++ b/keyboards/crkbd/lib/layer_state_reader.c @@ -3,11 +3,12 @@ #include #include "crkbd.h" +// in the future, should use (1U<<_LAYER_NAME) instead, but needs to be moved to keymap,c #define L_BASE 0 -#define L_LOWER 8 -#define L_RAISE 16 -#define L_ADJUST 65536 -#define L_ADJUST_TRI 65560 +#define L_LOWER 2 +#define L_RAISE 4 +#define L_ADJUST 8 +#define L_ADJUST_TRI 14 char layer_state_str[24]; From 9e3b38425feedbe8d95c6cb738d713cc6e15af56 Mon Sep 17 00:00:00 2001 From: YouCanFly <65446+YCF@users.noreply.github.com> Date: Thu, 18 Apr 2019 17:37:26 -0500 Subject: [PATCH 06/61] [Keyboard] Update Tetris (#5513) * Update Tetris Add a fake row to config the encoder's keycode easily. * Delete rules.mk * Update keyboards/tetris/readme.md Co-Authored-By: YCF <65446+YCF@users.noreply.github.com> * Update config.h add #define RGBLIGHT_SLEEP --- keyboards/tetris/config.h | 22 +- keyboards/tetris/info.json | 6 +- keyboards/tetris/keymaps/default/keymap.c | 950 ++++------------------ keyboards/tetris/keymaps/default/rules.mk | 1 - keyboards/tetris/readme.md | 4 +- keyboards/tetris/rules.mk | 13 +- keyboards/tetris/tetris.c | 2 +- keyboards/tetris/tetris.h | 8 +- 8 files changed, 182 insertions(+), 824 deletions(-) mode change 100644 => 100755 keyboards/tetris/config.h mode change 100644 => 100755 keyboards/tetris/keymaps/default/keymap.c delete mode 100644 keyboards/tetris/keymaps/default/rules.mk mode change 100644 => 100755 keyboards/tetris/rules.mk mode change 100644 => 100755 keyboards/tetris/tetris.c mode change 100644 => 100755 keyboards/tetris/tetris.h diff --git a/keyboards/tetris/config.h b/keyboards/tetris/config.h old mode 100644 new mode 100755 index 20ec2e655a..2cc7d2951d --- a/keyboards/tetris/config.h +++ b/keyboards/tetris/config.h @@ -10,17 +10,12 @@ #define PRODUCT Tetris #define DESCRIPTION Planck mit -#define QMK_ESC_OUTPUT B0 -#define QMK_ESC_INPUT D7 -#define QMK_LED B7 -#define QMK_SPEAKER B5 - /* key matrix size */ -#define MATRIX_ROWS 4 +#define MATRIX_ROWS 5 #define MATRIX_COLS 12 /* key matrix pins */ -#define MATRIX_ROW_PINS { B3, B2, B1, B0 } +#define MATRIX_ROW_PINS { B3, B2, B1, B0, E6 } #define MATRIX_COL_PINS { D7, B4, B6, C6, C7, F6, F7, D4, D2, D3, D5, D6 } #define UNUSED_PINS @@ -39,19 +34,22 @@ #define NO_ACTION_MACRO #define NO_ACTION_FUNCTION -#define TAPPING_TERM 200 - #ifdef AUDIO_ENABLE #define B5_AUDIO #define STARTUP_SONG SONG(ONE_UP_SOUND) #define NO_MUSIC_MODE #endif -#if RGBLIGHT_ENABLE +#define NUMBER_OF_ENCODERS 2 +#define ENCODERS_PAD_A { D1,F1 } +#define ENCODERS_PAD_B { D0,F0 } + #define RGB_DI_PIN F5 #define RGBLIGHT_ANIMATIONS #define RGBLIGHT_SLEEP #define RGBLED_NUM 47 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 #define RGBLIGHT_EFFECT_KNIGHT_LED_NUM 12 -//#define RGBLIGHT_LIMIT_VAL 128 -#endif + diff --git a/keyboards/tetris/info.json b/keyboards/tetris/info.json index b21a46d632..c58e9be52f 100644 --- a/keyboards/tetris/info.json +++ b/keyboards/tetris/info.json @@ -3,10 +3,10 @@ "url": "", "maintainer": "qmk", "width": 12, - "height": 4, + "height": 5, "layouts": { "LAYOUT_planck_mit": { - "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":6, "y":1}, {"x":7, "y":1}, {"x":8, "y":1}, {"x":9, "y":1}, {"x":10, "y":1}, {"x":11, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, {"x":5, "y":2}, {"x":6, "y":2}, {"x":7, "y":2}, {"x":8, "y":2}, {"x":9, "y":2}, {"x":10, "y":2}, {"x":11, "y":2}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, {"x":4, "y":3}, {"x":5, "y":3, "w":2}, {"x":7, "y":3}, {"x":8, "y":3}, {"x":9, "y":3}, {"x":10, "y":3}, {"x":11, "y":3}] + "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":6, "y":1}, {"x":7, "y":1}, {"x":8, "y":1}, {"x":9, "y":1}, {"x":10, "y":1}, {"x":11, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, {"x":5, "y":2}, {"x":6, "y":2}, {"x":7, "y":2}, {"x":8, "y":2}, {"x":9, "y":2}, {"x":10, "y":2}, {"x":11, "y":2}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, {"x":4, "y":3}, {"x":5, "y":3, "w":2}, {"x":7, "y":3}, {"x":8, "y":3}, {"x":9, "y":3}, {"x":10, "y":3}, {"x":11, "y":3}, {"x":0, "y":4}, {"x":1, "y":4}, {"x":10, "y":4}, {"x":11, "y":4}] + } } - } } diff --git a/keyboards/tetris/keymaps/default/keymap.c b/keyboards/tetris/keymaps/default/keymap.c old mode 100644 new mode 100755 index 0ec12435e7..c1b5ad2b1f --- a/keyboards/tetris/keymaps/default/keymap.c +++ b/keyboards/tetris/keymaps/default/keymap.c @@ -1,828 +1,186 @@ #include QMK_KEYBOARD_H -#ifdef AUDIO_ENABLE - float tone_caps[][2] = SONG( CAPS_LOCK_ON_SOUND ); - float tone_taps[][2] = SONG( E__NOTE( _A6 ) ); -#endif - -#define _BASE 0 -#define _CODE 1 -#define _NAVI 2 -#define _FUNC 3 -#define _SYMB 4 -#define _NUMB 5 -#define _MARO 6 -#define _RGB 7 -#define _ADJUST 8 -#define _GAME 9 - -/* RGB colors */ -#define RGB_Layer_1_Base_Color 0, 128, 0 -#define RGB_Layer_2_Base_Color 0,0,0 -#define RGB_Layer_3_Base_Color 0,0,0 -#define RGB_Layer_4_Base_Color 0,0,0 -#define RGB_Layer_5_Base_Color 0,0,0 -#define RGB_Layer_6_Base_Color 64, 0, 64 -#define RGB_Layer_7_Base_Color 0, 0,0 -#define RGB_Layer_8_Base_Color 0,0,0 -#define RGB_Layer_9_Base_Color 0,0,0 -#define RGB_Caps_Color 6,50,50 -#define RGB_TAP_On_Color 0,128,0 -#define RGB_TAP_Off_Color 128,0,0 -#define RGB_TAP_Base_Color 0,0,0 - -extern rgblight_config_t rgblight_config; -bool NUMLAY_STATUS = false; -int RGB_LAYER0_mode = 6; -bool RGB_TAP_STATE = false; -static uint8_t current_layer = 0; -static bool has_layer_changed = true; -static bool save_rgbmode = true; -static bool caps = false; - -/* Tap Dance function */ -void dance_cln_finished( qk_tap_dance_state_t* state, void* user_data ) -{ - if ( state->count == 1 ) - { - register_code( KC_LSFT ); - } else { - layer_on( _SYMB ); - #ifdef AUDIO_ENABLE - PLAY_SONG( tone_taps ); - #endif - } -} - - -void dance_cln_reset( qk_tap_dance_state_t* state, void* user_data ) -{ - if ( state->count == 1 ) - { - unregister_code( KC_LSFT ); - }else { - uint8_t layer = biton32( layer_state ); - if ( layer == _SYMB ) - { - layer_off( _SYMB ); - rgblight_mode( RGB_LAYER0_mode ); - } - } -} - -enum my_keycodes { - RGB_TAP = SAFE_RANGE, - KC_00 -}; - -/* Tap Dance Declarations */ -enum { - TD_Mute_Next = 0, - TD_SFT, - TD_LBRC, - TD_RBRC -}; - -/* Tap Dance Definitions */ -qk_tap_dance_action_t tap_dance_actions[] = { - [TD_Mute_Next] = ACTION_TAP_DANCE_DOUBLE( KC_MUTE, KC_MNXT ) - ,[TD_SFT] = ACTION_TAP_DANCE_FN_ADVANCED( NULL, dance_cln_finished, dance_cln_reset ) - ,[TD_LBRC] = ACTION_TAP_DANCE_DOUBLE( KC_LBRC, KC_LCBR ) - ,[TD_RBRC] = ACTION_TAP_DANCE_DOUBLE( KC_RBRC, KC_RCBR ) -}; - - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -/* BASE - QWERTY - * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | E | R | T | Y | U | I | O | P | BS | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * shift + Esc = ~ --> | Esc | A | S | D | F | G | H | J | K | L | ; | Enter| <-- shift + Enter = " - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / | Mute | - * |------+------+------+------+------+------+------+------+------+------+------+------| <-- tap: 1.Mute 2.Next - * | Ctrl | GUI | Alt | [ | - | Space | = | ] | Fx | \ | Del | - * `-----------------------------------------------------------------------------------' - */ - -[_BASE] = LAYOUT_planck_mit( - LT( _ADJUST,KC_TAB), KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, - LT( _NUMB,KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, LT( _RGB, KC_L ), KC_SCLN, KC_ENT, - TD( TD_SFT ), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, TD( TD_Mute_Next ), - KC_LCTL, KC_LGUI, KC_LALT, TD( TD_LBRC ), LT( _NAVI, KC_MINS ), LT( _CODE, KC_SPC ), LT( _FUNC, KC_EQL ), TD( TD_RBRC ), KC_LEFT, KC_DOWN, KC_RGHT ), - -/* Code - * ,-----------------------------------------------------------------------------------. - * | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | ` | < | [ | { | ( | & | Left | Down | Up | Down | ; | ' | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | > | ] | } | ) | | | | | , | . | / | Play | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | [ | BkSp | ======= | Del | ] | | \ | | - * `-----------------------------------------------------------------------------------' - */ - -[_CODE] = LAYOUT_planck_mit( /* 1 - Code */ - _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, - KC_GRV, KC_LABK, KC_LBRC, KC_LCBR, KC_LPRN, KC_AMPR, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, KC_QUOT, - _______, KC_RABK, KC_RBRC, KC_RCBR, KC_RPRN, KC_PIPE, XXXXXXX, XXXXXXX, _______, _______, KC_SLSH, KC_MPLY, - _______, _______, _______, KC_LBRC, KC_BSPC, _______, KC_DEL, KC_RBRC, _______, KC_BSLS, _______ ), - -/* Navi - * ,-----------------------------------------------------------------------------------. - * | | | | PgUp | | | | |Insert| |Prtsc | | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | ~ | | Home | PgDn | End | | | | |SrcLck| | | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | | | | | Break| | | | | PgUp | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | Home | PgDn | End | - * `-----------------------------------------------------------------------------------' - */ - -[_NAVI] = LAYOUT_planck_mit( - _______, XXXXXXX, XXXXXXX, KC_PGUP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, XXXXXXX, KC_PSCR, _______, - KC_TILD, XXXXXXX, KC_HOME, KC_PGDN, KC_END, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_SLCK, _______, _______, - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PAUS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PGUP, _______, - _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END ), - -/* Func - * ,-----------------------------------------------------------------------------------. - * | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | F11 | F12 | | | | | | | | | | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | | | | | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | - * `-----------------------------------------------------------------------------------' - */ - -[_FUNC] = LAYOUT_planck_mit( - _______ , KC_F1, KC_F2 , KC_F3, KC_F4, KC_F5, KC_F6 , KC_F7, KC_F8, KC_F9, KC_F10, _______, - _______ , KC_F12, KC_F12 , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, - _______ , XXXXXXX, XXXXXXX , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, - _______ , _______, _______ , _______, _______, _______, _______ , _______, _______, _______, _______ ), - - -/* Symb - double tap shift - * ,-----------------------------------------------------------------------------------. - * | | | ! | @ | # | $ | % | ^ | & | * | ( | ) | | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | | | | | | | | | : | " | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | | | | | | | | < | > | ? | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | { | _ | | + | } | | | | - * `-----------------------------------------------------------------------------------' - */ - -[_SYMB] = LAYOUT_planck_mit( - KC_PIPE, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, - KC_TILD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_COLN, KC_DQUO, - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LABK, KC_RABK, KC_QUES, _______, - _______, _______, _______, KC_LCBR, KC_UNDS, _______, KC_PLUS, KC_RCBR, _______, KC_PIPE, _______ ), - -/* Number - * ,-----------------------------------------------------------------------------------. - * | | + | - | | | | | 7 | 8 | 9 | | | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | * | / | = | | | | 4 | 5 | 6 | | | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | | | | | | | 1 | 2 | 3 | |Layer0| - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | 0 | 00 | . | | | - * `-----------------------------------------------------------------------------------' - */ - -[_NUMB] = LAYOUT_planck_mit( /* 5 - Numpad */ - _______, KC_PPLS, KC_PMNS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_7, KC_8, KC_9, XXXXXXX, _______, - _______, KC_PAST, KC_PSLS, KC_EQL, XXXXXXX, XXXXXXX, XXXXXXX, KC_4, KC_5, KC_6, XXXXXXX, _______, - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_1, KC_2, KC_3, XXXXXXX, TO( 0 ), - _______, _______, _______, _______, _______, XXXXXXX, KC_0, KC_00, KC_DOT, XXXXXXX, _______ ), - -/* MARO Empty - * ,-----------------------------------------------------------------------------------. - * | | | | | | | | | | | | | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | | | | | | | | | | | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | | | | | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | - * `-----------------------------------------------------------------------------------' - */ - -[_MARO] = LAYOUT_planck_mit( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - -/* RGB - * ,-----------------------------------------------------------------------------------. - * | | | | | | _TAP | | | | | | | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | MOD | M_R | M_SW | M_K | M_X | M_G | | | | | | | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | HUI | SAI | VAI | | | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | HUD | SAD | VAD | | | RGB_TOG | | | | | | - * `-----------------------------------------------------------------------------------' - */ - -[_RGB] = LAYOUT_planck_mit( - _______, _______, _______, _______, _______, RGB_TAP, _______, _______, _______, _______, _______, _______, - RGB_MOD, RGB_M_R, RGB_M_SW, RGB_M_K, RGB_M_X, RGB_M_G, _______, _______, _______, _______, _______, _______, - RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, - RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, RGB_TOG, _______, _______, _______, _______, _______ ), - -/* Func - * ,-----------------------------------------------------------------------------------. - * | | | | | | | | | | |Layer0| Rest | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Caps | | | | | Game | | | | | | | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | | | | | | Numb | Music| | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | - * `-----------------------------------------------------------------------------------' - */ - -[_ADJUST] = LAYOUT_planck_mit( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, TO( 0 ), RESET , - KC_CAPS, _______, _______, _______, _______, TO(_GAME), _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, TO(_NUMB), MU_TOG, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - -[_GAME] = LAYOUT_planck_mit( - XXXXXXX,KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, XXXXXXX, - XXXXXXX,KC_Q, KC_W, KC_E, KC_R, KC_T, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - XXXXXXX,KC_LCTL, KC_A, KC_S, KC_D, KC_B, KC_N, KC_M, XXXXXXX, XXXXXXX, KC_UP, TO( 0 ), - XXXXXXX,KC_LSFT, KC_Z, KC_X, KC_C, KC_SPC, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT ), + [0] = LAYOUT_planck_mit( + 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_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_LBRC, KC_MINS, LT(1, KC_SPC), KC_EQL, KC_RBRC, KC_LEFT, KC_DOWN, KC_RGHT, + KC_VOLD, KC_VOLU, KC_PGDN, KC_PGUP), + [1] = LAYOUT_planck_mit( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSPC, KC_TRNS, KC_DEL, KC_TRNS, KC_TRNS, KC_BSLS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), }; -/* Encoder */ -static uint8_t encoder_state = 0; -static int8_t encoder_value = 0; -static int8_t encoder_LUT[] = { 0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0 }; - -/* Timer */ -static uint16_t TAP_RGB_timer; +extern rgblight_config_t rgblight_config; +int RGB_LAYER0_mode = 6; +static uint8_t current_layer = 0; +static bool has_layer_changed = true; +uint16_t i = 0; +uint16_t j = 0; static uint16_t RGB_encoder_timer; +static uint16_t RGB_encoder_timer2; +static uint8_t RGB_encoder_dir = 0; -/* Encoder state RGB_display */ -static uint8_t RGB_encoder_count=6; -static bool RGB_encoder_bool = false; - -/* RGB tap HUE */ -static uint16_t Type_Hue=270; - -void matrix_init_user( void ) -{ - wait_ms( 200 ); - - /* Encoder init */ - encoder_state = PIND & 0x3; +const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = { + 30, + 5, + -5 +}; - /* Timer init */ - RGB_encoder_timer= timer_read(); - TAP_RGB_timer= timer_read(); +void matrix_init_user(void) { + RGB_encoder_timer = timer_read(); + RGB_encoder_timer2 = timer_read(); } +void matrix_scan_user(void) { + uint8_t layer = biton32(layer_state); -void matrix_scan_user( void ) -{ -/* Layer */ - uint8_t layer = biton32( layer_state ); - -/* Encoder */ - encoder_state <<= 2; - encoder_state |= (PIND & 0x3); - encoder_value += encoder_LUT[encoder_state & 0xF]; - -/* Encoder state RGB display */ - if (RGB_encoder_bool){ - if (timer_elapsed(RGB_encoder_timer) > 2500) { - RGB_encoder_bool=false; - if (RGB_TAP_STATE) { - rgblight_mode( 1 ); - rgblight_setrgb( RGB_TAP_Base_Color ); - }else{ - rgblight_mode( RGB_LAYER0_mode ); - } - } - } - -/* Display the Caps state */ - if (caps==true){ - rgblight_setrgb_at(RGB_Caps_Color,12); - } - -/* Start of Encoder clockwise */ - if ( encoder_value >= 4 ) { - - /* Start of Encoder state RGB_display */ - if (!RGB_encoder_bool){ - RGB_encoder_timer=timer_read(); - RGB_encoder_bool=true; - RGB_encoder_count=5; - rgblight_mode(1); - rgblight_setrgb( 0,0,0 ); - }else if (RGB_encoder_bool && timer_elapsed(RGB_encoder_timer) < 800) { - RGB_encoder_timer=timer_read(); - RGB_encoder_count-=1; - if (RGB_encoder_count>5 || RGB_encoder_count<1){ - RGB_encoder_count=5; + if (RGB_encoder_dir != 0) { + if (timer_elapsed(RGB_encoder_timer) > 1400) { + RGB_encoder_dir = 0; + rgblight_mode(RGB_LAYER0_mode); + } else { + if (timer_elapsed(RGB_encoder_timer2) > 700) { rgblight_setrgb(0, 0, 0); + RGB_encoder_timer2 = timer_read(); } - } - rgblight_setrgb_at(0,255,0,5); - if (RGB_encoder_count<1) {RGB_encoder_count=1;} - switch (RGB_encoder_count) { - case 5: - rgblight_setrgb_at(0, 255, 0,4); - break; - case 4: - rgblight_setrgb_at(0, 255, 0,3); - break; - case 3: - rgblight_setrgb_at(0, 255, 0,2); - break; - case 2: - rgblight_setrgb_at(0, 255, 0,1); - break; - case 1: - rgblight_setrgb_at(0, 255, 0,0); - break; + if (timer_elapsed(RGB_encoder_timer2) > 80) { + if (RGB_encoder_dir == 1) { + rgblight_setrgb_at(128, 128, 0, 19); + } else { + rgblight_setrgb_at(128, 128, 0, 16); + } } - /* End of Encoder state RGB_display */ - - /* Start of Set Encoder Keycode */ - switch ( layer ) - { - case 0: - tap_code( KC_VOLD ); - break; - case _CODE: - tap_code( KC_LEFT ); - break; - case _RGB: - rgblight_decrease_val(); - break; - case _NUMB: - tap_code( KC_LEFT ); - break; - case _MARO: - tap_code( KC_UP ); - break; - default: - tap_code( KC_VOLD ); - } - /* End of Set Encoder Keycode */ - - } - -/* End of Encoder clockwise */ - -/* Start of Encoder anti-clockwise */ - if ( encoder_value <= -4 ) - { - /* Start of Encoder state RGB_display */ - if (!RGB_encoder_bool){ - RGB_encoder_timer=timer_read(); - RGB_encoder_bool=true; - RGB_encoder_count=6; - rgblight_mode(1); - rgblight_setrgb( 0,0,0 ); - }else if (RGB_encoder_bool && timer_elapsed(RGB_encoder_timer) < 800) { - RGB_encoder_timer=timer_read(); - RGB_encoder_count+=1; - if (RGB_encoder_count<6 || RGB_encoder_count> 10){ - RGB_encoder_count=6; - rgblight_setrgb(0, 0, 0); + if (timer_elapsed(RGB_encoder_timer2) > 180) { + if (RGB_encoder_dir == 1) { + rgblight_setrgb_at(160, 160, 0, 8); + } else { + rgblight_setrgb_at(160, 160, 0, 3); + } + } + if (timer_elapsed(RGB_encoder_timer2) > 280) { + if (RGB_encoder_dir == 1) { + rgblight_setrgb_at(192, 192, 0, 9); + } else { + rgblight_setrgb_at(192, 192, 0, 2); + } + } + if (timer_elapsed(RGB_encoder_timer2) > 400) { + if (RGB_encoder_dir == 1) { + rgblight_setrgb_at(224, 224, 0, 10); + } else { + rgblight_setrgb_at(224, 224, 0, 1); + } } - } - rgblight_setrgb_at(0, 0,255,6); - if (RGB_encoder_count>11) { - RGB_encoder_count=11; - } - switch (RGB_encoder_count) { - case 6: - rgblight_setrgb_at(0, 0,255,7); - break; - case 7: - rgblight_setrgb_at(0, 0,255,8); - break; - case 8: - rgblight_setrgb_at(0, 0,255,9); - break; - case 9: - rgblight_setrgb_at(0, 0,255,10); - break; - case 10: - rgblight_setrgb_at(0, 0,128,11); - break; - } - /* End of Encoder state RGB_display */ - - /* Start of Set Encoder Keycode */ - switch ( layer ) - { - case 0: - tap_code( KC_VOLU ); - break; - case _CODE: - tap_code( KC_RGHT ); - break; - case _RGB: - rgblight_increase_val(); - break; - case _NUMB: - tap_code( KC_RGHT ); - break; - case _MARO: - tap_code( KC_DOWN ); - break; - default: - tap_code( KC_VOLU ); - } - /* End of Set Encoder Keycode */ - -} - -/* End of Encoder anti-clockwise */ - - encoder_value %= 4; - -/* Start of RGB with Layer change */ - - /* Save the Layer0 RGB state */ - if ( save_rgbmode == true ) { - if (RGB_TAP_STATE==false) - { - RGB_LAYER0_mode = rgblight_config.mode; } } - save_rgbmode = false; - /* When the layer is changed */ - if ( layer != current_layer && caps == false) { - has_layer_changed = true; - current_layer = layer; /* update layer information */ + /* layer rgb */ + if (layer != current_layer) { + has_layer_changed = true; + current_layer = layer; } - /* Check for layer change, and apply color if its changed since last check */ - if ( has_layer_changed ) - { - /* change backlight based on layer. These should be numbers or whatever you defined the layers as */ - switch ( layer ) - { - case 0: - - /* if the key tap RGB effect is enable */ - if (RGB_TAP_STATE==true){ - rgblight_mode(1); - rgblight_setrgb( RGB_TAP_Base_Color ); - } - else{ - rgblight_mode( RGB_LAYER0_mode ); + if (has_layer_changed) { + if (layer == 0) { + rgblight_mode(RGB_LAYER0_mode); + } else { + rgblight_mode(1); + for (i = 0; i < 48; i++) { + (i > 41) ? (j = i - 1) : (j = i); + uint16_t kc = keymap_key_to_keycode(layer, (keypos_t) {.row = 0, .col = i + }); + if (kc == KC_TRNS) { + setrgb(5, 5, 5, (LED_TYPE * ) & led[j]); /* TRNS color 0-255*/ + } else if (kc == KC_NO) { + setrgb(0, 0, 0, (LED_TYPE * ) & led[j]); /* NO color 0-255*/ + } else { + if (layer == 1) { + setrgb(128, 64, 0, (LED_TYPE * ) & led[j]); /* 1 layer 0-255*/ + } else if (layer == 2) { + setrgb(0, 64, 128, (LED_TYPE * ) & led[j]); /* 2*/ + } else if (layer == 3) { + setrgb(64, 128, 0, (LED_TYPE * ) & led[j]); /* 3*/ + } else if (layer == 4) { + setrgb(0, 128, 64, (LED_TYPE * ) & led[j]); /* 4*/ + } else if (layer == 5) { + setrgb(128, 0, 128, (LED_TYPE * ) & led[j]); /* 5*/ + } else if (layer == 6) { + setrgb(128, 0, 128, (LED_TYPE * ) & led[j]); /* 6*/ + } else if (layer == 7) { + setrgb(128, 128, 0, (LED_TYPE * ) & led[j]); /* 7*/ + } else if (layer == 8) { + setrgb(0, 128, 128, (LED_TYPE * ) & led[j]); /* 8*/ + } else if (layer == 9) { + setrgb(128, 192, 64, (LED_TYPE * ) & led[j]); /* 9*/ + } else if (layer == 10) { + setrgb(64, 192, 128, (LED_TYPE * ) & led[j]); /* 10*/ + } else if (layer == 11) { + setrgb(128, 64, 192, (LED_TYPE * ) & led[j]); /* 11*/ + } else if (layer == 12) { + setrgb(64, 128, 192, (LED_TYPE * ) & led[j]); /* 12*/ + } else if (layer == 13) { + setrgb(128, 192, 0, (LED_TYPE * ) & led[j]); /* 13*/ + } else if (layer == 14) { + setrgb(192, 0, 128, (LED_TYPE * ) & led[j]); /* 14*/ + } else if (layer == 15) { + setrgb(0, 192, 128, (LED_TYPE * ) & led[j]); /* 15*/ + } } - break; - - case _CODE: //1 -/* Save Layer0 RGB state */ - RGB_LAYER0_mode = rgblight_config.mode; - -/* set all the RGB color under the switch */ - rgblight_mode( 1 ); - rgblight_setrgb(RGB_Layer_1_Base_Color); - - /* set each of the RGB led color under the switch */ - rgblight_setrgb_at(64, 64, 64,1); // Q - rgblight_setrgb_at(64, 64, 64,2); // W - rgblight_setrgb_at(64, 64, 64,3); // E - rgblight_setrgb_at(64, 64, 64,4); // R - rgblight_setrgb_at(64, 64, 64,5); // T - rgblight_setrgb_at(64, 64, 64,6); // Y - rgblight_setrgb_at(64, 64, 64,7); // U - rgblight_setrgb_at(64, 64, 64,8); // I - rgblight_setrgb_at(64, 64, 64,9); // O - rgblight_setrgb_at(64, 64, 64,10); // P - rgblight_setrgb_at(64, 0, 0,40); // - - rgblight_setrgb_at(64, 0, 0,42); // = - break; - - case _NAVI: //2 - RGB_LAYER0_mode = rgblight_config.mode; - - rgblight_mode( 1 ); - rgblight_setrgb(RGB_Layer_2_Base_Color); - - rgblight_setrgb_at(64, 0, 64,3); - rgblight_setrgb_at(64, 0, 64,14); - rgblight_setrgb_at(64, 0, 64,15); - rgblight_setrgb_at(64, 0, 64,16); - rgblight_setrgb_at(64, 64, 0,8); - rgblight_setrgb_at(64, 64, 0,10); - rgblight_setrgb_at(64, 64, 0,21); - rgblight_setrgb_at(64, 64, 0,29); - rgblight_setrgb_at(64, 0, 0,11); - rgblight_setrgb_at(0, 0, 64,34); - rgblight_setrgb_at(0, 0, 64,44); - rgblight_setrgb_at(0, 0, 64,45); - rgblight_setrgb_at(0, 0, 64,46); - break; - case _FUNC: //3 - RGB_LAYER0_mode = rgblight_config.mode; - - rgblight_mode( 1 ); - rgblight_setrgb(RGB_Layer_3_Base_Color); - - rgblight_setrgb_at(0, 0, 64,1); - rgblight_setrgb_at(0, 0, 64,2); - rgblight_setrgb_at(0, 0, 64,3); - rgblight_setrgb_at(0, 0, 64,4); - rgblight_setrgb_at(0, 0, 64,5); - rgblight_setrgb_at(0, 0, 64,6); - rgblight_setrgb_at(0, 0, 64,7); - rgblight_setrgb_at(0, 0, 64,8); - rgblight_setrgb_at(0, 0, 64,9); - rgblight_setrgb_at(0, 0, 64,10); - rgblight_setrgb_at(0, 0, 64,13); - rgblight_setrgb_at(0, 0, 64,14); - break; - - case _SYMB: //4 - RGB_LAYER0_mode = rgblight_config.mode; - - rgblight_mode( 1 ); - rgblight_setrgb(RGB_Layer_4_Base_Color); - - rgblight_setrgb_at(0, 64, 64,1); - rgblight_setrgb_at(0, 64, 64,2); - rgblight_setrgb_at(0, 64, 64,3); - rgblight_setrgb_at(0, 64, 64,4); - rgblight_setrgb_at(0, 64, 64,5); - rgblight_setrgb_at(0, 64, 64,6); - rgblight_setrgb_at(0, 64, 64,7); - rgblight_setrgb_at(0, 64, 64,8); - rgblight_setrgb_at(0, 64, 64,9); - rgblight_setrgb_at(0, 64, 64,10); - rgblight_setrgb_at(0, 64, 64,12); - rgblight_setrgb_at(0, 64, 64,22); - rgblight_setrgb_at(0, 64, 64,23); - rgblight_setrgb_at(0, 64, 64,32); - rgblight_setrgb_at(0, 64, 64,33); - rgblight_setrgb_at(0, 64, 64,34); - rgblight_setrgb_at(0, 64, 64,39); - rgblight_setrgb_at(0, 64, 64,40); - rgblight_setrgb_at(0, 64, 64,42); - rgblight_setrgb_at(0, 64, 64,43); - break; - - case _NUMB: //5 - RGB_LAYER0_mode = rgblight_config.mode; - - rgblight_mode( 1 ); - rgblight_setrgb(RGB_Layer_5_Base_Color); - - rgblight_setrgb_at(0,64,0,1); - rgblight_setrgb_at(0,64,0,2); - rgblight_setrgb_at(0,64,0,13); - rgblight_setrgb_at(0,64,0,14); - rgblight_setrgb_at(0,64,64,15); - rgblight_setrgb_at(64,64,64,7); - rgblight_setrgb_at(64,64,64,8); - rgblight_setrgb_at(64,64,64,9); - rgblight_setrgb_at(64,64,64,19); - rgblight_setrgb_at(64,64,64,20); - rgblight_setrgb_at(64,64,64,21); - rgblight_setrgb_at(64,64,64,31); - rgblight_setrgb_at(64,64,64,32); - rgblight_setrgb_at(64,64,64,33); - rgblight_setrgb_at(64,64,64,42); - rgblight_setrgb_at(64,64,64,43); - rgblight_setrgb_at(0,128,0,44); - break; - case _MARO: //6 - RGB_LAYER0_mode = rgblight_config.mode; - - rgblight_mode( 1 ); - rgblight_setrgb(RGB_Layer_6_Base_Color); - break; - - case _RGB: //7 - RGB_LAYER0_mode = rgblight_config.mode; - - rgblight_mode( 1 ); - rgblight_setrgb(RGB_Layer_7_Base_Color); - - rgblight_setrgb_at(1,143,225,0); - rgblight_setrgb_at(39,21,107,1); - rgblight_setrgb_at(208,0,0,2); - rgblight_setrgb_at(64,64,64,21); - break; - case _ADJUST: //8 - RGB_LAYER0_mode = rgblight_config.mode; - - rgblight_mode( 1 ); - rgblight_setrgb(RGB_Layer_8_Base_Color); - - rgblight_setrgb_at(0,64,0,10); - rgblight_setrgb_at(64,0,0,11); - rgblight_setrgb_at(0,64,0,17); - rgblight_setrgb_at(0,64,0,30); - rgblight_setrgb_at(6,50,50,12); - break; - - case _GAME: //9 - RGB_LAYER0_mode = rgblight_config.mode; - - rgblight_mode( 1 ); - rgblight_setrgb(RGB_Layer_9_Base_Color); - - rgblight_setrgb_at(0,0,64,15); - rgblight_setrgb_at(0,0,64,26); - rgblight_setrgb_at(0,0,64,27); - rgblight_setrgb_at(0,0,64,28); - rgblight_setrgb_at(64,0,0,35); - break; - - default: - rgblight_mode( RGB_LAYER0_mode ); + } + rgblight_set(); } has_layer_changed = false; } -/* End of RGB with Layer change */ - -} // End of matrix_scan_user - - - -/* shift + enter = " from:https://github.com/qmk/qmk_firmware/blob/e899cb8940da04fa2610604f0aab417db7fac119/keyboards/mitosis/keymaps/datagrok/keymap.c */ - -bool comm_shifted = false; -bool ques_shifted = false; -static uint8_t key_index = 0; -uint8_t shifted; -uint16_t s_keycode; -bool *k_shifted; - -bool process_record_user( uint16_t keycode, keyrecord_t *record ){ - -/* Start of key tap RGB effect */ - if ( RGB_TAP_STATE ==true ) { - key_index=(record->event.key.col)+(record->event.key.row)*12; - -/* Change the Hue of the RGB color with the type speed */ - if (timer_elapsed(TAP_RGB_timer) >10000){ - TAP_RGB_timer=timer_read(); - Type_Hue=270; - }else if (timer_elapsed(TAP_RGB_timer) >1000){ - Type_Hue+=30; - if (Type_Hue>270) { - Type_Hue=270;} - }else{ - TAP_RGB_timer=timer_read(); - Type_Hue-=10; - if (Type_Hue<10) { - Type_Hue=10;} - } - if (key_index>42){ //fix the RGB index of the MIT layout position - key_index=key_index-1; - } - if ( record->event.pressed ) { - rgblight_sethsv_at(Type_Hue,255,255,key_index); - } else { - rgblight_setrgb_at(RGB_TAP_Base_Color,key_index); - } - } -/* End of key tap RGB effect */ - - switch ( keycode ) - { - /* save the RGB state when set the new */ - case RGB_M_R: - save_rgbmode = true; - break; - case RGB_M_SW: - save_rgbmode = true; - break; - case RGB_M_X: - save_rgbmode = true; - break; - case RGB_M_G: - save_rgbmode = true; - break; - case RGB_MODE_KNIGHT: - save_rgbmode = true; - break; - -/* Define a New Keycode: double zero */ - case KC_00: - if (record->event.pressed) { - // Do something when pressed - } else { - tap_code( KC_0 ); // send 0 - tap_code( KC_0 ); // send 0 twice without macro - } - return false; // Skip all further processing of this key - - /* when the REST key is pressed the 'R' key will RED,the "Bottom Left"(esc of qmk-dfu) will be GREEN */ - case RESET: - rgblight_mode( 1 ); - rgblight_setrgb( 0, 0, 0 ); - rgblight_setrgb_at(128, 0, 0,4); // R - rgblight_setrgb_at(6, 128, 24,36); // Bottom Left key - break; - -/* Define a New Keycode: key tap RGB effect toggle */ - case RGB_TAP: - if ( !(record->event.pressed)) { - /* If enable,the 'On' key will be green */ - if (RGB_TAP_STATE) { - RGB_TAP_STATE=false; - rgblight_mode( 1 ); - rgblight_setrgb( RGB_TAP_Base_Color ); - rgblight_setrgb_at(RGB_TAP_Off_Color,16); // O - on - }else{ - /* If disenable,the 'oFf' key will be red */ - RGB_TAP_STATE=true; - rgblight_mode( 1 ); - rgblight_setrgb( RGB_TAP_Base_Color ); - rgblight_setrgb_at(RGB_TAP_On_Color,9); // F - off - } - } - break; + /* end of layer rgb */ +} -/* special shift keys */ - case KC_ENT: - s_keycode = KC_QUOT; - k_shifted = &ques_shifted; - break; - case KC_UP: - s_keycode = KC_SLSH; - k_shifted = &ques_shifted; - break; - case KC_DOWN: - s_keycode = KC_BSLS; - k_shifted = &ques_shifted; +bool process_record_user(uint16_t keycode, keyrecord_t * record) { + switch (keycode) { + case RGB_MOD: + RGB_LAYER0_mode = rgblight_config.mode; break; default: - return(true); + return (true); } + return (true); +} - shifted = get_mods() & (MOD_BIT( KC_LSHIFT ) | MOD_BIT( KC_RSHIFT ) ); - - /* Keydown. If shift is currently pressed, register its alternate keycode. */ - if ( record->event.pressed && shifted ) - { - *k_shifted = true; - register_code( s_keycode ); - return(false); - /* - * Keyup. If shift was pressed back when the key was pressed, unregister - * its alternate keycode. - */ - } else if ( !(record->event.pressed) && *k_shifted ) { - *k_shifted = false; - unregister_code( s_keycode ); - return(false); - /* Otherwise, behave as normal. */ +void encoder_update_user(uint8_t index, bool clockwise) { + RGB_encoder_timer = timer_read(); + RGB_encoder_timer2 = timer_read(); + uint8_t layer = biton32(layer_state); + if (clockwise) { + RGB_encoder_dir = 1; } else { - return(true); + RGB_encoder_dir = -1; } - -} // End ofprocess_record_user - - -void led_set_user( uint8_t usb_led ) -{ - static uint8_t old_usb_led = 0; - wait_ms( 10 ); /* gets rid of tick */ - - if ( (usb_led & (1 << USB_LED_CAPS_LOCK) ) && !(old_usb_led & (1 << USB_LED_CAPS_LOCK) ) ) { -/* CAPS on */ - caps= true; - rgblight_setrgb( 0,0,0 ); - rgblight_setrgb_at(RGB_Caps_Color,12); // caps key - #ifdef AUDIO_ENABLE - PLAY_SONG( tone_caps ); - #endif - }else if ( !(usb_led & (1 << USB_LED_CAPS_LOCK) ) && (old_usb_led & (1 << USB_LED_CAPS_LOCK) ) ) { - -/* CAPS off */ - caps= false; - if (RGB_TAP_STATE==false){ - rgblight_mode( RGB_LAYER0_mode ); - }else{ - rgblight_mode(1); - rgblight_setrgb( 0,0,0 ); + if (index == 0) /* Right encoder */ { + if (clockwise) { + register_code(keymap_key_to_keycode(layer, (keypos_t) {.row = 4, .col = 11 + })); + unregister_code(keymap_key_to_keycode(layer, (keypos_t) {.row = 4, .col = 11 + })); + } else { + register_code(keymap_key_to_keycode(layer, (keypos_t) {.row = 4, .col = 10 + })); + unregister_code(keymap_key_to_keycode(layer, (keypos_t) {.row = 4, .col = 10 + })); + } + } else if (index == 1) /* Left encoder */ { + if (clockwise) { + register_code(keymap_key_to_keycode(layer, (keypos_t) {.row = 4, .col = 1 + })); + unregister_code(keymap_key_to_keycode(layer, (keypos_t) {.row = 4, .col = 1 + })); + } else { + register_code(keymap_key_to_keycode(layer, (keypos_t) {.row = 4, .col = 0 + })); + unregister_code(keymap_key_to_keycode(layer, (keypos_t) {.row = 4, .col = 0 + })); } - #ifdef AUDIO_ENABLE - PLAY_SONG( tone_caps ); - #endif } - old_usb_led = usb_led; -} // End of led_set_user +} diff --git a/keyboards/tetris/keymaps/default/rules.mk b/keyboards/tetris/keymaps/default/rules.mk deleted file mode 100644 index e5ddcae8d9..0000000000 --- a/keyboards/tetris/keymaps/default/rules.mk +++ /dev/null @@ -1 +0,0 @@ -TAP_DANCE_ENABLE = yes diff --git a/keyboards/tetris/readme.md b/keyboards/tetris/readme.md index b2741caf1c..260d453a84 100644 --- a/keyboards/tetris/readme.md +++ b/keyboards/tetris/readme.md @@ -2,6 +2,8 @@ Tetris === A compact 40% (12x4) ortholinear keyboard (Planck Mit layout) with per switch RGB and encoder made by Fengz. +Fake keys on the 5th row are for configuring the encoder's keycode. + ![TetrisPhoto](https://i.imgur.com/quwEY0f.jpg) More: [Imgur](https://imgur.com/gallery/Azq2zUm). @@ -12,4 +14,4 @@ Make example for this keyboard (after setting up your build environment): make tetris:default -See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. \ No newline at end of file +See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. diff --git a/keyboards/tetris/rules.mk b/keyboards/tetris/rules.mk old mode 100644 new mode 100755 index 64c4345543..c3e641c8f2 --- a/keyboards/tetris/rules.mk +++ b/keyboards/tetris/rules.mk @@ -36,26 +36,25 @@ F_USB = $(F_CPU) # Interrupt driven control endpoint task(+60) OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + # Boot Section Size in *bytes* #OPT_DEFS += -DBOOTLOADER_SIZE=4096 BOOTLOADER =qmk-dfu + # Build Options # comment out to disable the options. # BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = no # Mouse keys(+4700) +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 +AUDIO_ENABLE = yes RGBLIGHT_ENABLE = yes -TAP_DANCE_ENABLE = no - -EXTRAFLAGS += -flto # Make the hex smaller - -LAYOUTS = planck_mit +EXTRAFLAGS = -flto +ENCODER_ENABLE = yes diff --git a/keyboards/tetris/tetris.c b/keyboards/tetris/tetris.c old mode 100644 new mode 100755 index 8d494c17f3..f78de2f7be --- a/keyboards/tetris/tetris.c +++ b/keyboards/tetris/tetris.c @@ -1 +1 @@ -#include "tetris.h" +#include QMK_KEYBOARD_H diff --git a/keyboards/tetris/tetris.h b/keyboards/tetris/tetris.h old mode 100644 new mode 100755 index 0a036ec3b3..f5d13e5c2f --- a/keyboards/tetris/tetris.h +++ b/keyboards/tetris/tetris.h @@ -7,12 +7,14 @@ K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, \ K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, \ K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, \ - K300, K301, K302, K303, K304, K305, K307, K308, K309, K310, K311 \ + K300, K301, K302, K303, K304, K305, K307, K308, K309, K310, K311, \ + K400, K401, K410, K411 \ ) { \ { K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011 }, \ { K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111 }, \ { K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211 }, \ - { K300, K301, K302, K303, K304, K305, KC_NO, K307, K308, K309, K310, K311 } \ + { K300, K301, K302, K303, K304, K305, KC_NO, K307, K308, K309, K310, K311 }, \ + { K400, K401, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K410, K411 } \ } -#endif \ No newline at end of file +#endif From 7a1086e4057a64f841ba178aa9eebb0002722ae2 Mon Sep 17 00:00:00 2001 From: Alex Ong Date: Fri, 19 Apr 2019 05:20:57 +1000 Subject: [PATCH 07/61] [core] Fix for eager_pr #5643 Added extra transfer_matrix_values() call whenever counters don't need updating --- quantum/debounce/eager_pr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/quantum/debounce/eager_pr.c b/quantum/debounce/eager_pr.c index 5b460f6630..26b17ed295 100644 --- a/quantum/debounce/eager_pr.c +++ b/quantum/debounce/eager_pr.c @@ -48,11 +48,12 @@ void debounce_init(uint8_t num_rows) { void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { uint8_t current_time = timer_read() % MAX_DEBOUNCE; + bool needed_update = counters_need_update; if (counters_need_update) { update_debounce_counters(num_rows, current_time); } - if (changed) { + if (changed || (needed_update && !counters_need_update)) { transfer_matrix_values(raw, cooked, num_rows, current_time); } } From 068571b9febb46edb64663bf6e84ae821a8219a3 Mon Sep 17 00:00:00 2001 From: skullydazed Date: Thu, 18 Apr 2019 15:59:51 -0700 Subject: [PATCH 08/61] Update our style guide (#5500) * Update our style guide * Clarify muiltple condition ifs * update the ifdef section --- .clang-format | 2 +- .editorconfig | 2 +- docs/contributing.md | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.clang-format b/.clang-format index bd896176d5..4652b9e0aa 100644 --- a/.clang-format +++ b/.clang-format @@ -20,7 +20,7 @@ SortIncludes: 'false' SpaceBeforeAssignmentOperators: 'true' SpaceBeforeParens: ControlStatements SpaceInEmptyParentheses: 'false' -TabWidth: '2' +TabWidth: '4' UseTab: Never ... diff --git a/.editorconfig b/.editorconfig index 4cd051ce95..c8cb35b861 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,7 +5,7 @@ root = true [*] indent_style = space -indent_size = 2 +indent_size = 4 # We recommend you to keep these unchanged charset = utf-8 diff --git a/docs/contributing.md b/docs/contributing.md index 15066185bc..7d1a9691cf 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -56,7 +56,7 @@ Never made an open source contribution before? Wondering how contributions work Most of our style is pretty easy to pick up on, but right now it's not entirely consistent. You should match the style of the code surrounding your change, but if that code is inconsistent or unclear use the following guidelines: -* We indent using two spaces (soft tabs) +* We indent using four (4) spaces (soft tabs) * We use a modified One True Brace Style * Opening Brace: At the end of the same line as the statement that opens the block * Closing Brace: Lined up with the first character of the statement that opens the block @@ -71,6 +71,14 @@ Most of our style is pretty easy to pick up on, but right now it's not entirely * If you not sure if a comment is obvious, go ahead and include it. * In general we don't wrap lines, they can be as long as needed. If you do choose to wrap lines please do not wrap any wider than 76 columns. * We use `#pragma once` at the start of header files rather than old-style include guards (`#ifndef THIS_FILE_H`, `#define THIS_FILE_H`, ..., `#endif`) +* We accept both forms of preprocessor if's: `#ifdef DEFINED` and `#if defined(DEFINED)` + * If you are not sure which to prefer use the `#if defined(DEFINED)` form. + * Do not change existing code from one style to the other, except when moving to a multiple condition `#if`. + * Do not put whitespace between `#` and `if`. + * When deciding how (or if) to indent directives keep these points in mind: + * Readability is more important than consistency. + * Follow the file's existing style. If the file is mixed follow the style that makes sense for the section you are modifying. + * When choosing to indent you can follow the indention level of the surrounding C code, or preprocessor directives can have their own indent level. Choose the style that best communicates the intent of your code. Here is an example for easy reference: From dd290085c9e9c7d87fed64170407ca4cdc3c7433 Mon Sep 17 00:00:00 2001 From: QMK Bot Date: Thu, 18 Apr 2019 23:23:52 +0000 Subject: [PATCH 09/61] convert to unix line-endings [skip ci] --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 4652b9e0aa..96c4862590 100644 --- a/.clang-format +++ b/.clang-format @@ -1,4 +1,4 @@ ---- +--- BasedOnStyle: Google AlignAfterOpenBracket: Align AlignConsecutiveAssignments: 'true' From 8aee82e8b4d8108d8a9a56f8fd61ae1281ee4165 Mon Sep 17 00:00:00 2001 From: shela Date: Fri, 19 Apr 2019 09:41:01 +0900 Subject: [PATCH 10/61] [Keymap] Fix compilation error of feature #4301 (#5649) --- keyboards/comet46/keymaps/satt/action_pseudo_lut.c | 1 + keyboards/hhkb/keymaps/shela/action_pseudo_lut.c | 1 + 2 files changed, 2 insertions(+) diff --git a/keyboards/comet46/keymaps/satt/action_pseudo_lut.c b/keyboards/comet46/keymaps/satt/action_pseudo_lut.c index 0ac7133591..4a7cb3a3a2 100644 --- a/keyboards/comet46/keymaps/satt/action_pseudo_lut.c +++ b/keyboards/comet46/keymaps/satt/action_pseudo_lut.c @@ -1,4 +1,5 @@ #include "quantum.h" +#include "command.h" #include "action_pseudo_lut.h" static uint8_t send_key_shift_bit[SHIFT_BIT_SIZE]; diff --git a/keyboards/hhkb/keymaps/shela/action_pseudo_lut.c b/keyboards/hhkb/keymaps/shela/action_pseudo_lut.c index 5664d4d2a5..a15f5e5e0b 100644 --- a/keyboards/hhkb/keymaps/shela/action_pseudo_lut.c +++ b/keyboards/hhkb/keymaps/shela/action_pseudo_lut.c @@ -1,4 +1,5 @@ #include "quantum.h" +#include "command.h" #include "action_pseudo_lut.h" static uint8_t send_key_shift_bit[SHIFT_BIT_SIZE]; From 74af596d8ac0e1ee5f308f520b22831ca32f0339 Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Thu, 18 Apr 2019 23:58:38 -0500 Subject: [PATCH 11/61] [Keyboard] niu_mini reduce firmware size (#5648) * Reducing firmware size by removing audio for keymaps that are not using it. * Update rules.mk --- keyboards/niu_mini/keymaps/planck/rules.mk | 1 + keyboards/niu_mini/rules.mk | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/keyboards/niu_mini/keymaps/planck/rules.mk b/keyboards/niu_mini/keymaps/planck/rules.mk index e69de29bb2..8b13789179 100644 --- a/keyboards/niu_mini/keymaps/planck/rules.mk +++ b/keyboards/niu_mini/keymaps/planck/rules.mk @@ -0,0 +1 @@ + diff --git a/keyboards/niu_mini/rules.mk b/keyboards/niu_mini/rules.mk index b8d0ace97a..496928ed70 100644 --- a/keyboards/niu_mini/rules.mk +++ b/keyboards/niu_mini/rules.mk @@ -58,7 +58,7 @@ COMMAND_ENABLE = no # Commands for debug and configuration NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls -AUDIO_ENABLE = yes # Audio output on port C6 +AUDIO_ENABLE = no # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. From e3a940026ead4a3b4d0a9f536bd4cc5153e4140b Mon Sep 17 00:00:00 2001 From: Markus Weimar Date: Wed, 17 Oct 2018 10:40:52 +0200 Subject: [PATCH 12/61] Improve mouse keys docs and constant speed mode --- docs/feature_mouse_keys.md | 161 +++++++++++++++++++------------------ tmk_core/common/mousekey.c | 29 ++++--- tmk_core/common/mousekey.h | 60 ++++++++------ 3 files changed, 136 insertions(+), 114 deletions(-) diff --git a/docs/feature_mouse_keys.md b/docs/feature_mouse_keys.md index e64ddf3d06..75633969ec 100644 --- a/docs/feature_mouse_keys.md +++ b/docs/feature_mouse_keys.md @@ -1,114 +1,121 @@ -# Mousekeys +# Mouse keys +Mouse keys is a feature that allows you to emulate a mouse using your keyboard. You can move the pointer at different speeds, press 5 buttons and scroll in all 8 directions. -Mousekeys is a feature that allows you to emulate a mouse using your keyboard. You can move the pointer around, click up to 5 buttons, and even scroll in all 4 directions. +## Adding mouse keys to your keyboard -There are 2 ways to define how the mousekeys behave, using "[auto-accelerating](#configuring-the-behavior-of-mousekeys-with-auto-accelerated-movement)" or "[3-speed constant](#configuring-the-behavior-of-mousekeys-with-3-speed-constant-movement)" behavior. +To use mouse keys, you must at least enable mouse keys support and map mouse actions to keys on your keyboard. -In either case, you will need to enable mousekeys in your makefile, -and add the relevant [keycodes](#mapping-mouse-actions-to-keyboard-keys) to your keymap. +### Enabling mouse keys -#### Enable Mousekeys +To enable mouse keys, add the following line to your keymap’s `rules.mk`: -To enable the mousekey functionality, add the following line to your keymap's `rules.mk`: - -``` +```c MOUSEKEY_ENABLE = yes ``` -#### Mapping Mouse Actions to Keyboard Keys +### Mapping mouse actions -You can use these keycodes within your keymap to map button presses to mouse actions: +In your keymap you can use the following keycodes to map key presses to mouse actions: -|Key |Aliases |Description | -|----------------|---------|-----------------------------------| -|`KC_MS_UP` |`KC_MS_U`|Mouse Cursor Up | -|`KC_MS_DOWN` |`KC_MS_D`|Mouse Cursor Down | -|`KC_MS_LEFT` |`KC_MS_L`|Mouse Cursor Left | -|`KC_MS_RIGHT` |`KC_MS_R`|Mouse Cursor Right | -|`KC_MS_BTN1` |`KC_BTN1`|Mouse Button 1 | -|`KC_MS_BTN2` |`KC_BTN2`|Mouse Button 2 | -|`KC_MS_BTN3` |`KC_BTN3`|Mouse Button 3 | -|`KC_MS_BTN4` |`KC_BTN4`|Mouse Button 4 | -|`KC_MS_BTN5` |`KC_BTN5`|Mouse Button 5 | -|`KC_MS_WH_UP` |`KC_WH_U`|Mouse Wheel Up | -|`KC_MS_WH_DOWN` |`KC_WH_D`|Mouse Wheel Down | -|`KC_MS_WH_LEFT` |`KC_WH_L`|Mouse Wheel Left | -|`KC_MS_WH_RIGHT`|`KC_WH_R`|Mouse Wheel Right | -|`KC_MS_ACCEL0` |`KC_ACL0`|Set mouse acceleration to 0(slow) | -|`KC_MS_ACCEL1` |`KC_ACL1`|Set mouse acceleration to 1(medium)| -|`KC_MS_ACCEL2` |`KC_ACL2`|Set mouse acceleration to 2(fast) | +|Key |Aliases |Description | +|----------------|---------|-----------------| +|`KC_MS_UP` |`KC_MS_U`|Move cursor up | +|`KC_MS_DOWN` |`KC_MS_D`|Move cursor down | +|`KC_MS_LEFT` |`KC_MS_L`|Move cursor left | +|`KC_MS_RIGHT` |`KC_MS_R`|Move cursor right| +|`KC_MS_BTN1` |`KC_BTN1`|Press button 1 | +|`KC_MS_BTN2` |`KC_BTN2`|Press button 2 | +|`KC_MS_BTN3` |`KC_BTN3`|Press button 3 | +|`KC_MS_BTN4` |`KC_BTN4`|Press button 4 | +|`KC_MS_BTN5` |`KC_BTN5`|Press button 5 | +|`KC_MS_WH_UP` |`KC_WH_U`|Move wheel up | +|`KC_MS_WH_DOWN` |`KC_WH_D`|Move wheel down | +|`KC_MS_WH_LEFT` |`KC_WH_L`|Move wheel left | +|`KC_MS_WH_RIGHT`|`KC_WH_R`|Move wheel right | +|`KC_MS_ACCEL0` |`KC_ACL0`|Set speed to 0 | +|`KC_MS_ACCEL1` |`KC_ACL1`|Set speed to 1 | +|`KC_MS_ACCEL2` |`KC_ACL2`|Set speed to 2 | +For an example, see [the mouse layer in this keymap](https://github.com/qmk/qmk_firmware/blob/1df10ae3bfc146805c75b06dc0c126cd1ef3a60a/keyboards/clueboard/66/keymaps/mouse_keys/keymap.c#L40). -## Configuring the Behavior of Mousekeys with auto-accelerated movement +## Configuring mouse keys -This behavior is intended to emulate the X Window System MouseKeysAccel feature. You can read more about it [on Wikipedia](https://en.wikipedia.org/wiki/Mouse_keys). +Mouse keys supports two different modes to move the cursor: -The default speed for controlling the mouse with the keyboard is intentionally slow. You can adjust these parameters by adding these settings to your keymap's `config.h` file. All times are specified in milliseconds (ms). +* **Accelerated (default):** Holding movement keys accelerates the cursor until it reaches its maximum speed. +* **Constant:** Holding movement keys moves the cursor at constant speeds. -``` -#define MOUSEKEY_DELAY 300 -#define MOUSEKEY_INTERVAL 50 -#define MOUSEKEY_MAX_SPEED 10 -#define MOUSEKEY_TIME_TO_MAX 20 -#define MOUSEKEY_WHEEL_MAX_SPEED 8 -#define MOUSEKEY_WHEEL_TIME_TO_MAX 40 -``` +The same principle applies to scrolling. -#### `MOUSEKEY_DELAY` +Configuration options that are times, intervals or delays are given in milliseconds. Scroll speed is given as multiples of the default scroll step. For example, a scroll speed of 8 means that each scroll action covers 8 times the length of the default scroll step as defined by your operating system or application. -When one of the mouse movement buttons is pressed this setting is used to define the delay between that button press and the mouse cursor moving. Some people find that small movements are impossible if this setting is too low, while settings that are too high feel sluggish. +### Accelerated mode -#### `MOUSEKEY_INTERVAL` +This is the default mode. You can adjust the cursor and scrolling acceleration using the following settings in your keymap’s `config.h` file: -When a movement key is held down this specifies how long to wait between each movement report. Lower settings will translate into an effectively higher mouse speed. +|Define |Default|Description | +|----------------------------|-------|---------------------------------------------------------| +|`MOUSEKEY_DELAY` |300 |Delay between pressing a movement key and cursor movement| +|`MOUSEKEY_INTERVAL` |50 |Time between cursor movements | +|`MOUSEKEY_MAX_SPEED` |10 |Maximum cursor speed at which acceleration stops | +|`MOUSEKEY_TIME_TO_MAX` |20 |Time until maximum cursor speed is reached | +|`MOUSEKEY_WHEEL_MAX_SPEED` |8 |Maximum number of scroll steps per scroll action | +|`MOUSEKEY_WHEEL_TIME_TO_MAX`|40 |Time until maximum scroll speed is reached | -#### `MOUSEKEY_MAX_SPEED` +Tips: -As a movement key is held down the speed of the mouse cursor will increase until it reaches `MOUSEKEY_MAX_SPEED`. +* Setting `MOUSEKEY_DELAY` too low makes the cursor unresponsive. Setting it too high makes small movements difficult. +* For smoother cursor movements, lower the value of `MOUSEKEY_INTERVAL`. If the refresh rate of your display is 60Hz, you could set it to `16` (1/60). As this raises the cursor speed significantly, you may want to lower `MOUSEKEY_MAX_SPEED`. +* Setting `MOUSEKEY_TIME_TO_MAX` or `MOUSEKEY_WHEEL_TIME_TO_MAX` to `0` will disable acceleration for the cursor or scrolling respectively. This way you can make one of them constant while keeping the other accelerated, which is not possible in constant speed mode. -#### `MOUSEKEY_TIME_TO_MAX` +Cursor acceleration uses the same algorithm as the X Window System MouseKeysAccel feature. You can read more about it [on Wikipedia](https://en.wikipedia.org/wiki/Mouse_keys). -How long you want to hold down a movement key for until `MOUSEKEY_MAX_SPEED` is reached. This controls how quickly your cursor will accelerate. +### Constant mode -#### `MOUSEKEY_WHEEL_MAX_SPEED` +In this mode you can define multiple different speeds for both the cursor and the mouse wheel. There is no acceleration. `KC_ACL0`, `KC_ACL1` and `KC_ACL2` change the cursor and scroll speed to their respective setting. -The top speed for scrolling movements. +You can choose whether speed selection is momentary or tap-to-select: -#### `MOUSEKEY_WHEEL_TIME_TO_MAX` +* **Momentary:** The chosen speed is only active while you hold the respective key. When the key is raised, mouse keys returns to the unmodified speed. +* **Tap-to-select:** The chosen speed is activated when you press the respective key and remains active even after the key has been raised. The default speed is that of `KC_ACL1`. There is no unmodified speed. -How long you want to hold down a scroll key for until `MOUSEKEY_WHEEL_MAX_SPEED` is reached. This controls how quickly your scrolling will accelerate. +The default speeds from slowest to fastest are as follows: +* **Momentary:** `KC_ACL0` < `KC_ACL1` < *unmodified* < `KC_ACL2` +* **Tap-to-select:** `KC_ACL0` < `KC_ACL1` < `KC_ACL2` -## Configuring the Behavior of Mousekeys with 3-speed constant movement +To use constant speed mode, you must at least define `MK_3_SPEED` in your keymap’s `config.h` file: -In your keymap's `config.h`, you must add the line: -``` +```c #define MK_3_SPEED ``` -Then you can precisely define 3 different speeds for both the cursor and the mouse wheel, and also whether speed selection is momentary or tap-to-select. -For each speed, you can specify how many milliseconds you want between reports(interval), and how far you want to it to move per report(offset). -For example: +To enable momentary mode, also define `MK_MOMENTARY_ACCEL`: -``` -#define MK_3_SPEED -#define MK_MOMENTARY_ACCEL // comment this out for tap-to-select acceleration -// cursor speeds: -#define MK_C_OFFSET_SLOW 1 // pixels -#define MK_C_INTERVAL_SLOW 100 // milliseconds -#define MK_C_OFFSET_MED 4 -#define MK_C_INTERVAL_MED 16 -#define MK_C_OFFSET_FAST 12 -#define MK_C_INTERVAL_FAST 16 -// scroll wheel speeds: -#define MK_W_OFFSET_SLOW 1 // wheel clicks -#define MK_W_INTERVAL_SLOW 400 // milliseconds -#define MK_W_OFFSET_MED 1 -#define MK_W_INTERVAL_MED 200 -#define MK_W_OFFSET_FAST 1 -#define MK_W_INTERVAL_FAST 100 +```c +#define MK_MOMENTARY_ACCEL ``` -Medium values will be used as the default or unmodified speed. -The speed at which both the cursor and scrolling move can be selected with KC_ACL0, KC_ACL1, KC_ACL2 for slow, medium, and fast. However, if you leave MK_MOMENTARY_ACCEL defined then there is no need to ever send KC_ACL1, since that will be the unmodified speed. +Use the following settings if you want to adjust cursor movement or scrolling: + +|Define |Default |Description | +|---------------------|-------------|-------------------------------------------| +|`MK_3_SPEED` |*Not defined*|Enable constant cursor speeds | +|`MK_MOMENTARY_ACCEL` |*Not defined*|Enable momentary speed selection | +|`MK_C_OFFSET_UNMOD` |16 |Cursor offset per movement (unmodified) | +|`MK_C_INTERVAL_UNMOD`|16 |Time between cursor movements (unmodified) | +|`MK_C_OFFSET_0` |1 |Cursor offset per movement (`KC_ACL0`) | +|`MK_C_INTERVAL_0` |32 |Time between cursor movements (`KC_ACL0`) | +|`MK_C_OFFSET_1` |4 |Cursor offset per movement (`KC_ACL1`) | +|`MK_C_INTERVAL_1` |16 |Time between cursor movements (`KC_ACL1`) | +|`MK_C_OFFSET_2` |32 |Cursor offset per movement (`KC_ACL2`) | +|`MK_C_INTERVAL_2` |16 |Time between cursor movements (`KC_ACL2`) | +|`MK_W_OFFSET_UNMOD` |1 |Scroll steps per scroll action (unmodified)| +|`MK_W_INTERVAL_UNMOD`|40 |Time between scroll steps (unmodified) | +|`MK_W_OFFSET_0` |1 |Scroll steps per scroll action (`KC_ACL0`) | +|`MK_W_INTERVAL_0` |360 |Time between scroll steps (`KC_ACL0`) | +|`MK_W_OFFSET_1` |1 |Scroll steps per scroll action (`KC_ACL1`) | +|`MK_W_INTERVAL_1` |120 |Time between scroll steps (`KC_ACL1`) | +|`MK_W_OFFSET_2` |1 |Scroll steps per scroll action (`KC_ACL2`) | +|`MK_W_INTERVAL_2` |20 |Time between scroll steps (`KC_ACL2`) | diff --git a/tmk_core/common/mousekey.c b/tmk_core/common/mousekey.c index 87239fbb76..8c91843063 100644 --- a/tmk_core/common/mousekey.c +++ b/tmk_core/common/mousekey.c @@ -171,28 +171,31 @@ void mousekey_off(uint8_t code) { enum { - mkspd_slow, - mkspd_med, - mkspd_fast, + mkspd_unmod, + mkspd_0, + mkspd_1, + mkspd_2, mkspd_COUNT }; -static uint8_t mk_speed = mkspd_med; -#ifdef MK_MOMENTARY_ACCEL -static uint8_t mkspd_DEFAULT = mkspd_med; +#ifndef MK_MOMENTARY_ACCEL +static uint8_t mk_speed = mkspd_1; +#else +static uint8_t mk_speed = mkspd_unmod; +static uint8_t mkspd_DEFAULT = mkspd_unmod; #endif static uint16_t last_timer_c = 0; static uint16_t last_timer_w = 0; uint16_t c_offsets[mkspd_COUNT] = { - MK_C_OFFSET_SLOW, MK_C_OFFSET_MED, MK_C_OFFSET_FAST + MK_C_OFFSET_UNMOD, MK_C_OFFSET_0, MK_C_OFFSET_1, MK_C_OFFSET_2 }; uint16_t c_intervals[mkspd_COUNT] = { - MK_C_INTERVAL_SLOW, MK_C_INTERVAL_MED, MK_C_INTERVAL_FAST + MK_C_INTERVAL_UNMOD, MK_C_INTERVAL_0, MK_C_INTERVAL_1, MK_C_INTERVAL_2 }; uint16_t w_offsets[mkspd_COUNT] = { - MK_W_OFFSET_SLOW, MK_W_OFFSET_MED, MK_W_OFFSET_FAST + MK_W_OFFSET_UNMOD, MK_W_OFFSET_0, MK_W_OFFSET_1, MK_W_OFFSET_2 }; uint16_t w_intervals[mkspd_COUNT] = { - MK_W_INTERVAL_SLOW, MK_W_INTERVAL_MED, MK_W_INTERVAL_FAST + MK_W_INTERVAL_UNMOD, MK_W_INTERVAL_0, MK_W_INTERVAL_1, MK_W_INTERVAL_2 }; @@ -254,9 +257,9 @@ void mousekey_on(uint8_t code) { else if (code == KC_MS_BTN3) mouse_report.buttons |= MOUSE_BTN3; else if (code == KC_MS_BTN4) mouse_report.buttons |= MOUSE_BTN4; else if (code == KC_MS_BTN5) mouse_report.buttons |= MOUSE_BTN5; - else if (code == KC_MS_ACCEL0) mk_speed = mkspd_slow; - else if (code == KC_MS_ACCEL1) mk_speed = mkspd_med; - else if (code == KC_MS_ACCEL2) mk_speed = mkspd_fast; + else if (code == KC_MS_ACCEL0) mk_speed = mkspd_0; + else if (code == KC_MS_ACCEL1) mk_speed = mkspd_1; + else if (code == KC_MS_ACCEL2) mk_speed = mkspd_2; if (mk_speed != old_speed) adjust_speed(); } diff --git a/tmk_core/common/mousekey.h b/tmk_core/common/mousekey.h index ce3501b232..89c1eaf11a 100644 --- a/tmk_core/common/mousekey.h +++ b/tmk_core/common/mousekey.h @@ -64,42 +64,54 @@ along with this program. If not, see . #else /* #ifndef MK_3_SPEED */ -#ifndef MK_C_OFFSET_SLOW -#define MK_C_OFFSET_SLOW 1 +#ifndef MK_C_OFFSET_UNMOD +#define MK_C_OFFSET_UNMOD 16 #endif -#ifndef MK_C_INTERVAL_SLOW -#define MK_C_INTERVAL_SLOW 100 +#ifndef MK_C_INTERVAL_UNMOD +#define MK_C_INTERVAL_UNMOD 16 #endif -#ifndef MK_C_OFFSET_MED -#define MK_C_OFFSET_MED 4 +#ifndef MK_C_OFFSET_0 +#define MK_C_OFFSET_0 1 #endif -#ifndef MK_C_INTERVAL_MED -#define MK_C_INTERVAL_MED 16 +#ifndef MK_C_INTERVAL_0 +#define MK_C_INTERVAL_0 32 #endif -#ifndef MK_C_OFFSET_FAST -#define MK_C_OFFSET_FAST 12 +#ifndef MK_C_OFFSET_1 +#define MK_C_OFFSET_1 4 #endif -#ifndef MK_C_INTERVAL_FAST -#define MK_C_INTERVAL_FAST 16 +#ifndef MK_C_INTERVAL_1 +#define MK_C_INTERVAL_1 16 +#endif +#ifndef MK_C_OFFSET_2 +#define MK_C_OFFSET_2 32 +#endif +#ifndef MK_C_INTERVAL_2 +#define MK_C_INTERVAL_2 16 #endif -#ifndef MK_W_OFFSET_SLOW -#define MK_W_OFFSET_SLOW 1 +#ifndef MK_W_OFFSET_UNMOD +#define MK_W_OFFSET_UNMOD 1 +#endif +#ifndef MK_W_INTERVAL_UNMOD +#define MK_W_INTERVAL_UNMOD 40 +#endif +#ifndef MK_W_OFFSET_0 +#define MK_W_OFFSET_0 1 #endif -#ifndef MK_W_INTERVAL_SLOW -#define MK_W_INTERVAL_SLOW 400 +#ifndef MK_W_INTERVAL_0 +#define MK_W_INTERVAL_0 360 #endif -#ifndef MK_W_OFFSET_MED -#define MK_W_OFFSET_MED 1 +#ifndef MK_W_OFFSET_1 +#define MK_W_OFFSET_1 1 #endif -#ifndef MK_W_INTERVAL_MED -#define MK_W_INTERVAL_MED 200 +#ifndef MK_W_INTERVAL_1 +#define MK_W_INTERVAL_1 120 #endif -#ifndef MK_W_OFFSET_FAST -#define MK_W_OFFSET_FAST 1 +#ifndef MK_W_OFFSET_2 +#define MK_W_OFFSET_2 1 #endif -#ifndef MK_W_INTERVAL_FAST -#define MK_W_INTERVAL_FAST 100 +#ifndef MK_W_INTERVAL_2 +#define MK_W_INTERVAL_2 20 #endif #endif /* #ifndef MK_3_SPEED */ From 5ed7d9c9ca48e1b6f3610f62bb12668d1f75a845 Mon Sep 17 00:00:00 2001 From: Markus Weimar Date: Fri, 19 Apr 2019 16:27:23 +0200 Subject: [PATCH 13/61] Update XD75 keymap by markus (#5651) --- keyboards/xd75/keymaps/markus/config.h | 39 ++++++-- keyboards/xd75/keymaps/markus/keymap.c | 127 ++++++++++++------------ keyboards/xd75/keymaps/markus/readme.md | 8 +- keyboards/xd75/keymaps/markus/rules.mk | 36 +++---- 4 files changed, 109 insertions(+), 101 deletions(-) diff --git a/keyboards/xd75/keymaps/markus/config.h b/keyboards/xd75/keymaps/markus/config.h index 4e4e6f0d73..a3e1631715 100644 --- a/keyboards/xd75/keymaps/markus/config.h +++ b/keyboards/xd75/keymaps/markus/config.h @@ -1,4 +1,4 @@ -/* Copyright 2018 Markus Weimar +/* Copyright 2019 Markus Weimar * * 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 @@ -18,12 +18,31 @@ // place overrides here -// Mousekeys -#define MOUSEKEY_MOVE_DELTA 1 -#define MOUSEKEY_WHEEL_DELTA 1 -#define MOUSEKEY_DELAY 90 -#define MOUSEKEY_INTERVAL 16 -#define MOUSEKEY_MAX_SPEED 20 -#define MOUSEKEY_TIME_TO_MAX 0 -#define MOUSEKEY_WHEEL_MAX_SPEED 1 -#define MOUSEKEY_WHEEL_TIME_TO_MAX 0 +// Mouse keys (accelerated) +//#define MOUSEKEY_MOVE_DELTA 1 +//#define MOUSEKEY_WHEEL_DELTA 1 +//#define MOUSEKEY_DELAY 90 +//#define MOUSEKEY_INTERVAL 16 +//#define MOUSEKEY_MAX_SPEED 20 +//#define MOUSEKEY_TIME_TO_MAX 0 +//#define MOUSEKEY_WHEEL_MAX_SPEED 1 +//#define MOUSEKEY_WHEEL_TIME_TO_MAX 0 +// Mouse keys (constant) +#define MK_3_SPEED +#define MK_MOMENTARY_ACCEL +#define MK_C_OFFSET_UNMOD 18 +#define MK_C_INTERVAL_UNMOD 16 +#define MK_C_OFFSET_0 2 +#define MK_C_INTERVAL_0 16 +#define MK_C_OFFSET_1 6 +#define MK_C_INTERVAL_1 16 +#define MK_C_OFFSET_2 36 +#define MK_C_INTERVAL_2 16 +#define MK_W_OFFSET_UNMOD 1 +#define MK_W_INTERVAL_UNMOD 40 +#define MK_W_OFFSET_0 1 +#define MK_W_INTERVAL_0 360 +#define MK_W_OFFSET_1 1 +#define MK_W_INTERVAL_1 120 +#define MK_W_OFFSET_2 1 +#define MK_W_INTERVAL_2 20 diff --git a/keyboards/xd75/keymaps/markus/keymap.c b/keyboards/xd75/keymaps/markus/keymap.c index eaf6201515..9b8ab52fc3 100644 --- a/keyboards/xd75/keymaps/markus/keymap.c +++ b/keyboards/xd75/keymaps/markus/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2018 Markus Weimar +/* Copyright 2019 Markus Weimar * * 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 @@ -19,30 +19,29 @@ #define ________ KC_TRNS #define ___xx___ KC_NO -#define NKRO_TG MAGIC_TOGGLE_NKRO enum my_layers { - _QWZ, - _QWY, - _GAM, - _FN1, - _FN2, - _FN3, + _QWZ, + _QWY, + _GAM, + _FN1, + _FN2, + _FN3, }; enum my_keycodes { - QWERTZ = SAFE_RANGE, - QWERTY, - GAMING, - FN1, - FN2, - FN3 + QWERTZ = SAFE_RANGE, + QWERTY, + GAMING, + FN1, + FN2, + FN3 }; enum my_ucis { - UNI_LNX, - UNI_MAC, - UNI_WIN, + UNI_LNX, + UNI_MAC, + UNI_WIN, }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -118,7 +117,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| * | | " | ' | ‚ | ‘ | ’ | | | | | | [ | ] | ! | ? | | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | | ° | ^ | „ | “ | ” | | | | # | < | > | … | – | | + * | | ° | ^ | „ | “ | ” | | | | # | < | > | … | – EN | | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| * | | | | | | | | | | | | | | | | * '--------------------------------------------------------------------------------------------------------------------------------------' @@ -133,19 +132,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* FN2 * .--------------------------------------------------------------------------------------------------------------------------------------. - * | | | | | % | ( | ) | P/ | P* | P- | Print | Scroll | Pause | ẞ | | + * | | | | | % | ( | ) | P/ | P* | P- | Print | Scroll | Pause | ẞ | − MNS | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| * | | | Mute | Vol- | Vol+ | Bspc | P7 | P8 | P9 | P+ | WH_U | MS_U | WH_D | × | ÷ | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | | App | ACL0 | ACL1 | ACL2 | Space | P4 | P5 | P6 | WH_L | MS_L | MS_D | MS_R | WH_R | | + * | | App | ACL2 | ACL1 | ACL0 | Space | P4 | P5 | P6 | WH_L | MS_L | MS_D | MS_R | WH_R | | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | | | Prev | Play | Next | Tab | P1 | P2 | P3 | PEnter | BTN1 | BTN2 | BTN3 | — | | + * | | | Prev | Play | Next | Tab | P1 | P2 | P3 | PEnter | BTN1 | BTN2 | BTN3 | — EM | | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| * | Fn2 | | | | | PEnter | P0 | . : | P, | BTN1 | BTN2 | BTN3 | | | | * '--------------------------------------------------------------------------------------------------------------------------------------' */ [_FN2] = { -{ ___xx___, ___xx___, ___xx___, ___xx___, DE_PERC, DE_LPRN, DE_RPRN, KC_PSLS, KC_PAST, KC_PMNS, KC_PSCR, KC_LSCR, KC_PAUS, UC(L'ẞ'), ___xx___ }, +{ ___xx___, ___xx___, ___xx___, ___xx___, DE_PERC, DE_LPRN, DE_RPRN, KC_PSLS, KC_PAST, KC_PMNS, KC_PSCR, KC_LSCR, KC_PAUS, UC(L'ẞ'), UC(L'−') }, { ________, ___xx___, KC_MUTE, KC_VOLD, KC_VOLU, KC_BSPC, KC_P7, KC_P8, KC_P9, KC_PPLS, KC_WH_U, KC_MS_U, KC_WH_D, UC(L'×'), UC(L'÷') }, { ________, KC_APP, KC_ACL2, KC_ACL1, KC_ACL0, KC_SPC, KC_P4, KC_P5, KC_P6, KC_WH_L, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_R, ________ }, { ________, ___xx___, KC_MPRV, KC_MPLY, KC_MNXT, KC_TAB, KC_P1, KC_P2, KC_P3, KC_PENT, KC_BTN1, KC_BTN2, KC_BTN3, UC(L'—'), ________ }, @@ -156,61 +155,61 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * .--------------------------------------------------------------------------------------------------------------------------------------. * | F13 | F14 | F15 | F16 | F17 | F18 | U LNX | U WIN | U MAC | F19 | F20 | F21 | F22 | F23 | F24 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | | QWERTZ | QWERTY | | NKRO | ThinSp | L TOG | L MP | L MOD | | Pg Up | Up | Pg Dn | | | + * | | QWERTZ | QWERTY | GAMING | | | L TOG | L MP | L MOD | | Pg Up | Up | Pg Dn | | | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | | NaNbSp | | › | ‹ | GAMING | L HUI | L SAI | L VAI | Home | Left | Down | Right | End | | + * | | | | › | ‹ | | L HUI | L SAI | L VAI | Home | Left | Down | Right | End | | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | | | | » | « | | L HUD | L SAD | L VAD | FigSp | | | | NbHyph | | + * | | | | » | « | | L HUD | L SAD | L VAD | NumSp | ThinSp | NaNbSp | NbSp | NbHyph | | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | | | | | | | | Reset | | NbSp | | | | | | + * | | | | | | | | Reset | | | | | | | | * '--------------------------------------------------------------------------------------------------------------------------------------' */ [_FN3] = { { KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, UNI_LNX, UNI_WIN, UNI_MAC, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24 }, -{ ________, QWERTZ, QWERTY, ___xx___, NKRO_TG, UC(L' '), RGB_TOG, RGB_M_P, RGB_MOD, ___xx___, KC_PGUP, KC_UP, KC_PGDN, ___xx___, ___xx___ }, -{ ________, UC(L' '), ___xx___, UC(L'›'), UC(L'‹'), GAMING, RGB_HUI, RGB_SAI, RGB_VAI, KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT, KC_END, ________ }, -{ ________, ___xx___, ___xx___, UC(L'»'), UC(L'«'), ___xx___, RGB_HUD, RGB_SAD, RGB_VAD, UC(L' '), ___xx___, ___xx___, ___xx___, UC(L'‑'), ________ }, -{ ___xx___, ________, ________, ________, ________, ________, ________, RESET, ________, UC(L' '), ________, ________, ________, ________, ________ }, +{ ________, QWERTZ, QWERTY, GAMING, ___xx___, ___xx___, RGB_TOG, RGB_M_P, RGB_MOD, ___xx___, KC_PGUP, KC_UP, KC_PGDN, ___xx___, ___xx___ }, +{ ________, ___xx___, ___xx___, UC(L'›'), UC(L'‹'), ___xx___, RGB_HUI, RGB_SAI, RGB_VAI, KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT, KC_END, ________ }, +{ ________, ___xx___, ___xx___, UC(L'»'), UC(L'«'), ___xx___, RGB_HUD, RGB_SAD, RGB_VAD, UC(L' '), UC(L' '), UC(L' '), UC(L' '), UC(L'‑'), ________ }, +{ ___xx___, ________, ________, ________, ________, ________, ________, RESET, ________, ________, ________, ________, ________, ________, ________ }, }, }; void matrix_init_user(){ - set_unicode_input_mode(UC_LNX); + set_unicode_input_mode(UC_LNX); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch(keycode) { - case QWERTZ: - if (record->event.pressed) { - set_single_persistent_default_layer(_QWZ); - } - return false; - break; - case QWERTY: - if (record->event.pressed) { - set_single_persistent_default_layer(_QWY); - } - return false; - break; - case GAMING: - if (record->event.pressed) { - set_single_persistent_default_layer(_GAM); - } - return false; - break; - case UNI_LNX: - set_unicode_input_mode(UC_LNX); - return false; - break; - case UNI_WIN: - set_unicode_input_mode(UC_WINC); - return false; - break; - case UNI_MAC: - set_unicode_input_mode(UC_OSX); - return false; - break; - } - return true; + switch(keycode) { + case QWERTZ: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWZ); + } + return false; + break; + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWY); + } + return false; + break; + case GAMING: + if (record->event.pressed) { + set_single_persistent_default_layer(_GAM); + } + return false; + break; + case UNI_LNX: + set_unicode_input_mode(UC_LNX); + return false; + break; + case UNI_WIN: + set_unicode_input_mode(UC_WINC); + return false; + break; + case UNI_MAC: + set_unicode_input_mode(UC_OSX); + return false; + break; + } + return true; } diff --git a/keyboards/xd75/keymaps/markus/readme.md b/keyboards/xd75/keymaps/markus/readme.md index 9262812405..fc5959bcdc 100644 --- a/keyboards/xd75/keymaps/markus/readme.md +++ b/keyboards/xd75/keymaps/markus/readme.md @@ -2,15 +2,15 @@ This keymap has three base layers (QWERTZ, QWERTY, Gaming) and three function layers (Fn1, Fn2, Fn3). -QWERTY is identical to QWERTZ except `z` and `y` are swapped. +QWERTY is identical to QWERTZ, except `z` and `y` are swapped. Gaming is a modified QWERTY layer for left-hand usage. The function layers contain: -* Symbols (standard and Unicode) +* Symbols +* Unicode characters (e.g. dashes, figure space, non-breaking space and hyphen) * Unicode input mode switches * Numpad * Function keys -* Media, mouse, LED control -* Non-breaking characters +* Media, mouse and LED controls diff --git a/keyboards/xd75/keymaps/markus/rules.mk b/keyboards/xd75/keymaps/markus/rules.mk index d0ed9a73ae..22befc5349 100644 --- a/keyboards/xd75/keymaps/markus/rules.mk +++ b/keyboards/xd75/keymaps/markus/rules.mk @@ -1,23 +1,13 @@ -# Build Options -# change to "no" to disable the options, or define them in the Makefile in -# the appropriate keymap folder that will get included automatically -# -BOOTMAGIC_ENABLE = no # 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 -NKRO_ENABLE = yes # 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 -MIDI_ENABLE = no # MIDI controls -AUDIO_ENABLE = no # Audio output on port C6 -UNICODEMAP_ENABLE = no # This allows sending unicode symbols using X() in your keymap. -UNICODE_ENABLE = yes # Unicode -UCIS_ENABLE = no # Keep in mind that not all will work (See WinCompose for details on Windows). -BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. -API_SYSEX_ENABLE = no - -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend - +BOOTMAGIC_ENABLE = no +MOUSEKEY_ENABLE = yes +EXTRAKEY_ENABLE = yes +CONSOLE_ENABLE = no +COMMAND_ENABLE = no +NKRO_ENABLE = yes +BACKLIGHT_ENABLE = no +MIDI_ENABLE = no +AUDIO_ENABLE = no +UNICODE_ENABLE = yes +BLUETOOTH_ENABLE = no +RGBLIGHT_ENABLE = yes +SLEEP_LED_ENABLE = no From 7fa854729c4391e5ae3b09e134eccd73f1307ac1 Mon Sep 17 00:00:00 2001 From: Salt-Peanuts Date: Fri, 19 Apr 2019 12:23:11 -0400 Subject: [PATCH 14/61] [Keymap] Added personal keymap to BFO-9000; cleaned up personal files in Kinesis and Rorschach (#5638) * Added personal keymap to BFO-9000; cleaned up personal Kinesis and Rorschach files Added personal keymap to BFO-9000; cleaned up personal Kinesis and Rorschach files * Update keymap.c * Update keymap.c * Update keymap.c * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md --- .../keymaps/insertsnideremarks/config.h | 42 ++ .../keymaps/insertsnideremarks/keymap.c | 381 ++++++++++++++++++ .../keymaps/insertsnideremarks/rules.mk | 19 + .../keymaps/insertsnideremarks/config.h | 2 +- .../keymaps/insertsnideremarks/keymap.c | 9 +- .../keymaps/insertsnideremarks/rules.mk | 2 +- .../keymaps/insertsnideremarks/config.h | 2 +- .../keymaps/insertsnideremarks/keymap.c | 45 +-- .../keymaps/insertsnideremarks/readme.md | 64 +-- 9 files changed, 499 insertions(+), 67 deletions(-) create mode 100644 keyboards/keebio/bfo9000/keymaps/insertsnideremarks/config.h create mode 100644 keyboards/keebio/bfo9000/keymaps/insertsnideremarks/keymap.c create mode 100644 keyboards/keebio/bfo9000/keymaps/insertsnideremarks/rules.mk diff --git a/keyboards/keebio/bfo9000/keymaps/insertsnideremarks/config.h b/keyboards/keebio/bfo9000/keymaps/insertsnideremarks/config.h new file mode 100644 index 0000000000..344634063c --- /dev/null +++ b/keyboards/keebio/bfo9000/keymaps/insertsnideremarks/config.h @@ -0,0 +1,42 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +Copyright 2015 Jack Humbert + +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 . +*/ + +#pragma once + +/* Use I2C or Serial, not both */ + +// #define USE_SERIAL +#define USE_I2C + +/* Select hand configuration */ +// #define MASTER_LEFT +// #define MASTER_RIGHT +#define EE_HANDS + +#define IGNORE_MOD_TAP_INTERRUPT +#define TAPPING_TERM 150 +#define TAPPING_TOGGLE 2 + +// #undef RGBLED_NUM +// #define RGBLIGHT_ANIMATIONS +// #define RGBLED_NUM 12 +// #define RGBLIGHT_HUE_STEP 8 +// #define RGBLIGHT_SAT_STEP 8 +// #define RGBLIGHT_VAL_STEP 8 \ No newline at end of file diff --git a/keyboards/keebio/bfo9000/keymaps/insertsnideremarks/keymap.c b/keyboards/keebio/bfo9000/keymaps/insertsnideremarks/keymap.c new file mode 100644 index 0000000000..d15569ee96 --- /dev/null +++ b/keyboards/keebio/bfo9000/keymaps/insertsnideremarks/keymap.c @@ -0,0 +1,381 @@ +#include QMK_KEYBOARD_H + +extern keymap_config_t keymap_config; + +enum bfo9000_layers { + _COLEMAK, // Colemak (default layer) + _QWERTY, // Qwerty + _COLEMAKGM, // Colemak gaming/vanilla (limited dual-role keys with layer access) + _QWERTYGM, // QWERTY gaming/vanilla (limited dual-role keys with layer access) + _NUMBERS, // Numbers & Symbols + _NUMBERS2, // Numbers & Symbols 2 (identical as _NUMBERS; basically used for tri-layer access to _ADJUST) + _FUNCTION, // Function + _FUNCTION2, // Function 2 (identical as _FUNCTION; used to allow for easier use of space and backspace while using function layer arrows) + _NUMPAD, // Numpad + _ADJUST, // Adjust layer (accessed via tri-layer feature) + _ADJUST2 // Second Adjust layer (accessed outside of tri-layer feature) +}; + +enum bfo9000_keycodes { + COLEMAK = SAFE_RANGE, + QWERTY, + COLEMAKGM, + QWERTYGM, + NUMPAD = TG(_NUMPAD), + ADJUST = MO(_ADJUST2), + SPCFN = LT(_FUNCTION, KC_SPC), + BSPCFN = LT(_FUNCTION2, KC_BSPC), + ENTNS = LT(_NUMBERS, KC_ENT), + DELNS = LT(_NUMBERS2, KC_DEL), + CTLESC = CTL_T(KC_ESC), + ALTAPP = ALT_T(KC_APP), + NKROTG = MAGIC_TOGGLE_NKRO +}; + +//Tap Dance Declarations +enum { + ADJ = 0, + LBCB, + RBCB, + EQPL, + PLEQ, + MNUN, + SLAS, + GVTL, + PPLEQ, + PMNUN, + PSLPAS +}; + +void dance_LAYER_finished(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 2) { + layer_on(_ADJUST2); + set_oneshot_layer(_ADJUST2, ONESHOT_START); + } +} +void dance_LAYER_reset(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 2) { + layer_off(_ADJUST2); + clear_oneshot_layer_state(ONESHOT_PRESSED); + } +} + +qk_tap_dance_action_t tap_dance_actions[] = { +[ADJ] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_LAYER_finished, dance_LAYER_reset), // Double-tap to activate Adjust layer via oneshot layer +[LBCB] = ACTION_TAP_DANCE_DOUBLE(KC_LBRC, KC_LCBR), // Left bracket on a single-tap, left brace on a double-tap +[RBCB] = ACTION_TAP_DANCE_DOUBLE(KC_RBRC, KC_RCBR), // Right bracket on a single-tap, right brace on a double-tap +[EQPL] = ACTION_TAP_DANCE_DOUBLE(KC_EQL, KC_PLUS), // Plus sign on a single-tap, equal sign on a double-tap +[PLEQ] = ACTION_TAP_DANCE_DOUBLE(KC_PLUS, KC_EQL), // Equal sign on a single-tap, plus sign on a double-tap +[MNUN] = ACTION_TAP_DANCE_DOUBLE(KC_MINS, KC_UNDS), // Minus sign on a single-tap, underscore on a double-tap +[SLAS] = ACTION_TAP_DANCE_DOUBLE(KC_SLSH, KC_ASTR), // Slash in a single-tap, asterisk in a double-tap +[GVTL] = ACTION_TAP_DANCE_DOUBLE(KC_GRV, KC_TILD), // Grave on a single-tap, tilde on a double-tap +[PPLEQ] = ACTION_TAP_DANCE_DOUBLE(KC_PPLS, KC_EQL), // Numpad plus sign on a single-tap, equal sign on a double-tap +[PMNUN] = ACTION_TAP_DANCE_DOUBLE(KC_PMNS, KC_UNDS), // Numpad minus sign on a single-tap, underscore on a double-tap +[PSLPAS] = ACTION_TAP_DANCE_DOUBLE(KC_PSLS, KC_PAST) // Numpad slash on a single-tap, numpad asterisk on a double-tap +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Colemak + (Default layer; keys separated by /: tap for first, hold for second; uses Space Cadet Shifts) + ,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------. + | ESC | F1 | F2 | F3 | F4 | F5 | | | | | Adjust| | F12 | F6 | F7 | F8 | F9 | F10 | F11 | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | = | 1 | 2 | 3 | 4 | 5 | | | | | Numpad| | | 6 | 7 | 8 | 9 | 0 | - | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | Tab | Q | W | F | P | G | | | Home | | Pause | | | J | L | U | Y | ; | \ | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + |Esc/Ctl| A | R | S | T | D | | | PgUp | | ScrLck| | | H | N | E | I | O | ' | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + |SCShift| Z | X | C | V | B |Esc/Ctl|App/Alt| PgDn | | PrtScr| RAlt | RCtl | K | M | , | . | / |SCShift| + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | Ins | ` | [ | ] |App/Alt| Spc/Fn| Ent/NS| Bspc | End | | | Enter |Del/NS2|Bsp/Fn2| RGUI | Left | Down | Up | Right | + `-----------------------------------------------------------------------' `-----------------------------------------------------------------------' +*/ +[_COLEMAK] = LAYOUT( \ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, ADJUST, _______, KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, _______, NUMPAD, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, _______, _______, KC_HOME, KC_PAUS, _______, _______, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS, + CTLESC, KC_A, KC_R, KC_S, KC_T, KC_D, _______, _______, KC_PGUP, KC_SLCK, _______, _______, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, CTLESC, ALTAPP, KC_PGDN, KC_PSCR, KC_RALT, KC_RCTL, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, + KC_INS, KC_GRV, KC_LBRC, KC_RBRC, ALTAPP, SPCFN, ENTNS, KC_BSPC, KC_END, _______, KC_ENT, DELNS, BSPCFN, KC_RGUI, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* QWERTY + (Keys separated by /: tap for first, hold for second; uses Space Cadet Shifts) + ,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------. + | ESC | F1 | F2 | F3 | F4 | F5 | | | | | Adjust| | F12 | F6 | F7 | F8 | F9 | F10 | F11 | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | = | 1 | 2 | 3 | 4 | 5 | | | | | Numpad| | | 6 | 7 | 8 | 9 | 0 | - | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | Tab | Q | W | E | R | T | | | Home | | Pause | | | Y | U | I | O | P | \ | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + |Esc/Ctl| A | S | D | F | G | | | PgUp | | ScrLck| | | H | J | K | L | ; | ' | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + |SCShift| Z | X | C | V | B |Esc/Ctl|App/Alt| PgDn | | PrtScr| RAlt | RCtl | N | M | , | . | / |SCShift| + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | Ins | ` | [ | ] |App/Alt| Spc/Fn| Ent/NS| Bspc | End | | | Enter |Del/NS2|Bsp/Fn2| RGUI | Left | Down | Up | Right | + `-----------------------------------------------------------------------' `-----------------------------------------------------------------------' +*/ +[_QWERTY] = LAYOUT( \ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, ADJUST, _______, KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, NUMPAD, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_HOME, KC_PAUS, _______, _______, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + CTLESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_PGUP, KC_SLCK, _______, _______, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, CTLESC, ALTAPP, KC_PGDN, KC_PSCR, KC_RALT, KC_RCTL, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, + KC_INS, KC_GRV, KC_LBRC, KC_RBRC, ALTAPP, SPCFN, ENTNS, KC_BSPC, KC_END, _______, KC_ENT, DELNS, BSPCFN, KC_RGUI, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* Numbers/Symbols layer + (Multiple characters: single-tap for first, double-tap for second) + ,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------. + | | | | | | | | | | | | | | | | | | | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | F12 | F1 | F2 | F3 | F4 | F5 | | | | | | | | F6 | F7 | F8 | F9 | F10 | F12 | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | | 6 | 7 | 8 | 9 | 0 | | | | | | | | ^ | & | * | ( | ) | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | | 1 | 2 | 3 | 4 | 5 | | | | | | | | ! | @ | # | $ | % | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | | | . | / * | - _ | + = | | | | | | | | ` ~ | [ { | ] } | | | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | ( | ) | [ { | ] } | | | | | | | | | | | | | | | | + `-----------------------------------------------------------------------' `-----------------------------------------------------------------------' +*/ +[_NUMBERS] = LAYOUT( \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, _______, _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + _______, KC_6, KC_7, KC_8, KC_9, KC_0, _______, _______, _______, _______, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, + _______, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, _______, _______, _______, _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, + _______, _______, KC_DOT, TD(SLAS), TD(MNUN), TD(PLEQ), _______, _______, _______, _______, _______, _______, TD(GVTL), TD(LBCB), TD(RBCB), _______, _______, _______, + KC_LPRN, KC_RPRN, TD(LBCB), TD(RBCB), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +), + +[_NUMBERS2] = LAYOUT( \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, _______, _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + _______, KC_6, KC_7, KC_8, KC_9, KC_0, _______, _______, _______, _______, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, + _______, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, _______, _______, _______, _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, + _______, _______, KC_DOT, TD(SLAS), TD(MNUN), TD(PLEQ), _______, _______, _______, _______, _______, _______, TD(GVTL), TD(LBCB), TD(RBCB), _______, _______, _______, + KC_LPRN, KC_RPRN, TD(LBCB), TD(RBCB), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +), + +/* Function layer + ,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------. + | | | | | | | | | | | | | | | | | | | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | F12 | F1 | F2 | F3 | F4 | F5 | | | | | | | | F6 | F7 | F8 | F9 | F10 | F12 | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | | | | Up | | | | | | | | | | | | Up | Ctrl+Y| | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | | Ctrl+A| Left | Down | Right | C+A+Tb| | | | | | | | PgUp | Right | Down | Left | Home | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | | Ctrl+Z| Ctrl+X| Ctrl+C| Ctrl+V| Bspc | | | | | | | | PgDn | Mute | Vol- | Vol+ | End | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | | | | | | | | | | | | | | | | Prev | Play | Next | Stop | + `-----------------------------------------------------------------------' `-----------------------------------------------------------------------' +*/ +[_FUNCTION] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, _______, _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + _______, _______, _______, KC_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_UP, LCTL(KC_Y), _______, _______, + _______, LCTL(KC_A), KC_LEFT, KC_DOWN, KC_RGHT, LCA(KC_TAB), _______, _______, _______, _______, _______, _______, KC_PGUP, KC_LEFT, KC_DOWN, KC_RGHT, KC_HOME, _______, + _______, LCTL(KC_Z), LCTL(KC_X), LCTL(KC_C), LCTL(KC_V), KC_BSPC, _______, _______, _______, _______, _______, _______, KC_PGDN, KC_MUTE, KC_VOLD, KC_VOLU, KC_END, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, KC_MSTP +), + +[_FUNCTION2] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, _______, _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + _______, _______, _______, KC_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_UP, LCTL(KC_Y), _______, _______, + _______, LCTL(KC_A), KC_LEFT, KC_DOWN, KC_RGHT, LCA(KC_TAB), _______, _______, _______, _______, _______, _______, KC_PGUP, KC_LEFT, KC_DOWN, KC_RGHT, KC_HOME, _______, + _______, LCTL(KC_Z), LCTL(KC_X), LCTL(KC_C), LCTL(KC_V), KC_BSPC, _______, _______, _______, _______, _______, _______, KC_PGDN, KC_MUTE, KC_VOLD, KC_VOLU, KC_END, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, KC_MSTP +), + +/* Numpad layer + (Left side duplicates layout from the Numbers layer, just with numpad output; right side layout close to PC numpad layout) + ,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------. + | | | | | | | | | | | | | | | | | | | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | | NumLk | | | | | | | | | | | Tab | NumLk | KP / | KP * | KP - | | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | | KP 6 | KP 7 | KP 8 | KP 9 | KP 0 | | | | | | | | KP 7 | KP 8 | KP 9 | KP + | | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | | KP 1 | KP 2 | KP 3 | KP 4 | KP 5 | | | | | | | | KP 4 | KP 5 | KP 6 | = | | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | | | KP . |KP/ KP*| KP- _ | KP+ = | | | | | | | | KP 1 | KP 2 | KP 3 | KP Ent| | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | ( | ) | [ { | ] } | | | | | | | | | | | KP 0 | KP . | KP Ent| | | + `-----------------------------------------------------------------------' `-----------------------------------------------------------------------' +*/ +[_NUMPAD] = LAYOUT( \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, KC_NLCK, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_TAB, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, _______, + _______, KC_P6, KC_P7, KC_P8, KC_P9, KC_P0, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, _______, + _______, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, KC_EQL, _______, + _______, _______, KC_PDOT, TD(PSLPAS), TD(PMNUN), TD(PPLEQ), _______, _______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, KC_PENT, _______, + KC_LPRN, KC_RPRN, TD(LBCB), TD(RBCB), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P0, KC_PDOT, KC_PENT, _______ +), + +/* Colemak gaming/vanilla + (Limited access to Function or Numbers layers; mainly used for gaming; Ent/NS + Del/NS2 on right side to access Adjust layer) + ,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------. + | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | | Adjust| | F12 | F6 | F7 | F8 | F9 | F10 | F11 | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | = | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | | Numpad| | | 6 | 7 | 8 | 9 | 0 | - | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | Tab | Q | W | F | P | G | J | L | Home | | Pause | | | J | L | U | Y | ; | \ | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | LCtl | A | R | S | T | D | H | N | PgUp | | ScrLck| | | H | N | E | I | O | ' | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | Shift | Z | X | C | V | B | Esc | LAlt | PgDn | | PrtScr| RAlt | RCtl | K | M | , | . | / | Shift | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | Ins | ` | [ | ] | LAlt | Space | Enter | Bspc | End | | | Ent/NS|Del/NS2|Bsp/Fn2| RGUI | Left | Down | Up | Right | + `-----------------------------------------------------------------------' `-----------------------------------------------------------------------' +*/ +[_COLEMAKGM] = LAYOUT( \ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, ADJUST, _______, KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, NUMPAD, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_HOME, KC_PAUS, _______, _______, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS, + KC_LCTL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_PGUP, KC_SLCK, _______, _______, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_ESC, KC_LALT, KC_PGDN, KC_PSCR, KC_RALT, KC_RCTL, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_INS, KC_GRV, KC_LBRC, KC_RBRC, KC_LALT, KC_SPC, KC_ENT, KC_BSPC, KC_END, _______, ENTNS, DELNS, BSPCFN, KC_RGUI, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* QWERTY gaming/vanilla + (Limited access to Function or Numbers layers; mainly used for gaming; Ent/NS + Del/NS2 on right side to access Adjust layer) + ,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------. + | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | | Adjust| | F12 | F6 | F7 | F8 | F9 | F10 | F11 | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | = | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | | Numpad| | | 6 | 7 | 8 | 9 | 0 | - | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | Tab | Q | W | E | T | Y | U | I | Home | | Pause | | | Y | U | I | O | P | \ | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | LCtl | A | S | D | F | G | H | J | PgUp | | ScrLck| | | H | J | K | L | ; | ' | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | Shift | Z | X | C | V | B | Esc | LAlt | PgDn | | PrtScr| RAlt | RCtl | N | M | , | . | / | Shift | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | Ins | ` | [ | ] | LAlt | Space | Enter | Bspc | End | | | Ent/NS|Del/NS2|Bsp/Fn2| RGUI | Left | Down | Up | Right | + `-----------------------------------------------------------------------' `-----------------------------------------------------------------------' +*/ +[_QWERTYGM] = LAYOUT( \ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, ADJUST, _______, KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, NUMPAD, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_HOME, KC_PAUS, _______, _______, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_PGUP, KC_SLCK, _______, _______, 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_ESC, KC_LALT, KC_PGDN, KC_PSCR, KC_RALT, KC_RCTL, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_INS, KC_GRV, KC_LBRC, KC_RBRC, KC_LALT, KC_SPC, KC_ENT, KC_BSPC, KC_END, _______, ENTNS, DELNS, BSPCFN, KC_RGUI, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* Adjust layer + (Enter/Number + Delete/Number2 under non-gaming/vanilla layers or press & hold Adjust key on function row; Numpad is a toggle) + ,-----------------------------------------------------------------------. ,-----------------------------------------------------------------------. + | | | | | | | | | | | | | | | | | | | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | |Colemak| Qwerty| |ColmkGM| QWGM | | | | | | | | Numpad| | | | | RESET | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | | | | | | | | | | | | | | | | | | | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | | | | | | | | | | | | | | | NKROTG| | | | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | | | | | | | | | | | | | | | | | | | | + |-------+-------+-------+-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------+-------+-------+-------| + | | | | | | | | | | | | | | | | | | | | + `-----------------------------------------------------------------------' `-----------------------------------------------------------------------' +*/ +[_ADJUST] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, COLEMAK, QWERTY, _______, COLEMAKGM, QWERTYGM, _______, _______, _______, _______, _______, _______, NUMPAD, _______, _______, _______, _______, RESET, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NKROTG, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +), + +[_ADJUST2] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, COLEMAK, QWERTY, _______, COLEMAKGM, QWERTYGM, _______, _______, _______, _______, _______, _______, NUMPAD, _______, _______, _______, _______, RESET, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NKROTG, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +) + +}; + + +uint32_t layer_state_set_user(uint32_t state) { + return update_tri_layer_state(state, _NUMBERS, _NUMBERS2, _ADJUST); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case COLEMAK: + if (record->event.pressed) { + default_layer_set(1UL << _COLEMAK); +// persistent_default_layer_set(1UL << _COLEMAK); + layer_off ( _QWERTY); + layer_off ( _NUMBERS); + layer_off ( _NUMBERS2); + layer_off ( _FUNCTION); + layer_off ( _FUNCTION2); + layer_off ( _NUMPAD); + layer_off ( _COLEMAKGM); + layer_off ( _QWERTYGM); + layer_off ( _ADJUST); + layer_off ( _ADJUST2); + } + return false; + break; + case QWERTY: + if (record->event.pressed) { + default_layer_set(1UL << _QWERTY); +// persistent_default_layer_set(1UL << _QWERTY); + layer_off ( _COLEMAK); + layer_off ( _NUMBERS); + layer_off ( _NUMBERS2); + layer_off ( _FUNCTION); + layer_off ( _FUNCTION2); + layer_off ( _NUMPAD); + layer_off ( _COLEMAKGM); + layer_off ( _QWERTYGM); + layer_off ( _ADJUST); + layer_off ( _ADJUST2); + } + return false; + break; + case COLEMAKGM: + if (record->event.pressed) { + default_layer_set(1UL << _COLEMAKGM); + layer_off ( _QWERTY); + layer_off ( _COLEMAK); + layer_off ( _NUMBERS); + layer_off ( _NUMBERS2); + layer_off ( _FUNCTION); + layer_off ( _FUNCTION2); + layer_off ( _NUMPAD); + layer_off ( _QWERTYGM); + layer_off ( _ADJUST); + layer_off ( _ADJUST2); + } + return false; + break; + case QWERTYGM: + if (record->event.pressed) { + default_layer_set(1UL << _QWERTYGM); + layer_off ( _QWERTY); + layer_off ( _COLEMAK); + layer_off ( _NUMBERS); + layer_off ( _NUMBERS2); + layer_off ( _FUNCTION); + layer_off ( _FUNCTION2); + layer_off ( _NUMPAD); + layer_off ( _COLEMAKGM); + layer_off ( _ADJUST); + layer_off ( _ADJUST2); + } + return false; + break; + } + return true; +} diff --git a/keyboards/keebio/bfo9000/keymaps/insertsnideremarks/rules.mk b/keyboards/keebio/bfo9000/keymaps/insertsnideremarks/rules.mk new file mode 100644 index 0000000000..cf63c44f4f --- /dev/null +++ b/keyboards/keebio/bfo9000/keymaps/insertsnideremarks/rules.mk @@ -0,0 +1,19 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# + +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # 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 +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = yes # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +TAP_DANCE_ENABLE = yes # Enable Tap Dancing function diff --git a/keyboards/keebio/rorschach/keymaps/insertsnideremarks/config.h b/keyboards/keebio/rorschach/keymaps/insertsnideremarks/config.h index 2048232c9c..ed948a4b3b 100644 --- a/keyboards/keebio/rorschach/keymaps/insertsnideremarks/config.h +++ b/keyboards/keebio/rorschach/keymaps/insertsnideremarks/config.h @@ -12,7 +12,7 @@ #define EE_HANDS #define IGNORE_MOD_TAP_INTERRUPT -#define TAPPING_TERM 175 +#define TAPPING_TERM 150 #define TAPPING_TOGGLE 2 // #undef RGBLED_NUM diff --git a/keyboards/keebio/rorschach/keymaps/insertsnideremarks/keymap.c b/keyboards/keebio/rorschach/keymaps/insertsnideremarks/keymap.c index 81c163a028..e345ce4a38 100644 --- a/keyboards/keebio/rorschach/keymaps/insertsnideremarks/keymap.c +++ b/keyboards/keebio/rorschach/keymaps/insertsnideremarks/keymap.c @@ -246,16 +246,11 @@ uint32_t layer_state_set_user(uint32_t state) { return update_tri_layer_state(state, _NUMBERS, _NUMBERS2, _ADJUST); } -void persistent_default_layer_set(uint16_t default_layer) { - eeconfig_update_default_layer(default_layer); - default_layer_set(default_layer); -} - bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case COLEMAK: if (record->event.pressed) { - persistent_default_layer_set(1UL << _COLEMAK); + default_layer_set(1UL << _COLEMAK); layer_off ( _QWERTY); layer_off ( _NUMBERS); layer_off ( _NUMBERS2); @@ -269,7 +264,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case QWERTY: if (record->event.pressed) { - persistent_default_layer_set(1UL << _QWERTY); + default_layer_set(1UL << _QWERTY); layer_off ( _COLEMAK); layer_off ( _NUMBERS); layer_off ( _NUMBERS2); diff --git a/keyboards/keebio/rorschach/keymaps/insertsnideremarks/rules.mk b/keyboards/keebio/rorschach/keymaps/insertsnideremarks/rules.mk index b9e39c0539..cf63c44f4f 100644 --- a/keyboards/keebio/rorschach/keymaps/insertsnideremarks/rules.mk +++ b/keyboards/keebio/rorschach/keymaps/insertsnideremarks/rules.mk @@ -4,7 +4,7 @@ # BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = no # Mouse keys(+4700) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) CONSOLE_ENABLE = yes # Console for debug(+400) COMMAND_ENABLE = no # Commands for debug and configuration diff --git a/keyboards/kinesis/keymaps/insertsnideremarks/config.h b/keyboards/kinesis/keymaps/insertsnideremarks/config.h index 9ce094be51..053a291b7c 100644 --- a/keyboards/kinesis/keymaps/insertsnideremarks/config.h +++ b/keyboards/kinesis/keymaps/insertsnideremarks/config.h @@ -6,7 +6,7 @@ // place overrides here #define IGNORE_MOD_TAP_INTERRUPT -#define TAPPING_TERM 175 +#define TAPPING_TERM 150 #define TAPPING_TOGGLE 2 diff --git a/keyboards/kinesis/keymaps/insertsnideremarks/keymap.c b/keyboards/kinesis/keymaps/insertsnideremarks/keymap.c index 7f328b4f0e..10b0c2cb73 100644 --- a/keyboards/kinesis/keymaps/insertsnideremarks/keymap.c +++ b/keyboards/kinesis/keymaps/insertsnideremarks/keymap.c @@ -1,4 +1,4 @@ -#include QMK_KEYBOARD_H +#include QMK_KEYBOARD_H extern keymap_config_t keymap_config; @@ -147,7 +147,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { SPCFN, ENTNS, KC_BSPC, KC_ENT, DELNS, BSPCFN ), -/* Number/symbol layer +/* Numbers/Symbols layer (Multiple characters: single-tap for first, double-tap for second) ,-----------------------------------------------------------------------------------------------------------. | | | | | | | | | | | | | | | | | | | @@ -256,7 +256,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |--------+------+------+------+------+------| |------+------+------+------+------+--------| | | | KP . |KP/KP*| KP- _| KP+ =| | | KP 1 | KP 2 | KP 3 |KP Ent| | `--------+------+------+------+------+------' `------+------+------+------+------+--------' - | ( | ) | [ { | ] } | | KP 0 | , | KP . |KP Ent| + | ( | ) | [ { | ] } | | | KP 0 | KP . |KP Ent| `---------------------------' `---------------------------' ,---------------. ,---------------. | | | | | | @@ -272,14 +272,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, KC_P6, KC_P7, KC_P8, KC_P9, KC_P0, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, _______, _______, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, _______, KC_P4, KC_P5, KC_P6, KC_EQL, _______, _______, _______, KC_PDOT, TD(PSLPAS), TD(PMNUN), TD(PPLEQ), _______, KC_P1, KC_P2, KC_P3, KC_PENT, _______, - KC_LPRN, KC_RPRN, TD(LBCB), TD(RBCB), KC_P0, KC_COMM, KC_PDOT, KC_PENT, + KC_LPRN, KC_RPRN, TD(LBCB), TD(RBCB), _______, KC_P0, KC_PDOT, KC_PENT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), /* Colemak gaming/vanilla - (Limited access to Function or Numbers layers; mainly used for gaming; double-tap and hold TD(ADJ) above LAlt to access Adjust layer) + (Limited access to Function or Numbers layers; mainly used for gaming; Ent/NS + Delete/Numbers2 to access Adjust layer) ,-----------------------------------------------------------------------------------------------------------. | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | PScr| SLck| Paus|Numpd|Adjst| `-----------------------------------------------------------------------------------------------------------' @@ -288,18 +288,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |--------+------+------+------+------+------| |------+------+------+------+------+--------| | Tab | Q | W | F | P | G | | J | L | U | Y | ; | \ | |--------+------+------+------+------+------| |------+------+------+------+------+--------| - | Ctrl | A | R | S | T | D | | H | N | E | I | O | ' | + | LCtrl | A | R | S | T | D | | H | N | E | I | O | ' | |--------+------+------+------+------+------| |------+------+------+------+------+--------| | Shift | Z | X | C | V | B | | K | M | , | . | / | Shift | `--------+------+------+------+------+------' `------+------+------+------+------+--------' | Ins | ` | [ | ] | | Left | Down | Up | Right| `---------------------------' `---------------------------' ,---------------. ,---------------. - |Esc/Ctl|TD(ADJ)| | RAlt | RCtl | + | Esc | | | RAlt | RCtl | ,-------|-------|-------| |-------+-------+-------. - | | | LAlt | | RGUI | | | - | Space | Enter |-------| |-------| Delete| Bspc | - | | |Bspc/FN| | Ent/NS| | | + | | | LAlt | | RGUI | Delete| Bspc | + | Space | Enter |-------| |-------| / | / | + | | | Bspc | | Ent/NS|Number2| Fn2 | `-----------------------' `-----------------------' */ [_COLEMAKGM] = LAYOUT_pretty( @@ -309,13 +309,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_INS, KC_GRV, KC_LBRC, KC_RBRC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, - CTLESC, TD(ADJ), KC_RALT, KC_RCTL, + KC_ESC, XXXXXXX, KC_RALT, KC_RCTL, KC_LALT, KC_RGUI, - KC_SPC, KC_ENT, BSPCFN, ENTNS, KC_DEL, KC_BSPC + KC_SPC, KC_ENT, KC_BSPC, ENTNS, DELNS, BSPCFN ), /* QWERTY gaming/vanilla - (Limited access to Function or Numbers layers; mainly used for gaming; double-tap and hold TD(ADJ) above LAlt to access Adjust layer) + (Limited access to Function or Numbers layers; mainly used for gaming; Ent/NS + Delete/Numbers2 to access Adjust layer) ,-----------------------------------------------------------------------------------------------------------. | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | PScr| SLck| Paus|Numpd|Adjst| `-----------------------------------------------------------------------------------------------------------' @@ -324,18 +324,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |--------+------+------+------+------+------| |------+------+------+------+------+--------| | Tab | Q | W | E | R | T | | Y | U | I | O | P | \ | |--------+------+------+------+------+------| |------+------+------+------+------+--------| - | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' | + | LCtrl | A | S | D | F | G | | H | J | K | L | ; | ' | |--------+------+------+------+------+------| |------+------+------+------+------+--------| | Shift | Z | X | C | V | B | | N | M | , | . | / | Shift | `--------+------+------+------+------+------' `------+------+------+------+------+--------' | Ins | ` | [ | ] | | Left | Down | Up | Right| `---------------------------' `---------------------------' ,---------------. ,---------------. - |Esc/Ctl|TD(ADJ)| | RAlt | RCtl | + | Esc | | | RAlt | RCtl | ,-------|-------|-------| |-------+-------+-------. - | | | LAlt | | RGUI | | | - | Space | Enter |-------| |-------| Delete| Bspc | - | | |Bspc/FN| | Ent/NS| | | + | | | LAlt | | RGUI | Delete| Bspc | + | Space | Enter |-------| |-------| / | / | + | | | Bspc | | Ent/NS|Number2| Fn2 | `-----------------------' `-----------------------' */ [_QWERTYGM] = LAYOUT_pretty( @@ -345,9 +345,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_INS, KC_GRV, KC_LBRC, KC_RBRC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, - CTLESC, TD(ADJ), KC_RALT, KC_RCTL, + KC_ESC, XXXXXXX, KC_RALT, KC_RCTL, KC_LALT, KC_RGUI, - KC_SPC, KC_ENT, BSPCFN, ENTNS, KC_DEL, KC_BSPC + KC_SPC, KC_ENT, KC_BSPC, ENTNS, DELNS, BSPCFN ), /* Adjust layer @@ -404,11 +404,6 @@ uint32_t layer_state_set_user(uint32_t state) { return update_tri_layer_state(state, _NUMBERS, _NUMBERS2, _ADJUST); } -void persistent_default_layer_set(uint16_t default_layer) { - eeconfig_update_default_layer(default_layer); - default_layer_set(default_layer); -} - bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case COLEMAK: diff --git a/keyboards/kinesis/keymaps/insertsnideremarks/readme.md b/keyboards/kinesis/keymaps/insertsnideremarks/readme.md index 7a146c7a29..4c8fb153c5 100644 --- a/keyboards/kinesis/keymaps/insertsnideremarks/readme.md +++ b/keyboards/kinesis/keymaps/insertsnideremarks/readme.md @@ -1,6 +1,6 @@ # insertsnideremarks' Kinesis Keymap -These layouts are derived from what I was using on my Kinesis Contoured keyboards with Hasu's TMK converters. With the move to QMK via Stapelberg replacement controller, I've cleaned up the layouts a bit while adding more functions and layers. +These layouts are derived from what I was using on my Kinesis Contoured keyboards with Hasu's USB-USB TMK converters. With the move to QMK via Stapelberg replacement controller, I've cleaned up the layouts a bit while adding more functions and layers. There are minor changes in the base keywell layout of non-alpha keys (e.g., CapsLock is ESC/Ctl, arrow clusters on one side), while the thumb clusters deviate more from the default layout. @@ -10,36 +10,36 @@ Changes to the thumb clusters include: * Backspace have been duplicated on both clusters. * The 2u keys serve dual function as momentary layer switchers. -I've largely left the function keys untouched, with the intension of not using them. They are neither easy to use nor reach due to their locations and size, and, prior to Advantage2, particularly terrible rubber domes were used. They have since updated the keys with Cherry ML switches on Advantage2, but did not resolve the issues of size or location. Additionally, leaving the function keys unused here makes it easier for me to adapt the keymaps to my other keyboards, most of which do not have physical function keys. +I've largely left the function keys untouched, with the intension of not using them. They are neither easy to use nor reach due to their locations and size, and the rubber domes used were terrible. They have since replaced the keys with Cherry ML switches on Advantage2, but did not resolve the issues of size or location. Additionally, leaving the function keys unused here makes it easier for me to adapt the keymaps to my other keyboards, most of which do not have physical function keys. I use Colemak as my default layout. I've included QWERTY here as well. -Additionally, I've added gaming/vanilla version of Colemak and QWERTY layouts. These layouts have limited access to the Function or Numbers layers, and are mainly used for gaming. +Additionally, I've added gaming/vanilla version of Colemak and QWERTY layouts. These layouts have limited access to the Function or Numbers/Symbols layers, and are mainly used for gaming. Persistent default layer has been enabled for Colemak and QWERTY. The gaming/vanilla Colemak and QWERTY can be set as default layer, but will not be persistent. ## Future plans -* Add status LEDs to the Stapelberg PCB (usually used for Caps Lock, Num Lock, and Scroll Lock). May configure it as layer indicator. +* Add status LEDs to the Stapelberg PCB (usually used for Caps Lock, Num Lock, and Scroll Lock) to use as layer indicators. * Add a speaker now that QMK supports additional pins for audio use. -* Utilize the leftover spots on the key matrix, as well as unused pins on Teensy to run macropad and/or foot pedals. +* Utilize the leftover spots on the key matrix, as well as unused pins on Teensy++ 2.0 to run macropad and/or foot pedals. ### Colemak - (Default layer, keys separated by /: tap for first, hold for second; uses Space Cadet Shifts) - ,-----------------------------------------------------------------------------------------------------------. - | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | PScr| SLck| Paus|Numpd|Adjst| - `-----------------------------------------------------------------------------------------------------------' - ,-------------------------------------------. ,-------------------------------------------. - | = | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - | - |--------+------+------+------+------+------| |------+------+------+------+------+--------| - | Tab | Q | W | F | P | G | | J | L | U | Y | ; | \ | - |--------+------+------+------+------+------| |------+------+------+------+------+--------| - |Esc/Ctrl| A | R | S | T | D | | H | N | E | I | O | ' | - |--------+------+------+------+------+------| |------+------+------+------+------+--------| - |SC Shift| Z | X | C | V | B | | K | M | , | . | / |SC Shift| - `--------+------+------+------+------+------' `------+------+------+------+------+--------' - | Ins | ` | [ | ] | | Left | Down | Up | Right| + (Default layer; keys separated by /: tap for first, hold for second; uses Space Cadet Shifts) + ,-----------------------------------------------------------------------------------------------------------. + | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | PScr| SLck| Paus|Numpd|Adjst| + `-----------------------------------------------------------------------------------------------------------' + ,-------------------------------------------. ,-------------------------------------------. + | = | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - | + |--------+------+------+------+------+------| |------+------+------+------+------+--------| + | Tab | Q | W | F | P | G | | J | L | U | Y | ; | \ | + |--------+------+------+------+------+------| |------+------+------+------+------+--------| + |Esc/Ctrl| A | R | S | T | D | | H | N | E | I | O | ' | + |--------+------+------+------+------+------| |------+------+------+------+------+--------| + |SC Shift| Z | X | C | V | B | | K | M | , | . | / |SC Shift| + `--------+------+------+------+------+------' `------+------+------+------+------+--------' + | Ins | ` | [ | ] | | Left | Down | Up | Right| `---------------------------' `---------------------------' ,---------------. ,---------------. |Esc/Ctl| Hyper | | RAlt | RCtl | @@ -150,7 +150,7 @@ Persistent default layer has been enabled for Colemak and QWERTY. The gaming/va ### Colemak gaming/vanilla - (Limited access to Function or Numbers layers; mainly used for gaming; double-tap and hold TD(ADJ) above LAlt to access Adjust layer) + (Limited access to Function or Numbers layers; mainly used for gaming; Ent/NS + Delete/Numbers2 to access Adjust layer) ,-----------------------------------------------------------------------------------------------------------. | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | PScr| SLck| Paus|Numpd|Adjst| `-----------------------------------------------------------------------------------------------------------' @@ -159,23 +159,23 @@ Persistent default layer has been enabled for Colemak and QWERTY. The gaming/va |--------+------+------+------+------+------| |------+------+------+------+------+--------| | Tab | Q | W | F | P | G | | J | L | U | Y | ; | \ | |--------+------+------+------+------+------| |------+------+------+------+------+--------| - | Ctrl | A | R | S | T | D | | H | N | E | I | O | ' | + | LCtrl | A | R | S | T | D | | H | N | E | I | O | ' | |--------+------+------+------+------+------| |------+------+------+------+------+--------| | Shift | Z | X | C | V | B | | K | M | , | . | / | Shift | `--------+------+------+------+------+------' `------+------+------+------+------+--------' | Ins | ` | [ | ] | | Left | Down | Up | Right| `---------------------------' `---------------------------' ,---------------. ,---------------. - |Esc/Ctl|TD(ADJ)| | RAlt | RCtl | + | Esc | | | RAlt | RCtl | ,-------|-------|-------| |-------+-------+-------. - | | | LAlt | | RGUI | | | - | Space | Enter |-------| |-------| Delete| Bspc | - | | |Bspc/FN| | Ent/NS| | | + | | | LAlt | | RGUI | Delete| Bspc | + | Space | Enter |-------| |-------| / | / | + | | | Bspc | | Ent/NS|Number2| Fn2 | `-----------------------' `-----------------------' ### QWERTY gaming/vanilla - (Limited access to Function or Numbers layers; mainly used for gaming; double-tap and hold TD(ADJ) above LAlt to access Adjust layer) + (Limited access to Function or Numbers layers; mainly used for gaming; Ent/NS + Delete/Numbers2 to access Adjust layer) ,-----------------------------------------------------------------------------------------------------------. | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | PScr| SLck| Paus|Numpd|Adjst| `-----------------------------------------------------------------------------------------------------------' @@ -184,18 +184,18 @@ Persistent default layer has been enabled for Colemak and QWERTY. The gaming/va |--------+------+------+------+------+------| |------+------+------+------+------+--------| | Tab | Q | W | E | R | T | | Y | U | I | O | P | \ | |--------+------+------+------+------+------| |------+------+------+------+------+--------| - | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' | + | LCtrl | A | S | D | F | G | | H | J | K | L | ; | ' | |--------+------+------+------+------+------| |------+------+------+------+------+--------| | Shift | Z | X | C | V | B | | N | M | , | . | / | Shift | `--------+------+------+------+------+------' `------+------+------+------+------+--------' | Ins | ` | [ | ] | | Left | Down | Up | Right| `---------------------------' `---------------------------' ,---------------. ,---------------. - |Esc/Ctl|TD(ADJ)| | RAlt | RCtl | + | Esc | | | RAlt | RCtl | ,-------|-------|-------| |-------+-------+-------. - | | | LAlt | | RGUI | | | - | Space | Enter |-------| |-------| Delete| Bspc | - | | |Bspc/FN| | Ent/NS| | | + | | | LAlt | | RGUI | Delete| Bspc | + | Space | Enter |-------| |-------| / | / | + | | | Bspc | | Ent/NS|Number2| Fn2 | `-----------------------' `-----------------------' ### Adjust layer @@ -221,4 +221,4 @@ Persistent default layer has been enabled for Colemak and QWERTY. The gaming/va | | |-------| |-------| | | | | | | | | | | `-----------------------' `-----------------------' - \ No newline at end of file + From 5539d7affb52f467b41eb9245045ee4768a6b391 Mon Sep 17 00:00:00 2001 From: Jeff Hastings Date: Fri, 19 Apr 2019 13:43:15 -0400 Subject: [PATCH 15/61] [Keyboard] Update 1upkeyboards/super16 with code from vendor (#5645) * readme formatting * cleanup rules.mk * update config.h * add numpad layout * Update default keymap * cleanup rules * disable console and commands to fit the bootloader * cleanup whitespace * revert readme changes * revert changes to config.h * remove unused keycodes * add LAYOUTS to rules.mk * remove redundant config setting Co-Authored-By: jeffmhastings --- keyboards/1upkeyboards/super16/config.h | 13 ++++---- keyboards/1upkeyboards/super16/info.json | 23 +++++++------ .../super16/keymaps/default/keymap.c | 32 +++---------------- keyboards/1upkeyboards/super16/rules.mk | 16 ++++------ keyboards/1upkeyboards/super16/super16.c | 22 ++++++------- keyboards/1upkeyboards/super16/super16.h | 32 +++++++++++++------ 6 files changed, 64 insertions(+), 74 deletions(-) diff --git a/keyboards/1upkeyboards/super16/config.h b/keyboards/1upkeyboards/super16/config.h index 810aa254e4..4af4dda63a 100644 --- a/keyboards/1upkeyboards/super16/config.h +++ b/keyboards/1upkeyboards/super16/config.h @@ -21,7 +21,7 @@ along with this program. If not, see . /* USB Device descriptor parameter */ #define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x0000 +#define PRODUCT_ID 0x2010 #define DEVICE_VER 0x0001 #define MANUFACTURER 1upkeyboards #define PRODUCT super16 @@ -65,9 +65,9 @@ along with this program. If not, see . #define RGBLIGHT_VAL_STEP 8 #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ -/*== all animations enable ==*/ -// #define RGBLIGHT_ANIMATIONS -// /*== or choose animations ==*/ + /*== all animations enable ==*/ + #define RGBLIGHT_ANIMATIONS + /*== or choose animations ==*/ // #define RGBLIGHT_EFFECT_BREATHING // #define RGBLIGHT_EFFECT_RAINBOW_MOOD // #define RGBLIGHT_EFFECT_RAINBOW_SWIRL @@ -85,10 +85,9 @@ along with this program. If not, see . /* define if matrix has ghost (lacks anti-ghosting diodes) */ //#define MATRIX_HAS_GHOST -/* number of backlight levels */ - /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE + /* Locking resynchronize hack */ #define LOCKING_RESYNC_ENABLE @@ -242,3 +241,5 @@ along with this program. If not, see . /* Bootmagic Lite key configuration */ // #define BOOTMAGIC_LITE_ROW 0 // #define BOOTMAGIC_LITE_COLUMN 0 + +/* prevent stuck modifiers */ diff --git a/keyboards/1upkeyboards/super16/info.json b/keyboards/1upkeyboards/super16/info.json index e8f4faa23d..10f81f4d08 100644 --- a/keyboards/1upkeyboards/super16/info.json +++ b/keyboards/1upkeyboards/super16/info.json @@ -1,12 +1,15 @@ { - "keyboard_name": "super16", - "url": "", - "maintainer": "qmk", - "width": 4, - "height": 4, - "layouts": { - "LAYOUT_ortho_4x4": { - "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}] - } + "keyboard_name": "super16", + "url": "", + "maintainer": "qmk", + "width": 4, + "height": 4, + "layouts": { + "LAYOUT_ortho_4x4": { + "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}] + }, + "LAYOUT_numpad_4x4": { + "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0, "h":2}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2, "h":2}, {"x":0, "y":3, "w":2}, {"x":2, "y":3}] } -} \ No newline at end of file + } +} diff --git a/keyboards/1upkeyboards/super16/keymaps/default/keymap.c b/keyboards/1upkeyboards/super16/keymaps/default/keymap.c index 36ad3f2839..47889abae5 100644 --- a/keyboards/1upkeyboards/super16/keymaps/default/keymap.c +++ b/keyboards/1upkeyboards/super16/keymaps/default/keymap.c @@ -15,40 +15,16 @@ */ #include QMK_KEYBOARD_H -// Defines the keycodes used by our macros in process_record_user -enum custom_keycodes { - QMKBEST = SAFE_RANGE, - QMKURL -}; - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_ortho_4x4( /* Base */ - KC_A, KC_1, KC_2, KC_4, \ - KC_A, KC_1, KC_2, KC_4, \ - KC_A, KC_1, KC_2, KC_4, \ - KC_A, KC_1, KC_2, KC_4 \ + RGB_TOG, KC_1, KC_U, KC_P, + RGB_MOD, KC_1, KC_U, KC_P, + RGB_TOG, KC_1, KC_U, KC_P, + RGB_MOD, KC_1, KC_U, KC_P ), }; bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case QMKBEST: - if (record->event.pressed) { - // when keycode QMKBEST is pressed - SEND_STRING("QMK is the best thing ever!"); - } else { - // when keycode QMKBEST is released - } - break; - case QMKURL: - if (record->event.pressed) { - // when keycode QMKURL is pressed - SEND_STRING("https://qmk.fm/" SS_TAP(X_ENTER)); - } else { - // when keycode QMKURL is released - } - break; - } return true; } diff --git a/keyboards/1upkeyboards/super16/rules.mk b/keyboards/1upkeyboards/super16/rules.mk index 8fb44b9b5c..31042dfb81 100644 --- a/keyboards/1upkeyboards/super16/rules.mk +++ b/keyboards/1upkeyboards/super16/rules.mk @@ -1,5 +1,4 @@ # MCU name -#MCU = at90usb1286 MCU = atmega32u4 # Processor frequency. @@ -15,7 +14,6 @@ MCU = atmega32u4 # software delays. F_CPU = 16000000 - # # LUFA specific # @@ -48,7 +46,6 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT # atmega32a bootloadHID BOOTLOADER = caterina - # If you don't know the bootloader type, then you can specify the # Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line # Teensy halfKay 512 @@ -58,26 +55,27 @@ BOOTLOADER = caterina # USBaspLoader 2048 # OPT_DEFS += -DBOOTLOADER_SIZE=4096 +#EXTRAFLAGS += -flto # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000) +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) -COMMAND_ENABLE = yes # Commands for debug and configuration +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 = no # USB Nkey Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default -RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) UNICODE_ENABLE = no # Unicode 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) +HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) -LAYOUTS = ortho_4x4 +LAYOUTS = ortho_4x4 numpad_4x4 diff --git a/keyboards/1upkeyboards/super16/super16.c b/keyboards/1upkeyboards/super16/super16.c index cf33cab926..72e47f447b 100644 --- a/keyboards/1upkeyboards/super16/super16.c +++ b/keyboards/1upkeyboards/super16/super16.c @@ -16,28 +16,28 @@ #include "super16.h" void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up + // put your keyboard start-up code here + // runs once when the firmware starts up - matrix_init_user(); + matrix_init_user(); } void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) + // put your looping keyboard code here + // runs every cycle (a lot) - matrix_scan_user(); + matrix_scan_user(); } bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - // put your per-action keyboard code here - // runs for every action, just before processing by the firmware + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware - return process_record_user(keycode, record); + return process_record_user(keycode, record); } void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - led_set_user(usb_led); + led_set_user(usb_led); } diff --git a/keyboards/1upkeyboards/super16/super16.h b/keyboards/1upkeyboards/super16/super16.h index a95f687b16..0595af8dcd 100644 --- a/keyboards/1upkeyboards/super16/super16.h +++ b/keyboards/1upkeyboards/super16/super16.h @@ -25,15 +25,27 @@ * The second converts the arguments into a two-dimensional array which * represents the switch matrix. */ + #define LAYOUT_ortho_4x4( \ - k00, k01, k02, k03, \ - k10, k11, k12, k13, \ - k20, k21, k22, k23, \ - k30, k31, k32, k33 \ -) \ -{ \ - { k00, k01, k02, k03 }, \ - { k10, k11, k12, k13 }, \ - { k20, k21, k22, k23 }, \ - { k30, k31, k32, k33 }, \ + K00, K01, K02, K03, \ + K10, K11, K12, K13, \ + K20, K21, K22, K23, \ + K30, K31, K32, K33 \ +) { \ + { K00, K01, K02, K03 }, \ + { K10, K11, K12, K13 }, \ + { K20, K21, K22, K23 }, \ + { K30, K31, K32, K33 } \ +} + +#define LAYOUT_numpad_4x4( \ + K00, K01, K02, K03, \ + K10, K11, K12, \ + K20, K21, K22, K23, \ + K31, K32 \ +) { \ + { K00, K01, K02, K03 }, \ + { K10, K11, K12, KC_NO }, \ + { K20, K21, K22, K23 }, \ + { KC_NO, K31, K32, KC_NO } \ } From 55ace26a5dc3650f596a88e776e040c7ec0b92e8 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Fri, 19 Apr 2019 16:05:31 -0400 Subject: [PATCH 16/61] Remove default folders for the Planck & Preonic (#3497) * remove planck default folder * Update rules.mk --- keyboards/planck/rules.mk | 2 -- keyboards/preonic/rules.mk | 2 -- 2 files changed, 4 deletions(-) diff --git a/keyboards/planck/rules.mk b/keyboards/planck/rules.mk index 6097902384..520a2d5c7b 100644 --- a/keyboards/planck/rules.mk +++ b/keyboards/planck/rules.mk @@ -44,5 +44,3 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend LAYOUTS = ortho_4x12 planck_mit planck_grid LAYOUTS_HAS_RGB = no - -DEFAULT_FOLDER = planck/rev5 diff --git a/keyboards/preonic/rules.mk b/keyboards/preonic/rules.mk index d5b21388af..e646f2493f 100644 --- a/keyboards/preonic/rules.mk +++ b/keyboards/preonic/rules.mk @@ -72,5 +72,3 @@ API_SYSEX_ENABLE = no SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend LAYOUTS = ortho_5x12 - -DEFAULT_FOLDER = preonic/rev2 \ No newline at end of file From b60413af60896a7b9d344f9f3dc61904015cb7ca Mon Sep 17 00:00:00 2001 From: Mike Roberts Date: Fri, 19 Apr 2019 16:07:35 -0400 Subject: [PATCH 17/61] Use auto output for Adafruit BLE (#4131) * use auto for adafruit ble * spacing * switch ifdef name --- quantum/quantum.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/quantum/quantum.c b/quantum/quantum.c index f5e3b63f8d..a64878c729 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -1084,6 +1084,9 @@ void matrix_init_quantum() { #ifdef HAPTIC_ENABLE haptic_init(); #endif + #ifdef OUTPUT_AUTO_ENABLE + set_output(OUTPUT_AUTO); + #endif matrix_init_kb(); } From 50fce7f255fa39c90239c6406f9c6b3ca2050114 Mon Sep 17 00:00:00 2001 From: zvecr Date: Fri, 19 Apr 2019 21:20:02 +0100 Subject: [PATCH 18/61] Travis CI - skip unit tests for documentation changes (#5267) * Add script to skip tests on non master branches with only docs changes * Review comments - Use 'grep -c' instead of 'wc -l' --- .travis.yml | 2 +- util/travis_test.sh | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 util/travis_test.sh diff --git a/.travis.yml b/.travis.yml index 261e21dc70..a50b205ec0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ before_script: - avr-gcc --version script: - git rev-parse --short HEAD -- make test:all +- bash util/travis_test.sh - bash util/travis_build.sh - bash util/travis_docs.sh addons: diff --git a/util/travis_test.sh b/util/travis_test.sh new file mode 100644 index 0000000000..6c48f898ce --- /dev/null +++ b/util/travis_test.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}" +TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}" + +# test force push +#TRAVIS_COMMIT_RANGE="c287f1bfc5c8...81f62atc4c1d" + +NUM_IMPACTING_CHANGES=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ecv '^(docs/)') +BRANCH=$(git rev-parse --abbrev-ref HEAD) + +if [[ "$TRAVIS_COMMIT_MESSAGE" == *"[skip test]"* ]]; then + echo "Skipping due to commit message" + exit 0 +fi + +if [ "$BRANCH" != "master" ] && [ "$NUM_IMPACTING_CHANGES" == "0" ]; then + echo "Skipping due to changes not impacting tests" + exit 0 +fi + +make test:all From 746058306b6c3b037fc560a13bb78d088c734401 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Wed, 20 Mar 2019 17:45:45 -0400 Subject: [PATCH 19/61] Make sure NOBITS is set on reset_key Patch from https://github.com/qmk/qmk_firmware/issues/3657#issuecomment-415147411 Long story short, in avr-gcc pre-8.2, reset_key was assigned to a memory area that was in a normal range, but when 8.2 came out, that memory got moved to an out of range area, causing errors like 0x800293 out of range. Apparently, this was fixed up in avr-gcc, but we haven't seen a release with the fix yet (we expected it in 8.3, but that didn't happen for some reason). What this commit does is move the reset_key back to the original memory location it was in before. --- tmk_core/common/avr/bootloader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmk_core/common/avr/bootloader.c b/tmk_core/common/avr/bootloader.c index c4b913280e..3cdcd2e426 100644 --- a/tmk_core/common/avr/bootloader.c +++ b/tmk_core/common/avr/bootloader.c @@ -70,7 +70,7 @@ * http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__software_bootloader_start.html */ #define BOOTLOADER_RESET_KEY 0xB007B007 -uint32_t reset_key __attribute__ ((section (".noinit"))); +uint32_t reset_key __attribute__ ((section (".noinit,\"aw\",@nobits;"))); /** \brief initialize MCU status by watchdog reset * From 1ef01ba4c695f2047415df3514e4e5edfaf2bc60 Mon Sep 17 00:00:00 2001 From: mechmerlin Date: Sat, 23 Mar 2019 00:08:33 -0700 Subject: [PATCH 20/61] add -yq flags to actually make it noninteractive --- util/linux_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/linux_install.sh b/util/linux_install.sh index d6e6b86cdc..608975a915 100755 --- a/util/linux_install.sh +++ b/util/linux_install.sh @@ -34,7 +34,7 @@ elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then DEBCONF_NONINTERACTIVE_SEEN=true export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN sudo apt-get update - sudo apt-get install \ + sudo apt-get -yq install \ build-essential \ avr-libc \ binutils-arm-none-eabi \ From dd64a4e73868027b44a018278039cc42a01e730b Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 4 Mar 2019 22:10:13 -0800 Subject: [PATCH 21/61] Init RGB Matrix EEPROM I'm not sure how to check if it's the same as RGBLIGHT's EEPROM, but if you don't init it, it **will not** work properly until it is initialized. --- docs/feature_rgb_matrix.md | 4 ++-- tmk_core/common/eeconfig.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index e744ecc492..05c1ebba81 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -253,10 +253,10 @@ A similar function works in the keymap as `rgb_matrix_indicators_user`. The EEPROM for it is currently shared with the RGBLIGHT system (it's generally assumed only one RGB would be used at a time), but could be configured to use its own 32bit address with: ```C -#define EECONFIG_RGB_MATRIX (uint32_t *)16 +#define EECONFIG_RGB_MATRIX (uint32_t *)28 ``` -Where `16` is an unused index from `eeconfig.h`. +Where `28` is an unused index from `eeconfig.h`. ## Suspended state diff --git a/tmk_core/common/eeconfig.c b/tmk_core/common/eeconfig.c index 9c1e3520ee..30dc7a48d4 100644 --- a/tmk_core/common/eeconfig.c +++ b/tmk_core/common/eeconfig.c @@ -47,6 +47,9 @@ void eeconfig_init_quantum(void) { eeprom_update_byte(EECONFIG_STENOMODE, 0); eeprom_update_dword(EECONFIG_HAPTIC, 0); eeprom_update_byte(EECONFIG_VELOCIKEY, 0); +#ifdef EECONFIG_RGB_MATRIX + eeprom_update_dword(EECONFIG_RGB_MATRIX, 0); +#endif eeconfig_init_kb(); } @@ -185,5 +188,3 @@ uint32_t eeconfig_read_haptic(void) { return eeprom_read_dword(EECONFIG_HAP * FIXME: needs doc */ void eeconfig_update_haptic(uint32_t val) { eeprom_update_dword(EECONFIG_HAPTIC, val); } - - From dfab177f889fd6701e5f898c869be1bf3a2d0ef9 Mon Sep 17 00:00:00 2001 From: Takeshi ISHII <2170248+mtei@users.noreply.github.com> Date: Sat, 20 Apr 2019 07:05:51 +0900 Subject: [PATCH 22/61] Add function to support split-keyboard in rgblight.[ch]. (#5020) * add temporary file that is rgblight.c call graph * add rgblight_update_hook() * update rgblight-call-graph.dot (temporary file) * add more hook point * add TODO comment * temporary Revert "add TODO comment" This reverts commit df6165aac9b3a31d1d3e31ce52aadc134b84eac2. * temporary Revert "add more hook point" This reverts commit 64592b06f3bcdaac47c59f922018a273bef76776. * temporary Revert "add rgblight_update_hook()" This reverts commit 432b74c912ed4333e6633e20a1bcda10c6a10eaf. * add rgblight_update_hook() * add more hook point * add TODO comment * implement rgblight_update_hook() * remove rgblight_update_hook(), add RGBLIGHT_SPLIT_SET_CHANGE_XXXX rgblight_update_hook() is too large. change to simple flag setting. * shrink rgblight_config_t * implement rgblight_update_sync() Note: The animation synchronization process has not been implemented yet. * update quantum/rgblight-call-graph.dot (temporary file) * rmove quantum/rgblight-call-graph.dot (temporary file) * update rgblight.c * Add temporary code to Helix keyboard 'five_rows' keymap to test rgblight.c . * fix build break rgblight_update_sync() when all animation off * fix quantum/rgblight.c:rgblight_disable_XX() add RGBLIGHT_SPLIT_SET_CHANGE_MODE * quantum/rgblight.c change code order: move rgblight_update_sync() * add mode_base_table[] to quantum/rgblight.c * quantum/rgblight.c use mode_base_table[] and rgblight_status.base_mode * quantum/rgblkght.c animation timer integration * quantum/rgblkght.c add animation sync for split keyboard * fix mode_base_table[] and snake effect * fix build break keyboards/mxss. keyboards/mxss's local rgblight.c need old version rgblight.h * rgblight.c: fix animation sync * quantum/rgblight.c: fix snake effect sync * quantum/rgblight.c: animation sync interverl 30 sec * quantum/rgblight.c: fix rgblight_effect_rainbow_swirl() and rgblight_effect_knight() * quantum/rgblight.c: add macro RGBLIGHT_SPLIT_ANIMATION * cherry-pick from 'rgblight_modes.h sample implementation' * fix RGBLIGHT_SPLIT_ANIMATION check position * Update temporary code in Helix keyboard 'five_rows' keymap to test rgblight.c * Reduce the firmware size by 1500 bytes when rgblight_effect_breathing() is enabled. * Changed to rgblight_sethsv_eeprom_helper() for easier reading. * add fail-safe code to quantum/rgblight.c:rgblight_task(),rgblight_timer_enable() * remove temporary code in Helix keyboard 'five_rows' keymap * quantum/rgblight.c: add split-keyboard master side sync functions add functions: uint8_t rgblight_get_change_flags(void); void rgblight_clear_change_flags(void); void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo); change function: void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom); * Change rgblight_update_sync() to use write_to_eeprom. * remove TODO comment from quantum/rgblight.h * Revert "fix build break keyboards/mxss." This reverts commit 90b9a1aa7d8af226751500e49e3ea0214cc4e024. (Separated this change into the newly opened PR #5461.) * Revert "Reduce the firmware size by 1500 bytes when rgblight_effect_breathing() is enabled." This reverts commit b61004e63e82cf5334cee4def4ba10cffa88885f. * update quantum/rgblight.c: Code size reduction when not using RGBLIGHT_SPLIT. * Add temporary code to Helix keyboard 'five_rows' keymap to test rgblight.c . * add temporary pdhelix(Patched Helix) code * Add temporary code to split_common/transport.c to test rgblight.c. * Finish testing rgblight.c with helix keyboard. Revert "Add temporary code to Helix keyboard 'five_rows' keymap to test rgblight.c ." This reverts commit 0bf81a4723a977adc0cb09b4272ee5c9b4f2bbbb. * Finish testing rgblight.c with quantum/split_common code. Revert "Add temporary code to split_common/transport.c to test rgblight.c." This reverts commit 71db3e24eef40d4c455fb9fd1664e4487c9d927a. * remove temporary pdhelix(Patched Helix) code This reverts commit 5287e51a394741bcb6028c7cfc0dd0c984645f76. * Added description of RGBLIGHT_SPLIT macro to docs/feature_rgblight.md. * add RGBLIGHT_SPLIT_SET_CHANGE_HSVS to rgblight_init() * Changed to restart animation only when changing mode. When changing hue, sat and val, the animation is not restarted and continues. --- docs/feature_rgblight.md | 1 + quantum/rgblight.c | 390 ++++++++++++++++++++++++++------------- quantum/rgblight.h | 134 ++++++-------- quantum/rgblight_modes.h | 67 +++++++ 4 files changed, 384 insertions(+), 208 deletions(-) create mode 100644 quantum/rgblight_modes.h diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md index cba97cb417..97a9959946 100644 --- a/docs/feature_rgblight.md +++ b/docs/feature_rgblight.md @@ -75,6 +75,7 @@ Your RGB lighting can be configured by placing these `#define`s in your `config. |`RGBLIGHT_VAL_STEP` |`17` |The number of steps to increment the brightness by | |`RGBLIGHT_LIMIT_VAL` |`255` |The maximum brightness level | |`RGBLIGHT_SLEEP` |*Not defined*|If defined, the RGB lighting will be switched off when the host goes to sleep| +|`RGBLIGHT_SPLIT` |*Not defined*|If defined, synchronization functionality for split keyboards is added| ## Animations diff --git a/quantum/rgblight.c b/quantum/rgblight.c index e2410424e4..5ec11bc077 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -34,14 +34,38 @@ #include "velocikey.h" #endif +#ifdef RGBLIGHT_SPLIT + /* for split keyboard */ + #define RGBLIGHT_SPLIT_SET_CHANGE_MODE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_MODE + #define RGBLIGHT_SPLIT_SET_CHANGE_HSVS rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_HSVS + #define RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_TIMER + #define RGBLIGHT_SPLIT_ANIMATION_TICK rgblight_status.change_flags |= RGBLIGHT_STATUS_ANIMATION_TICK +#else + #define RGBLIGHT_SPLIT_SET_CHANGE_MODE + #define RGBLIGHT_SPLIT_SET_CHANGE_HSVS + #define RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE + #define RGBLIGHT_SPLIT_ANIMATION_TICK +#endif + #define _RGBM_SINGLE_STATIC(sym) RGBLIGHT_MODE_ ## sym, #define _RGBM_SINGLE_DYNAMIC(sym) #define _RGBM_MULTI_STATIC(sym) RGBLIGHT_MODE_ ## sym, #define _RGBM_MULTI_DYNAMIC(sym) -#define _RGBM_TMP_STATIC(sym) RGBLIGHT_MODE_ ## sym, -#define _RGBM_TMP_DYNAMIC(sym) +#define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_ ## sym, +#define _RGBM_TMP_DYNAMIC(sym, msym) static uint8_t static_effect_table [] = { -#include "rgblight.h" +#include "rgblight_modes.h" +}; + +#define _RGBM_SINGLE_STATIC(sym) RGBLIGHT_MODE_ ## sym, +#define _RGBM_SINGLE_DYNAMIC(sym) RGBLIGHT_MODE_ ## sym, +#define _RGBM_MULTI_STATIC(sym) RGBLIGHT_MODE_ ## sym, +#define _RGBM_MULTI_DYNAMIC(sym) RGBLIGHT_MODE_ ## sym, +#define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_ ## msym, +#define _RGBM_TMP_DYNAMIC(sym, msym) RGBLIGHT_MODE_ ## msym, +static uint8_t mode_base_table [] = { + 0, // RGBLIGHT_MODE_zero +#include "rgblight_modes.h" }; static inline int is_static_effect(uint8_t mode) { @@ -61,14 +85,18 @@ const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90}; #endif rgblight_config_t rgblight_config; +rgblight_status_t rgblight_status = { .timer_enabled = false }; bool is_rgblight_initialized = false; +#ifdef RGBLIGHT_USE_TIMER +animation_status_t animation_status = {}; +#endif + #ifndef LED_ARRAY LED_TYPE led[RGBLED_NUM]; #define LED_ARRAY led #endif -bool rgblight_timer_enabled = false; static uint8_t clipping_start_pos = 0; static uint8_t clipping_num_leds = RGBLED_NUM; @@ -221,6 +249,7 @@ void rgblight_init(void) { eeconfig_update_rgblight_default(); } rgblight_config.raw = eeconfig_read_rgblight(); + RGBLIGHT_SPLIT_SET_CHANGE_HSVS; if (!rgblight_config.mode) { dprintf("rgblight_init rgblight_config.mode = 0. Write default values to EEPROM.\n"); eeconfig_update_rgblight_default(); @@ -321,6 +350,7 @@ void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { } else { rgblight_config.mode = mode; } + RGBLIGHT_SPLIT_SET_CHANGE_MODE; if (write_to_eeprom) { eeconfig_update_rgblight(rgblight_config.raw); xprintf("rgblight mode [EEPROM]: %u\n", rgblight_config.mode); @@ -336,6 +366,9 @@ void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { rgblight_timer_enable(); #endif } +#ifdef RGBLIGHT_USE_TIMER + animation_status.restart = true; +#endif rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); } @@ -389,6 +422,7 @@ void rgblight_disable(void) { #ifdef RGBLIGHT_USE_TIMER rgblight_timer_disable(); #endif + RGBLIGHT_SPLIT_SET_CHANGE_MODE; wait_ms(50); rgblight_set(); } @@ -399,6 +433,7 @@ void rgblight_disable_noeeprom(void) { #ifdef RGBLIGHT_USE_TIMER rgblight_timer_disable(); #endif + RGBLIGHT_SPLIT_SET_CHANGE_MODE; wait_ms(50); rgblight_set(); } @@ -505,11 +540,13 @@ void rgblight_decrease_val(void) { } void rgblight_increase_speed(void) { rgblight_config.speed = increment( rgblight_config.speed, 1, 0, 3 ); + //RGBLIGHT_SPLIT_SET_CHANGE_HSVS; // NEED? eeconfig_update_rgblight(rgblight_config.raw);//EECONFIG needs to be increased to support this } void rgblight_decrease_speed(void) { rgblight_config.speed = decrement( rgblight_config.speed, 1, 0, 3 ); + //RGBLIGHT_SPLIT_SET_CHANGE_HSVS; // NEED?? eeconfig_update_rgblight(rgblight_config.raw);//EECONFIG needs to be increased to support this } @@ -524,6 +561,7 @@ void rgblight_sethsv_noeeprom_old(uint16_t hue, uint8_t sat, uint8_t val) { void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom) { if (rgblight_config.enable) { + rgblight_status.base_mode = mode_base_table[rgblight_config.mode]; if (rgblight_config.mode == RGBLIGHT_MODE_STATIC_LIGHT) { // same static color LED_TYPE tmp_led; @@ -534,33 +572,30 @@ void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool if ( 1 == 0 ) { //dummy } #ifdef RGBLIGHT_EFFECT_BREATHING - else if (rgblight_config.mode >= RGBLIGHT_MODE_BREATHING && - rgblight_config.mode <= RGBLIGHT_MODE_BREATHING_end) { + else if (rgblight_status.base_mode == RGBLIGHT_MODE_BREATHING ) { // breathing mode, ignore the change of val, use in memory value instead val = rgblight_config.val; } #endif #ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD - else if (rgblight_config.mode >= RGBLIGHT_MODE_RAINBOW_MOOD && - rgblight_config.mode <= RGBLIGHT_MODE_RAINBOW_MOOD_end) { + else if (rgblight_status.base_mode == RGBLIGHT_MODE_RAINBOW_MOOD) { // rainbow mood, ignore the change of hue hue = rgblight_config.hue; } #endif #ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL - else if (rgblight_config.mode >= RGBLIGHT_MODE_RAINBOW_SWIRL && - rgblight_config.mode <= RGBLIGHT_MODE_RAINBOW_SWIRL_end) { + else if (rgblight_status.base_mode == RGBLIGHT_MODE_RAINBOW_SWIRL) { // rainbow swirl, ignore the change of hue hue = rgblight_config.hue; } #endif #ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT - else if (rgblight_config.mode >= RGBLIGHT_MODE_STATIC_GRADIENT && - rgblight_config.mode <= RGBLIGHT_MODE_STATIC_GRADIENT_end) { + else if (rgblight_status.base_mode == RGBLIGHT_MODE_STATIC_GRADIENT) { // static gradient uint16_t _hue; - int8_t direction = ((rgblight_config.mode - RGBLIGHT_MODE_STATIC_GRADIENT) % 2) ? -1 : 1; - uint16_t range = pgm_read_word(&RGBLED_GRADIENT_RANGES[(rgblight_config.mode - RGBLIGHT_MODE_STATIC_GRADIENT) / 2]); + uint8_t delta = rgblight_config.mode - rgblight_status.base_mode; + int8_t direction = (delta % 2) ? -1 : 1; + uint16_t range = pgm_read_word(&RGBLED_GRADIENT_RANGES[delta / 2]); for (uint8_t i = 0; i < RGBLED_NUM; i++) { _hue = (range / RGBLED_NUM * i * direction + hue + 360) % 360; dprintf("rgblight rainbow set hsv: %u,%u,%d,%u\n", i, _hue, direction, range); @@ -570,6 +605,13 @@ void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool } #endif } +#ifdef RGBLIGHT_SPLIT + if( rgblight_config.hue != hue || + rgblight_config.sat != sat || + rgblight_config.val != val ) { + RGBLIGHT_SPLIT_SET_CHANGE_HSVS; + } +#endif rgblight_config.hue = hue; rgblight_config.sat = sat; rgblight_config.val = val; @@ -711,10 +753,59 @@ void rgblight_set(void) { } #endif +#ifdef RGBLIGHT_SPLIT +/* for split keyboard master side */ +uint8_t rgblight_get_change_flags(void) { + return rgblight_status.change_flags; +} + +void rgblight_clear_change_flags(void) { + rgblight_status.change_flags = 0; +} + +void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo) { + syncinfo->config = rgblight_config; + syncinfo->status = rgblight_status; +} + +/* for split keyboard slave side */ +void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom) { + if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_MODE) { + if (syncinfo->config.enable) { + rgblight_config.enable = 1; // == rgblight_enable_noeeprom(); + rgblight_mode_eeprom_helper(syncinfo->config.mode, write_to_eeprom); + } else { + rgblight_disable_noeeprom(); + } + } + if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_HSVS) { + rgblight_sethsv_eeprom_helper(syncinfo->config.hue, syncinfo->config.sat, syncinfo->config.val, write_to_eeprom); + // rgblight_config.speed = config->speed; // NEED??? + } + #ifdef RGBLIGHT_USE_TIMER + if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_TIMER) { + if (syncinfo->status.timer_enabled) { + rgblight_timer_enable(); + } else { + rgblight_timer_disable(); + } + } + #ifndef RGBLIGHT_SPLIT_NO_ANIMATION_SYNC + if (syncinfo->status.change_flags & RGBLIGHT_STATUS_ANIMATION_TICK) { + animation_status.restart = true; + } + #endif /* RGBLIGHT_SPLIT_NO_ANIMATION_SYNC */ + #endif /* RGBLIGHT_USE_TIMER */ +} +#endif /* RGBLIGHT_SPLIT */ + #ifdef RGBLIGHT_USE_TIMER -// Animation timer -- AVR Timer3 +typedef void (*effect_func_t)(animation_status_t *anim); + +// Animation timer -- use system timer (AVR Timer0) void rgblight_timer_init(void) { + // OLD!!!! Animation timer -- AVR Timer3 // static uint8_t rgblight_timer_is_init = 0; // if (rgblight_timer_is_init) { // return; @@ -730,19 +821,29 @@ void rgblight_timer_init(void) { // OCR3AL = RGBLED_TIMER_TOP & 0xff; // SREG = sreg; - rgblight_timer_enabled = true; + rgblight_status.timer_enabled = false; + RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE; } void rgblight_timer_enable(void) { - rgblight_timer_enabled = true; - dprintf("TIMER3 enabled.\n"); + if( !is_static_effect(rgblight_config.mode) ) { + rgblight_status.timer_enabled = true; + } + animation_status.last_timer = timer_read(); + RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE; + dprintf("rgblight timer enabled.\n"); } void rgblight_timer_disable(void) { - rgblight_timer_enabled = false; - dprintf("TIMER3 disabled.\n"); + rgblight_status.timer_enabled = false; + RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE; + dprintf("rgblight timer disable.\n"); } void rgblight_timer_toggle(void) { - rgblight_timer_enabled ^= rgblight_timer_enabled; - dprintf("TIMER3 toggled.\n"); + dprintf("rgblight timer toggle.\n"); + if(rgblight_status.timer_enabled) { + rgblight_timer_disable(); + } else { + rgblight_timer_enable(); + } } void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b) { @@ -751,64 +852,116 @@ void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b) { rgblight_setrgb(r, g, b); } +static void rgblight_effect_dummy(animation_status_t *anim) { + // do nothing + /******** + dprintf("rgblight_task() what happened?\n"); + dprintf("is_static_effect %d\n", is_static_effect(rgblight_config.mode)); + dprintf("mode = %d, base_mode = %d, timer_enabled %d, ", + rgblight_config.mode, rgblight_status.base_mode, + rgblight_status.timer_enabled); + dprintf("last_timer = %d\n",anim->last_timer); + **/ +} + void rgblight_task(void) { + if (rgblight_status.timer_enabled) { + effect_func_t effect_func = rgblight_effect_dummy; + uint16_t interval_time = 2000; // dummy interval + uint8_t delta = rgblight_config.mode - rgblight_status.base_mode; + animation_status.delta = delta; - if (rgblight_timer_enabled) { // static light mode, do nothing here if ( 1 == 0 ) { //dummy } #ifdef RGBLIGHT_EFFECT_BREATHING - else if (rgblight_config.mode >= RGBLIGHT_MODE_BREATHING && - rgblight_config.mode <= RGBLIGHT_MODE_BREATHING_end) { + else if (rgblight_status.base_mode == RGBLIGHT_MODE_BREATHING) { // breathing mode - rgblight_effect_breathing(rgblight_config.mode - RGBLIGHT_MODE_BREATHING ); + interval_time = get_interval_time(&RGBLED_BREATHING_INTERVALS[delta], 1, 100); + effect_func = rgblight_effect_breathing; } #endif #ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD - else if (rgblight_config.mode >= RGBLIGHT_MODE_RAINBOW_MOOD && - rgblight_config.mode <= RGBLIGHT_MODE_RAINBOW_MOOD_end) { + else if (rgblight_status.base_mode == RGBLIGHT_MODE_RAINBOW_MOOD) { // rainbow mood mode - rgblight_effect_rainbow_mood(rgblight_config.mode - RGBLIGHT_MODE_RAINBOW_MOOD); + interval_time = get_interval_time(&RGBLED_RAINBOW_MOOD_INTERVALS[delta], 5, 100); + effect_func = rgblight_effect_rainbow_mood; } #endif #ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL - else if (rgblight_config.mode >= RGBLIGHT_MODE_RAINBOW_SWIRL && - rgblight_config.mode <= RGBLIGHT_MODE_RAINBOW_SWIRL_end) { + else if (rgblight_status.base_mode == RGBLIGHT_MODE_RAINBOW_SWIRL) { // rainbow swirl mode - rgblight_effect_rainbow_swirl(rgblight_config.mode - RGBLIGHT_MODE_RAINBOW_SWIRL); + interval_time = get_interval_time(&RGBLED_RAINBOW_SWIRL_INTERVALS[delta / 2], 1, 100); + effect_func = rgblight_effect_rainbow_swirl; } #endif #ifdef RGBLIGHT_EFFECT_SNAKE - else if (rgblight_config.mode >= RGBLIGHT_MODE_SNAKE && - rgblight_config.mode <= RGBLIGHT_MODE_SNAKE_end) { + else if (rgblight_status.base_mode == RGBLIGHT_MODE_SNAKE) { // snake mode - rgblight_effect_snake(rgblight_config.mode - RGBLIGHT_MODE_SNAKE); + interval_time = get_interval_time(&RGBLED_SNAKE_INTERVALS[delta / 2], 1, 200); + effect_func = rgblight_effect_snake; } #endif #ifdef RGBLIGHT_EFFECT_KNIGHT - else if (rgblight_config.mode >= RGBLIGHT_MODE_KNIGHT && - rgblight_config.mode <= RGBLIGHT_MODE_KNIGHT_end) { + else if (rgblight_status.base_mode == RGBLIGHT_MODE_KNIGHT) { // knight mode - rgblight_effect_knight(rgblight_config.mode - RGBLIGHT_MODE_KNIGHT); + interval_time = get_interval_time(&RGBLED_KNIGHT_INTERVALS[delta], 5, 100); + effect_func = rgblight_effect_knight; } #endif #ifdef RGBLIGHT_EFFECT_CHRISTMAS - else if (rgblight_config.mode == RGBLIGHT_MODE_CHRISTMAS) { + else if (rgblight_status.base_mode == RGBLIGHT_MODE_CHRISTMAS) { // christmas mode - rgblight_effect_christmas(); + interval_time = RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL; + effect_func = (effect_func_t)rgblight_effect_christmas; } #endif #ifdef RGBLIGHT_EFFECT_RGB_TEST - else if (rgblight_config.mode == RGBLIGHT_MODE_RGB_TEST) { + else if (rgblight_status.base_mode == RGBLIGHT_MODE_RGB_TEST) { // RGB test mode - rgblight_effect_rgbtest(); + interval_time = pgm_read_word(&RGBLED_RGBTEST_INTERVALS[0]); + effect_func = (effect_func_t)rgblight_effect_rgbtest; } #endif #ifdef RGBLIGHT_EFFECT_ALTERNATING - else if (rgblight_config.mode == RGBLIGHT_MODE_ALTERNATING){ - rgblight_effect_alternating(); + else if (rgblight_status.base_mode == RGBLIGHT_MODE_ALTERNATING){ + interval_time = 500; + effect_func = (effect_func_t)rgblight_effect_alternating; + } +#endif + if (animation_status.restart) { + animation_status.restart = false; + animation_status.last_timer = timer_read() - interval_time - 1; + animation_status.pos16 = 0; // restart signal to local each effect } + if (timer_elapsed(animation_status.last_timer) >= interval_time) { +#if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + static uint16_t report_last_timer = 0; + static bool tick_flag = false; + uint16_t oldpos16; + if (tick_flag) { + tick_flag = false; + //dprintf("rgblight animation tick\n"); + if (timer_elapsed(report_last_timer) >= 30000) { + report_last_timer = timer_read(); + dprintf("rgblight animation tick report to slave\n"); + RGBLIGHT_SPLIT_ANIMATION_TICK; + } + } + oldpos16 = animation_status.pos16; + //dprintf("call effect function\n"); +#endif + animation_status.last_timer += interval_time; + effect_func(&animation_status); +#if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + //dprintf("pos16, oldpos16 = %d %d\n", + // animation_status.pos16,oldpos16); + if (animation_status.pos16 == 0 && oldpos16 != 0) { + //dprintf("flag on\n"); + tick_flag = true; + } #endif + } } } @@ -819,22 +972,13 @@ void rgblight_task(void) { __attribute__ ((weak)) const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5}; -void rgblight_effect_breathing(uint8_t interval) { - static uint8_t pos = 0; - static uint16_t last_timer = 0; +void rgblight_effect_breathing(animation_status_t *anim) { float val; - uint8_t interval_time = get_interval_time(&RGBLED_BREATHING_INTERVALS[interval], 1, 100); - - if (timer_elapsed(last_timer) < interval_time) { - return; - } - last_timer = timer_read(); - // http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/ - val = (exp(sin((pos/255.0)*M_PI)) - RGBLIGHT_EFFECT_BREATHE_CENTER/M_E)*(RGBLIGHT_EFFECT_BREATHE_MAX/(M_E-1/M_E)); + val = (exp(sin((anim->pos/255.0)*M_PI)) - RGBLIGHT_EFFECT_BREATHE_CENTER/M_E)*(RGBLIGHT_EFFECT_BREATHE_MAX/(M_E-1/M_E)); rgblight_sethsv_noeeprom_old(rgblight_config.hue, rgblight_config.sat, val); - pos = (pos + 1) % 256; + anim->pos = (anim->pos + 1) % 256; } #endif @@ -842,18 +986,9 @@ void rgblight_effect_breathing(uint8_t interval) { __attribute__ ((weak)) const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {120, 60, 30}; -void rgblight_effect_rainbow_mood(uint8_t interval) { - static uint16_t current_hue = 0; - static uint16_t last_timer = 0; - - uint8_t interval_time = get_interval_time(&RGBLED_RAINBOW_MOOD_INTERVALS[interval], 5, 100); - - if (timer_elapsed(last_timer) < interval_time) { - return; - } - last_timer = timer_read(); - rgblight_sethsv_noeeprom_old(current_hue, rgblight_config.sat, rgblight_config.val); - current_hue = (current_hue + 1) % 360; +void rgblight_effect_rainbow_mood(animation_status_t *anim) { + rgblight_sethsv_noeeprom_old(anim->current_hue, rgblight_config.sat, rgblight_config.val); + anim->current_hue = (anim->current_hue + 1) % 360; } #endif @@ -865,31 +1000,23 @@ void rgblight_effect_rainbow_mood(uint8_t interval) { __attribute__ ((weak)) const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20}; -void rgblight_effect_rainbow_swirl(uint8_t interval) { - static uint16_t current_hue = 0; - static uint16_t last_timer = 0; +void rgblight_effect_rainbow_swirl(animation_status_t *anim) { uint16_t hue; uint8_t i; - uint8_t interval_time = get_interval_time(&RGBLED_RAINBOW_SWIRL_INTERVALS[interval / 2], 1, 100); - - if (timer_elapsed(last_timer) < interval_time) { - return; - } - last_timer = timer_read(); for (i = 0; i < RGBLED_NUM; i++) { - hue = (RGBLIGHT_RAINBOW_SWIRL_RANGE / RGBLED_NUM * i + current_hue) % 360; + hue = (RGBLIGHT_RAINBOW_SWIRL_RANGE / RGBLED_NUM * i + anim->current_hue) % 360; sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]); } rgblight_set(); - if (interval % 2) { - current_hue = (current_hue + 1) % 360; + if (anim->delta % 2) { + anim->current_hue = (anim->current_hue + 1) % 360; } else { - if (current_hue - 1 < 0) { - current_hue = 359; + if (anim->current_hue - 1 < 0) { + anim->current_hue = 359; } else { - current_hue = current_hue - 1; + anim->current_hue = anim->current_hue - 1; } } } @@ -899,22 +1026,27 @@ void rgblight_effect_rainbow_swirl(uint8_t interval) { __attribute__ ((weak)) const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 50, 20}; -void rgblight_effect_snake(uint8_t interval) { +void rgblight_effect_snake(animation_status_t *anim) { static uint8_t pos = 0; - static uint16_t last_timer = 0; uint8_t i, j; int8_t k; int8_t increment = 1; - if (interval % 2) { + + if (anim->delta % 2) { increment = -1; } - uint8_t interval_time = get_interval_time(&RGBLED_SNAKE_INTERVALS[interval / 2], 1, 200); - - if (timer_elapsed(last_timer) < interval_time) { - return; +#if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + if (anim->pos == 0) { // restart signal + if (increment == 1) { + pos = RGBLED_NUM - 1; + } else { + pos = 0; + } + anim->pos = 1; } - last_timer = timer_read(); +#endif + for (i = 0; i < RGBLED_NUM; i++) { led[i].r = 0; led[i].g = 0; @@ -925,7 +1057,9 @@ void rgblight_effect_snake(uint8_t interval) { k = k + RGBLED_NUM; } if (i == k) { - sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val*(RGBLIGHT_EFFECT_SNAKE_LENGTH-j)/RGBLIGHT_EFFECT_SNAKE_LENGTH), (LED_TYPE *)&led[i]); + sethsv(rgblight_config.hue, rgblight_config.sat, + (uint8_t)(rgblight_config.val*(RGBLIGHT_EFFECT_SNAKE_LENGTH-j)/RGBLIGHT_EFFECT_SNAKE_LENGTH), + (LED_TYPE *)&led[i]); } } } @@ -933,11 +1067,20 @@ void rgblight_effect_snake(uint8_t interval) { if (increment == 1) { if (pos - 1 < 0) { pos = RGBLED_NUM - 1; +#if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + anim->pos = 0; +#endif } else { pos -= 1; +#if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + anim->pos = 1; +#endif } } else { pos = (pos + 1) % RGBLED_NUM; +#if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + anim->pos = pos; +#endif } } #endif @@ -946,21 +1089,21 @@ void rgblight_effect_snake(uint8_t interval) { __attribute__ ((weak)) const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63, 31}; -void rgblight_effect_knight(uint8_t interval) { - static uint16_t last_timer = 0; - - uint8_t interval_time = get_interval_time(&RGBLED_KNIGHT_INTERVALS[interval], 5, 100); - - if (timer_elapsed(last_timer) < interval_time) { - return; - } - last_timer = timer_read(); +void rgblight_effect_knight(animation_status_t *anim) { static int8_t low_bound = 0; static int8_t high_bound = RGBLIGHT_EFFECT_KNIGHT_LENGTH - 1; static int8_t increment = 1; uint8_t i, cur; +#if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + if (anim->pos == 0) { // restart signal + anim->pos = 1; + low_bound = 0; + high_bound = RGBLIGHT_EFFECT_KNIGHT_LENGTH - 1; + increment = 1; + } +#endif // Set all the LEDs to 0 for (i = 0; i < RGBLED_NUM; i++) { led[i].r = 0; @@ -988,23 +1131,23 @@ void rgblight_effect_knight(uint8_t interval) { if (high_bound <= 0 || low_bound >= RGBLIGHT_EFFECT_KNIGHT_LED_NUM - 1) { increment = -increment; +#if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + if (increment == 1) { + anim->pos = 0; + } +#endif } } #endif #ifdef RGBLIGHT_EFFECT_CHRISTMAS -void rgblight_effect_christmas(void) { - static uint16_t current_offset = 0; - static uint16_t last_timer = 0; +void rgblight_effect_christmas(animation_status_t *anim) { uint16_t hue; uint8_t i; - if (timer_elapsed(last_timer) < RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL) { - return; - } - last_timer = timer_read(); - current_offset = (current_offset + 1) % 2; + + anim->current_offset = (anim->current_offset + 1) % 2; for (i = 0; i < RGBLED_NUM; i++) { - hue = 0 + ((i/RGBLIGHT_EFFECT_CHRISTMAS_STEP + current_offset) % 2) * 120; + hue = 0 + ((i/RGBLIGHT_EFFECT_CHRISTMAS_STEP + anim->current_offset) % 2) * 120; sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]); } rgblight_set(); @@ -1015,52 +1158,39 @@ void rgblight_effect_christmas(void) { __attribute__ ((weak)) const uint16_t RGBLED_RGBTEST_INTERVALS[] PROGMEM = {1024}; -void rgblight_effect_rgbtest(void) { - static uint8_t pos = 0; - static uint16_t last_timer = 0; +void rgblight_effect_rgbtest(animation_status_t *anim) { static uint8_t maxval = 0; uint8_t g; uint8_t r; uint8_t b; - if (timer_elapsed(last_timer) < pgm_read_word(&RGBLED_RGBTEST_INTERVALS[0])) { - return; - } - if( maxval == 0 ) { LED_TYPE tmp_led; sethsv(0, 255, RGBLIGHT_LIMIT_VAL, &tmp_led); maxval = tmp_led.r; } - last_timer = timer_read(); g = r = b = 0; - switch( pos ) { + switch( anim->pos ) { case 0: r = maxval; break; case 1: g = maxval; break; case 2: b = maxval; break; } rgblight_setrgb(r, g, b); - pos = (pos + 1) % 3; + anim->pos = (anim->pos + 1) % 3; } #endif #ifdef RGBLIGHT_EFFECT_ALTERNATING -void rgblight_effect_alternating(void){ - static uint16_t last_timer = 0; - static uint16_t pos = 0; - if (timer_elapsed(last_timer) < 500) { - return; - } - last_timer = timer_read(); +void rgblight_effect_alternating(animation_status_t *anim) { for(int i = 0; ipos){ sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]); - }else if (i>=RGBLED_NUM/2 && !pos){ + }else if (i>=RGBLED_NUM/2 && !anim->pos){ sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]); }else{ sethsv(rgblight_config.hue, rgblight_config.sat, 0, (LED_TYPE *)&led[i]); } } rgblight_set(); - pos = (pos + 1) % 2; + anim->pos = (anim->pos + 1) % 2; } #endif diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 1769f719d9..748d009dcf 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -68,11 +68,11 @@ #define _RGBM_SINGLE_DYNAMIC(sym) RGBLIGHT_MODE_ ## sym, #define _RGBM_MULTI_STATIC(sym) RGBLIGHT_MODE_ ## sym, #define _RGBM_MULTI_DYNAMIC(sym) RGBLIGHT_MODE_ ## sym, -#define _RGBM_TMP_STATIC(sym) RGBLIGHT_MODE_ ## sym, -#define _RGBM_TMP_DYNAMIC(sym) RGBLIGHT_MODE_ ## sym, +#define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_ ## sym, +#define _RGBM_TMP_DYNAMIC(sym, msym) RGBLIGHT_MODE_ ## sym, enum RGBLIGHT_EFFECT_MODE { RGBLIGHT_MODE_zero = 0, -#include "rgblight.h" +#include "rgblight_modes.h" RGBLIGHT_MODE_last }; @@ -163,6 +163,33 @@ typedef union { }; } rgblight_config_t; +typedef struct _rgblight_status_t { + uint8_t base_mode; + bool timer_enabled; +#ifdef RGBLIGHT_SPLIT + uint8_t change_flags; +#endif +} rgblight_status_t; + +#ifdef RGBLIGHT_SPLIT + #define RGBLIGHT_STATUS_CHANGE_MODE (1<<0) + #define RGBLIGHT_STATUS_CHANGE_HSVS (1<<1) + #define RGBLIGHT_STATUS_CHANGE_TIMER (1<<2) + #define RGBLIGHT_STATUS_ANIMATION_TICK (1<<3) + + typedef struct _rgblight_syncinfo_t { + rgblight_config_t config; + rgblight_status_t status; + } rgblight_syncinfo_t; + + /* for split keyboard master side */ + uint8_t rgblight_get_change_flags(void); + void rgblight_clear_change_flags(void); + void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo); + /* for split keyboard slave side */ + void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom); +#endif + void rgblight_init(void); void rgblight_increase(void); void rgblight_decrease(void); @@ -237,82 +264,33 @@ void rgblight_timer_init(void); void rgblight_timer_enable(void); void rgblight_timer_disable(void); void rgblight_timer_toggle(void); -void rgblight_effect_breathing(uint8_t interval); -void rgblight_effect_rainbow_mood(uint8_t interval); -void rgblight_effect_rainbow_swirl(uint8_t interval); -void rgblight_effect_snake(uint8_t interval); -void rgblight_effect_knight(uint8_t interval); -void rgblight_effect_christmas(void); -void rgblight_effect_rgbtest(void); -void rgblight_effect_alternating(void); -#endif // #ifndef RGBLIGHT_H_DUMMY_DEFINE -#endif // RGBLIGHT_H +#ifdef RGBLIGHT_USE_TIMER + +typedef struct _animation_status_t { + uint16_t last_timer; + uint8_t delta; /* mode - base_mode */ + bool restart; + union { + uint16_t pos16; + uint8_t pos; + int16_t current_hue; + uint16_t current_offset; + }; +} animation_status_t; + +extern animation_status_t animation_status; + +void rgblight_effect_breathing(animation_status_t *anim); +void rgblight_effect_rainbow_mood(animation_status_t *anim); +void rgblight_effect_rainbow_swirl(animation_status_t *anim); +void rgblight_effect_snake(animation_status_t *anim); +void rgblight_effect_knight(animation_status_t *anim); +void rgblight_effect_christmas(animation_status_t *anim); +void rgblight_effect_rgbtest(animation_status_t *anim); +void rgblight_effect_alternating(animation_status_t *anim); -#ifdef _RGBM_SINGLE_STATIC - _RGBM_SINGLE_STATIC( STATIC_LIGHT ) - #ifdef RGBLIGHT_EFFECT_BREATHING - _RGBM_MULTI_DYNAMIC( BREATHING ) - _RGBM_TMP_DYNAMIC( breathing_3 ) - _RGBM_TMP_DYNAMIC( breathing_4 ) - _RGBM_TMP_DYNAMIC( BREATHING_end ) - #endif - #ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD - _RGBM_MULTI_DYNAMIC( RAINBOW_MOOD ) - _RGBM_TMP_DYNAMIC( rainbow_mood_7 ) - _RGBM_TMP_DYNAMIC( RAINBOW_MOOD_end ) - #endif - #ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL - _RGBM_MULTI_DYNAMIC( RAINBOW_SWIRL ) - _RGBM_TMP_DYNAMIC( rainbow_swirl_10 ) - _RGBM_TMP_DYNAMIC( rainbow_swirl_11 ) - _RGBM_TMP_DYNAMIC( rainbow_swirl_12 ) - _RGBM_TMP_DYNAMIC( rainbow_swirl_13 ) - _RGBM_TMP_DYNAMIC( RAINBOW_SWIRL_end ) - #endif - #ifdef RGBLIGHT_EFFECT_SNAKE - _RGBM_MULTI_DYNAMIC( SNAKE ) - _RGBM_TMP_DYNAMIC( snake_16 ) - _RGBM_TMP_DYNAMIC( snake_17 ) - _RGBM_TMP_DYNAMIC( snake_18 ) - _RGBM_TMP_DYNAMIC( snake_19 ) - _RGBM_TMP_DYNAMIC( SNAKE_end ) - #endif - #ifdef RGBLIGHT_EFFECT_KNIGHT - _RGBM_MULTI_DYNAMIC( KNIGHT ) - _RGBM_TMP_DYNAMIC( knight_22 ) - _RGBM_TMP_DYNAMIC( KNIGHT_end ) - #endif - #ifdef RGBLIGHT_EFFECT_CHRISTMAS - _RGBM_SINGLE_DYNAMIC( CHRISTMAS ) - #endif - #ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT - _RGBM_MULTI_STATIC( STATIC_GRADIENT ) - _RGBM_TMP_STATIC( static_gradient_26 ) - _RGBM_TMP_STATIC( static_gradient_27 ) - _RGBM_TMP_STATIC( static_gradient_28 ) - _RGBM_TMP_STATIC( static_gradient_29 ) - _RGBM_TMP_STATIC( static_gradient_30 ) - _RGBM_TMP_STATIC( static_gradient_31 ) - _RGBM_TMP_STATIC( static_gradient_32 ) - _RGBM_TMP_STATIC( static_gradient_33 ) - _RGBM_TMP_STATIC( STATIC_GRADIENT_end ) - #endif - #ifdef RGBLIGHT_EFFECT_RGB_TEST - _RGBM_SINGLE_DYNAMIC( RGB_TEST ) - #endif - #ifdef RGBLIGHT_EFFECT_ALTERNATING - _RGBM_SINGLE_DYNAMIC( ALTERNATING ) - #endif - //// Add a new mode here. - // #ifdef RGBLIGHT_EFFECT_ - // _RGBM__( ) - // #endif #endif -#undef _RGBM_SINGLE_STATIC -#undef _RGBM_SINGLE_DYNAMIC -#undef _RGBM_MULTI_STATIC -#undef _RGBM_MULTI_DYNAMIC -#undef _RGBM_TMP_STATIC -#undef _RGBM_TMP_DYNAMIC +#endif // #ifndef RGBLIGHT_H_DUMMY_DEFINE +#endif // RGBLIGHT_H diff --git a/quantum/rgblight_modes.h b/quantum/rgblight_modes.h new file mode 100644 index 0000000000..8a8f9bdda9 --- /dev/null +++ b/quantum/rgblight_modes.h @@ -0,0 +1,67 @@ +#ifdef _RGBM_SINGLE_STATIC + _RGBM_SINGLE_STATIC( STATIC_LIGHT ) + #ifdef RGBLIGHT_EFFECT_BREATHING + _RGBM_MULTI_DYNAMIC( BREATHING ) + _RGBM_TMP_DYNAMIC( breathing_3, BREATHING ) + _RGBM_TMP_DYNAMIC( breathing_4, BREATHING ) + _RGBM_TMP_DYNAMIC( BREATHING_end, BREATHING ) + #endif + #ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD + _RGBM_MULTI_DYNAMIC( RAINBOW_MOOD ) + _RGBM_TMP_DYNAMIC( rainbow_mood_7, RAINBOW_MOOD ) + _RGBM_TMP_DYNAMIC( RAINBOW_MOOD_end, RAINBOW_MOOD ) + #endif + #ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL + _RGBM_MULTI_DYNAMIC( RAINBOW_SWIRL ) + _RGBM_TMP_DYNAMIC( rainbow_swirl_10, RAINBOW_SWIRL ) + _RGBM_TMP_DYNAMIC( rainbow_swirl_11, RAINBOW_SWIRL ) + _RGBM_TMP_DYNAMIC( rainbow_swirl_12, RAINBOW_SWIRL ) + _RGBM_TMP_DYNAMIC( rainbow_swirl_13, RAINBOW_SWIRL ) + _RGBM_TMP_DYNAMIC( RAINBOW_SWIRL_end, RAINBOW_SWIRL ) + #endif + #ifdef RGBLIGHT_EFFECT_SNAKE + _RGBM_MULTI_DYNAMIC( SNAKE ) + _RGBM_TMP_DYNAMIC( snake_16, SNAKE ) + _RGBM_TMP_DYNAMIC( snake_17, SNAKE ) + _RGBM_TMP_DYNAMIC( snake_18, SNAKE ) + _RGBM_TMP_DYNAMIC( snake_19, SNAKE ) + _RGBM_TMP_DYNAMIC( SNAKE_end, SNAKE ) + #endif + #ifdef RGBLIGHT_EFFECT_KNIGHT + _RGBM_MULTI_DYNAMIC( KNIGHT ) + _RGBM_TMP_DYNAMIC( knight_22, KNIGHT ) + _RGBM_TMP_DYNAMIC( KNIGHT_end, KNIGHT ) + #endif + #ifdef RGBLIGHT_EFFECT_CHRISTMAS + _RGBM_SINGLE_DYNAMIC( CHRISTMAS ) + #endif + #ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT + _RGBM_MULTI_STATIC( STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_26, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_27, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_28, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_29, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_30, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_31, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_32, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_33, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( STATIC_GRADIENT_end, STATIC_GRADIENT ) + #endif + #ifdef RGBLIGHT_EFFECT_RGB_TEST + _RGBM_SINGLE_DYNAMIC( RGB_TEST ) + #endif + #ifdef RGBLIGHT_EFFECT_ALTERNATING + _RGBM_SINGLE_DYNAMIC( ALTERNATING ) + #endif + //// Add a new mode here. + // #ifdef RGBLIGHT_EFFECT_ + // _RGBM__( ) + // #endif +#endif + +#undef _RGBM_SINGLE_STATIC +#undef _RGBM_SINGLE_DYNAMIC +#undef _RGBM_MULTI_STATIC +#undef _RGBM_MULTI_DYNAMIC +#undef _RGBM_TMP_STATIC +#undef _RGBM_TMP_DYNAMIC From 7e67bd791b1804e1e362d8c1e90232440c274cee Mon Sep 17 00:00:00 2001 From: Takeshi ISHII <2170248+mtei@users.noreply.github.com> Date: Sat, 20 Apr 2019 07:25:08 +0900 Subject: [PATCH 23/61] Change split_common to use RGBLIGHT_SPLIT (#5509) * add I2C_slave_buffer_t to quantum/split_common/transport.c Improvements to ease the maintenance of the I2C slave buffer layout. And this commit does not change the compilation results. * add temporary pdhelix(Patched Helix) code * temporary cherry-pick from #5020 add new version(#5020) quantum/rgblight.[ch], quantum/rgblight_modes.h * add post_config.h support to build_keyboard.mk * add quantum/rgblight_post_config.h, quantum/split_common/post_config.h Add quantum/rgblight_post_config.h and quantum/split_common/post_config.h using POST_CONFIG_H variable of build_keyboard.mk. quantum/rgblight_post_config.h additionally defines RGBLIGHT_SPLIT if RGBLED_SPIT is defined. quantum/split_common/post_config.h defines RGBLIGHT_SPLIT additionally when master-slave communication is I2C. * Change split_common's transport.c I2C to use the synchronization feature of rgblight.c * Change split_common's transport.c serial to use the synchronization feature of rgblight.c * test RGBLIGHT_SPLIT on keyboards/handwired/pdhelix * Test End Revert "test RGBLIGHT_SPLIT on keyboards/handwired/pdhelix" This reverts commit 80118a6bbd3d9fc4c7797fef0c34bc67aa73aa98. [x] make RGBLIGHT_TEST=1 handwired/pdhelix/i2c:default [x] make RGBLIGHT_TEST=2 handwired/pdhelix/i2c:default (same RGBLIGHT_TEST=3) [x] make RGBLIGHT_TEST=3 handwired/pdhelix/i2c:default [x] make RGBLIGHT_TEST=1 handwired/pdhelix/pd2:default [x] make RGBLIGHT_TEST=2 handwired/pdhelix/pd2:default [x] make RGBLIGHT_TEST=3 handwired/pdhelix/pd2:default [x] make RGBLIGHT_TEST=1 handwired/pdhelix/pd2_2oled:default [x] make RGBLIGHT_TEST=2 handwired/pdhelix/pd2_2oled:default [x] make RGBLIGHT_TEST=3 handwired/pdhelix/pd2_2oled:default * Test End, Revert "temporary cherry-pick from #5020" This reverts commit d35069f68bda0c50370442a5c7aae60c2f4ce5c0. * Test End, Revert "add temporary pdhelix(Patched Helix) code" This reverts commit aebddfc1a879796afae297ef0723a4fe73af3660. * temporarily cherry-pick from #5020 to see if it passes the travis-ci test. add new version(#5020) quantum/rgblight.[ch], quantum/rgblight_modes.h * Passed the travis-ci test. Revert "temporarily cherry-pick from #5020 to see if it passes the travis-ci test." This reverts commit 647c0a9755eb6a05f76d09b2d59bce67b85a841f. * update docs/config_options.md * update split_common/transport.c, improves maintainability of serial transaction IDs. No change in build result. * temporary cherry-pick from #5020 * fix build fail keebio/iris/rev3:default * fix build fail lets_split_eh/eh:default * Revert "temporary cherry-pick from #5020" This reverts commit be48ca1b4515366a097af8dd1cd7b28b7ee09947. * temporary cherry-pick from #5020 (0.6.336) * Revert "temporary cherry-pick from #5020 (0.6.336)" This reverts commit 978d26a8b3cf0acc485838a7d76d6128b77c630c. * temporary cherry-pick from #5020 (0.6.336) --- build_keyboard.mk | 18 +++ common_features.mk | 2 + docs/config_options.md | 4 +- quantum/rgblight_post_config.h | 5 + quantum/split_common/post_config.h | 15 +++ quantum/split_common/transport.c | 184 +++++++++++++++++------------ 6 files changed, 153 insertions(+), 75 deletions(-) create mode 100644 quantum/rgblight_post_config.h create mode 100644 quantum/split_common/post_config.h diff --git a/build_keyboard.mk b/build_keyboard.mk index ee6a69fc79..5d633f2716 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -280,6 +280,23 @@ ifneq ("$(wildcard $(KEYBOARD_PATH_1)/config.h)","") CONFIG_H += $(KEYBOARD_PATH_1)/config.h endif +POST_CONFIG_H := +ifneq ("$(wildcard $(KEYBOARD_PATH_1)/post_config.h)","") + POST_CONFIG_H += $(KEYBOARD_PATH_1)/post_config.h +endif +ifneq ("$(wildcard $(KEYBOARD_PATH_2)/post_config.h)","") + POST_CONFIG_H += $(KEYBOARD_PATH_2)/post_config.h +endif +ifneq ("$(wildcard $(KEYBOARD_PATH_3)/post_config.h)","") + POST_CONFIG_H += $(KEYBOARD_PATH_3)/post_config.h +endif +ifneq ("$(wildcard $(KEYBOARD_PATH_4)/post_config.h)","") + POST_CONFIG_H += $(KEYBOARD_PATH_4)/post_config.h +endif +ifneq ("$(wildcard $(KEYBOARD_PATH_5)/post_config.h)","") + POST_CONFIG_H += $(KEYBOARD_PATH_5)/post_config.h +endif + # Save the defines and includes here, so we don't include any keymap specific ones PROJECT_DEFS := $(OPT_DEFS) PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(KEYBOARD_PATHS) @@ -355,6 +372,7 @@ ifeq ($(strip $(VISUALIZER_ENABLE)), yes) include $(VISUALIZER_PATH)/visualizer.mk endif +CONFIG_H += $(POST_CONFIG_H) ALL_CONFIGS := $(PROJECT_CONFIG) $(CONFIG_H) OUTPUTS := $(KEYMAP_OUTPUT) $(KEYBOARD_OUTPUT) diff --git a/common_features.mk b/common_features.mk index bd1685869d..eb623d18fa 100644 --- a/common_features.mk +++ b/common_features.mk @@ -103,6 +103,7 @@ ifeq ($(strip $(UNICODE_COMMON)), yes) endif ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) + POST_CONFIG_H += $(QUANTUM_DIR)/rgblight_post_config.h OPT_DEFS += -DRGBLIGHT_ENABLE SRC += $(QUANTUM_DIR)/rgblight.c CIE1931_CURVE = yes @@ -318,6 +319,7 @@ ifneq ($(strip $(DEBOUNCE_TYPE)), custom) endif ifeq ($(strip $(SPLIT_KEYBOARD)), yes) + POST_CONFIG_H += $(QUANTUM_DIR)/split_common/post_config.h OPT_DEFS += -DSPLIT_KEYBOARD # Include files used by all split keyboards diff --git a/docs/config_options.md b/docs/config_options.md index bc2a890586..8f229a2cb8 100644 --- a/docs/config_options.md +++ b/docs/config_options.md @@ -180,10 +180,12 @@ If you define these options you will enable the associated feature, which may in * run RGB animations * `#define RGBLED_NUM 12` * number of LEDs +* `#define RGBLIGHT_SPLIT` + * Needed if both halves of the board have RGB LEDs wired directly to the RGB output pin on the controllers instead of passing the output of the left half to the input of the right half * `#define RGBLED_SPLIT { 6, 6 }` * number of LEDs connected that are directly wired to `RGB_DI_PIN` on each half of a split keyboard * First value indicates number of LEDs for left half, second value is for the right half - * Needed if both halves of the board have RGB LEDs wired directly to the RGB output pin on the controllers instead of passing the output of the left half to the input of the right half + * When RGBLED_SPLIT is defined, RGBLIGHT_SPLIT is implicitly defined. * `#define RGBLIGHT_HUE_STEP 12` * units to step when in/decreasing hue * `#define RGBLIGHT_SAT_STEP 25` diff --git a/quantum/rgblight_post_config.h b/quantum/rgblight_post_config.h new file mode 100644 index 0000000000..048746c4b7 --- /dev/null +++ b/quantum/rgblight_post_config.h @@ -0,0 +1,5 @@ +#if defined(RGBLED_SPLIT) && !defined(RGBLIGHT_SPLIT) + // When RGBLED_SPLIT is defined, + // it is considered that RGBLIGHT_SPLIT is defined implicitly. + #define RGBLIGHT_SPLIT +#endif diff --git a/quantum/split_common/post_config.h b/quantum/split_common/post_config.h new file mode 100644 index 0000000000..0e59df3d06 --- /dev/null +++ b/quantum/split_common/post_config.h @@ -0,0 +1,15 @@ +#if defined(USE_I2C) || defined(EH) + // When using I2C, using rgblight implicitly involves split support. + #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_SPLIT) + #define RGBLIGHT_SPLIT + #endif + +#else // use serial + // When using serial, the user must define RGBLIGHT_SPLIT explicitly + // in config.h as needed. + // see quantum/rgblight_post_config.h + #if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + // When using serial and RGBLIGHT_SPLIT need separate transaction + #define SERIAL_USE_MULTI_TRANSACTION + #endif +#endif diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index ab055ee656..7ea1a9cec9 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c @@ -25,36 +25,23 @@ extern backlight_config_t backlight_config; # include "i2c_master.h" # include "i2c_slave.h" -typedef struct __attribute__ ((__packed__)) { -#ifdef BACKLIGHT_ENABLE - uint8_t backlight_level; -#endif -#ifdef RGBLIGHT_ENABLE - uint32_t rgb_settings; +typedef struct _I2C_slave_buffer_t { + matrix_row_t smatrix[ROWS_PER_HAND]; + uint8_t backlight_level; +#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + rgblight_syncinfo_t rgblight_sync; #endif #ifdef ENCODER_ENABLE - uint8_t encoder_state[NUMBER_OF_ENCODERS]; -#endif - // Keep matrix last, we are only using this for it's offset - uint8_t matrix_start[0]; -} transport_values_t; - -__attribute__ ((unused)) -static transport_values_t transport_values; - -#ifdef BACKLIGHT_ENABLE -# define I2C_BACKLIT_START (uint8_t)offsetof(transport_values_t, backlight_level) -#endif - -#ifdef RGBLIGHT_ENABLE -# define I2C_RGB_START (uint8_t)offsetof(transport_values_t, rgb_settings) + uint8_t encoder_state[NUMBER_OF_ENCODERS]; #endif +} I2C_slave_buffer_t; -#ifdef ENCODER_ENABLE -# define I2C_ENCODER_START (uint8_t)offsetof(transport_values_t, encoder_state) -#endif +static I2C_slave_buffer_t * const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg; -#define I2C_KEYMAP_START (uint8_t)offsetof(transport_values_t, matrix_start) +# define I2C_BACKLIGHT_START offsetof(I2C_slave_buffer_t, backlight_level) +# define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync) +# define I2C_KEYMAP_START offsetof(I2C_slave_buffer_t, smatrix) +# define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state) # define TIMEOUT 100 @@ -64,30 +51,32 @@ static transport_values_t transport_values; // Get rows from other half over i2c bool transport_master(matrix_row_t matrix[]) { - i2c_readReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_START, (void *)matrix, ROWS_PER_HAND * sizeof(matrix_row_t), TIMEOUT); + i2c_readReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_START, (void *)matrix, sizeof(i2c_buffer->smatrix), TIMEOUT); // write backlight info # ifdef BACKLIGHT_ENABLE uint8_t level = get_backlight_level(); - if (level != transport_values.backlight_level) { - if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_BACKLIT_START, (void *)&level, sizeof(level), TIMEOUT) >= 0) { - transport_values.backlight_level = level; + if (level != i2c_buffer->backlight_level) { + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_BACKLIGHT_START, (void *)&level, sizeof(level), TIMEOUT) >= 0) { + i2c_buffer->backlight_level = level; } } # endif -# ifdef RGBLIGHT_ENABLE - uint32_t rgb = rgblight_read_dword(); - if (rgb != transport_values.rgb_settings) { - if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_START, (void *)&rgb, sizeof(rgb), TIMEOUT) >= 0) { - transport_values.rgb_settings = rgb; +# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + if (rgblight_get_change_flags()) { + rgblight_syncinfo_t rgblight_sync; + rgblight_get_syncinfo(&rgblight_sync); + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_START, + (void *)&rgblight_sync, sizeof(rgblight_sync), TIMEOUT) >= 0) { + rgblight_clear_change_flags(); } } # endif # ifdef ENCODER_ENABLE - i2c_readReg(SLAVE_I2C_ADDRESS, I2C_ENCODER_START, (void *)transport_values.encoder_state, sizeof(transport_values.encoder_state), TIMEOUT); - encoder_update_raw(&transport_values.encoder_state[0]); + i2c_readReg(SLAVE_I2C_ADDRESS, I2C_ENCODER_START, (void *)i2c_buffer->encoder_state, sizeof(I2C_slave_buffer_t.encoder_state), TIMEOUT); + encoder_update_raw(i2c_buffer->encoder_state); # endif return true; @@ -95,21 +84,23 @@ bool transport_master(matrix_row_t matrix[]) { void transport_slave(matrix_row_t matrix[]) { // Copy matrix to I2C buffer - memcpy((void*)(i2c_slave_reg + I2C_KEYMAP_START), (void *)matrix, ROWS_PER_HAND * sizeof(matrix_row_t) ); + memcpy((void*)i2c_buffer->smatrix, (void *)matrix, sizeof(i2c_buffer->smatrix)); // Read Backlight Info # ifdef BACKLIGHT_ENABLE - backlight_set(i2c_slave_reg[I2C_BACKLIT_START]); + backlight_set(i2c_buffer->backlight_level); # endif -# ifdef RGBLIGHT_ENABLE - uint32_t rgb = *(uint32_t *)(i2c_slave_reg + I2C_RGB_START); +# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) // Update the RGB with the new data - rgblight_update_dword(rgb); + if (i2c_buffer->rgblight_sync.status.change_flags != 0) { + rgblight_update_sync(&i2c_buffer->rgblight_sync, false); + i2c_buffer->rgblight_sync.status.change_flags = 0; + } # endif # ifdef ENCODER_ENABLE - encoder_state_raw((uint8_t*)(i2c_slave_reg + I2C_ENCODER_START)); + encoder_state_raw(i2c_buffer->encoder_state); # endif } @@ -121,53 +112,109 @@ void transport_slave_init(void) { i2c_slave_init(SLAVE_I2C_ADDRESS); } # include "serial.h" -typedef struct __attribute__ ((__packed__)) { +typedef struct _Serial_s2m_buffer_t { + // TODO: if MATRIX_COLS > 8 change to uint8_t packed_matrix[] for pack/unpack + matrix_row_t smatrix[ROWS_PER_HAND]; + # ifdef ENCODER_ENABLE uint8_t encoder_state[NUMBER_OF_ENCODERS]; # endif - // TODO: if MATRIX_COLS > 8 change to uint8_t packed_matrix[] for pack/unpack - matrix_row_t smatrix[ROWS_PER_HAND]; + } Serial_s2m_buffer_t; -typedef struct __attribute__ ((__packed__)) { +typedef struct _Serial_m2s_buffer_t { # ifdef BACKLIGHT_ENABLE uint8_t backlight_level; # endif -# if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) - rgblight_config_t rgblight_config; // not yet use - // - // When MCUs on both sides drive their respective RGB LED chains, - // it is necessary to synchronize, so it is necessary to communicate RGB - // information. In that case, define RGBLED_SPLIT with info on the number - // of LEDs on each half. - // - // Otherwise, if the master side MCU drives both sides RGB LED chains, - // there is no need to communicate. -# endif } Serial_m2s_buffer_t; +#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) +// When MCUs on both sides drive their respective RGB LED chains, +// it is necessary to synchronize, so it is necessary to communicate RGB +// information. In that case, define RGBLIGHT_SPLIT with info on the number +// of LEDs on each half. +// +// Otherwise, if the master side MCU drives both sides RGB LED chains, +// there is no need to communicate. + +typedef struct _Serial_rgblight_t { + rgblight_syncinfo_t rgblight_sync; +} Serial_rgblight_t; + +volatile Serial_rgblight_t serial_rgblight = {}; +uint8_t volatile status_rgblight = 0; +#endif + volatile Serial_s2m_buffer_t serial_s2m_buffer = {}; volatile Serial_m2s_buffer_t serial_m2s_buffer = {}; uint8_t volatile status0 = 0; +enum serial_transaction_id { + GET_SLAVE_MATRIX = 0, +#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + PUT_RGBLIGHT, +#endif +}; + SSTD_t transactions[] = { - { + [GET_SLAVE_MATRIX] = { (uint8_t *)&status0, sizeof(serial_m2s_buffer), (uint8_t *)&serial_m2s_buffer, sizeof(serial_s2m_buffer), (uint8_t *)&serial_s2m_buffer, }, +#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + [PUT_RGBLIGHT] = { + (uint8_t *)&status_rgblight, + sizeof(serial_rgblight), + (uint8_t *)&serial_rgblight, + 0, NULL // no slave to master transfer + }, +#endif }; void transport_master_init(void) { soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); } void transport_slave_init(void) { soft_serial_target_init(transactions, TID_LIMIT(transactions)); } +#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + +// rgblight synchronization information communication. + +void transport_rgblight_master(void) { + if (rgblight_get_change_flags()) { + rgblight_get_syncinfo((rgblight_syncinfo_t *)&serial_rgblight.rgblight_sync); + if (soft_serial_transaction(PUT_RGBLIGHT) == TRANSACTION_END) { + rgblight_clear_change_flags(); + } + } +} + +void transport_rgblight_slave(void) { + if (status_rgblight == TRANSACTION_ACCEPTED) { + rgblight_update_sync((rgblight_syncinfo_t *)&serial_rgblight.rgblight_sync, + false); + status_rgblight = TRANSACTION_END; + } +} + +#else +#define transport_rgblight_master() +#define transport_rgblight_slave() +#endif + bool transport_master(matrix_row_t matrix[]) { - if (soft_serial_transaction()) { +#ifndef SERIAL_USE_MULTI_TRANSACTION + if (soft_serial_transaction() != TRANSACTION_END) { return false; } +#else + transport_rgblight_master(); + if (soft_serial_transaction(GET_SLAVE_MATRIX) != TRANSACTION_END) { + return false; + } +#endif // TODO: if MATRIX_COLS > 8 change to unpack() for (int i = 0; i < ROWS_PER_HAND; ++i) { @@ -179,23 +226,15 @@ bool transport_master(matrix_row_t matrix[]) { serial_m2s_buffer.backlight_level = backlight_config.enable ? backlight_config.level : 0; # endif -# if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) - static rgblight_config_t prev_rgb = {~0}; - uint32_t rgb = rgblight_read_dword(); - if (rgb != prev_rgb.raw) { - serial_m2s_buffer.rgblight_config.raw = rgb; - prev_rgb.raw = rgb; - } -# endif - # ifdef ENCODER_ENABLE - encoder_update_raw((uint8_t*)&serial_s2m_buffer.encoder_state); + encoder_update_raw((uint8_t *)serial_s2m_buffer.encoder_state); # endif return true; } void transport_slave(matrix_row_t matrix[]) { + transport_rgblight_slave(); // TODO: if MATRIX_COLS > 8 change to pack() for (int i = 0; i < ROWS_PER_HAND; ++i) { serial_s2m_buffer.smatrix[i] = matrix[i]; @@ -203,14 +242,11 @@ void transport_slave(matrix_row_t matrix[]) { # ifdef BACKLIGHT_ENABLE backlight_set(serial_m2s_buffer.backlight_level); # endif -# if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) - // Update RGB config with the new data - rgblight_update_dword(serial_m2s_buffer.rgblight_config.raw); -# endif # ifdef ENCODER_ENABLE - encoder_state_raw((uint8_t*)&serial_s2m_buffer.encoder_state); + encoder_state_raw((uint8_t *)serial_s2m_buffer.encoder_state); # endif + } #endif From 4856552f8bf3d50a95396fc76e26669ed6f3d8b4 Mon Sep 17 00:00:00 2001 From: Markus Weimar Date: Sat, 20 Apr 2019 08:18:06 +0200 Subject: [PATCH 24/61] Update mouse keys docs (#5653) --- docs/feature_mouse_keys.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/feature_mouse_keys.md b/docs/feature_mouse_keys.md index 75633969ec..363662f633 100644 --- a/docs/feature_mouse_keys.md +++ b/docs/feature_mouse_keys.md @@ -1,6 +1,6 @@ # Mouse keys -Mouse keys is a feature that allows you to emulate a mouse using your keyboard. You can move the pointer at different speeds, press 5 buttons and scroll in all 8 directions. +Mouse keys is a feature that allows you to emulate a mouse using your keyboard. You can move the pointer at different speeds, press 5 buttons and scroll in 8 directions. ## Adding mouse keys to your keyboard @@ -37,8 +37,6 @@ In your keymap you can use the following keycodes to map key presses to mouse ac |`KC_MS_ACCEL1` |`KC_ACL1`|Set speed to 1 | |`KC_MS_ACCEL2` |`KC_ACL2`|Set speed to 2 | -For an example, see [the mouse layer in this keymap](https://github.com/qmk/qmk_firmware/blob/1df10ae3bfc146805c75b06dc0c126cd1ef3a60a/keyboards/clueboard/66/keymaps/mouse_keys/keymap.c#L40). - ## Configuring mouse keys Mouse keys supports two different modes to move the cursor: From 8170be5b10e92a4f4a8c23ad0c9dd558c4fc90c7 Mon Sep 17 00:00:00 2001 From: Len Trigg Date: Sat, 20 Apr 2019 18:33:07 +1200 Subject: [PATCH 25/61] [Keyboard] crkbd: compile time hand-dependent rgb_matrix LED declarations (#5657) Set RGB_MATRIX_SPLIT_RIGHT=yes when flashing the right hand side of the keyboard. --- keyboards/crkbd/rev1/rev1.c | 196 ++++++++++++---------------------- keyboards/crkbd/rev1/rules.mk | 6 ++ 2 files changed, 75 insertions(+), 127 deletions(-) diff --git a/keyboards/crkbd/rev1/rev1.c b/keyboards/crkbd/rev1/rev1.c index a0bc4b4c21..0104adf151 100644 --- a/keyboards/crkbd/rev1/rev1.c +++ b/keyboards/crkbd/rev1/rev1.c @@ -55,133 +55,75 @@ void led_set_kb(uint8_t usb_led) { * | {x=0..224, y=0..64} physical layout * | | | modifier * | | | */ - const rgb_led g_rgb_leds_left[27] = { - //LEFT - { { 0xFF }, { 85, 16 }, 0 }, // 1 - { { 0xFF }, { 50, 13 }, 0 }, // 2 - { { 0xFF }, { 16, 20 }, 0 }, // 3 - { { 0xFF }, { 16, 38 }, 0 }, // 4 - { { 0xFF }, { 50, 48 }, 0 }, // 5 - { { 0xFF }, { 85, 52 }, 0 }, // 6 - - { { 3 | ( 5 << 4 ) }, { 95, 63 }, 1 }, // 7 - { { 2 | ( 5 << 4 ) }, { 85, 39 }, 0 }, // 8 - { { 1 | ( 5 << 4 ) }, { 85, 21 }, 0 }, // 9 - { { 0 | ( 5 << 4 ) }, { 85, 4 }, 0 }, //10 - { { 0 | ( 4 << 4 ) }, { 68, 02 }, 0 }, //11 - { { 1 | ( 4 << 4 ) }, { 68, 19 }, 0 }, //12 - { { 2 | ( 4 << 4 ) }, { 68, 37 }, 0 }, //13 - { { 3 | ( 4 << 4 ) }, { 80, 58 }, 1 }, //14 - { { 3 | ( 3 << 4 ) }, { 60, 55 }, 1 }, //15 - { { 2 | ( 3 << 4 ) }, { 50, 35 }, 0 }, //16 - { { 1 | ( 3 << 4 ) }, { 50, 13 }, 0 }, //17 - { { 0 | ( 3 << 4 ) }, { 50, 0 }, 0 }, //18 - { { 0 | ( 2 << 4 ) }, { 33, 3 }, 0 }, //19 - { { 1 | ( 2 << 4 ) }, { 33, 20 }, 0 }, //20 - { { 2 | ( 2 << 4 ) }, { 33, 37 }, 0 }, //21 - { { 2 | ( 1 << 4 ) }, { 16, 42 }, 0 }, //22 - { { 1 | ( 1 << 4 ) }, { 16, 24 }, 0 }, //23 - { { 0 | ( 1 << 4 ) }, { 16, 7 }, 0 }, //24 - { { 0 | ( 0 << 4 ) }, { 0, 7 }, 1 }, //25 - { { 1 | ( 0 << 4 ) }, { 0, 24 }, 1 }, //26 - { { 2 | ( 0 << 4 ) }, { 0, 41 }, 1 }, //27 - }; - const rgb_led g_rgb_leds_right[27] = { - //RIGHT - { { 0xFF }, { 139, 16 }, 0 }, // 1 - { { 0xFF }, { 174, 13 }, 0 }, // 2 - { { 0xFF }, { 208, 20 }, 0 }, // 3 - { { 0xFF }, { 208, 38 }, 0 }, // 4 - { { 0xFF }, { 174, 48 }, 0 }, // 5 - { { 0xFF }, { 139, 52 }, 0 }, // 6 - - { { 7 | ( 5 << 4 ) }, { 129, 63 }, 1 }, // 7 - { { 6 | ( 5 << 4 ) }, { 139, 39 }, 0 }, // 8 - { { 5 | ( 5 << 4 ) }, { 139, 21 }, 0 }, // 9 - { { 4 | ( 5 << 4 ) }, { 139, 4 }, 0 }, //10 - { { 4 | ( 4 << 4 ) }, { 156, 02 }, 0 }, //11 - { { 5 | ( 4 << 4 ) }, { 156, 19 }, 0 }, //12 - { { 6 | ( 4 << 4 ) }, { 156, 37 }, 0 }, //13 - { { 7 | ( 4 << 4 ) }, { 144, 58 }, 1 }, //14 - { { 7 | ( 3 << 4 ) }, { 164, 55 }, 1 }, //15 - { { 6 | ( 3 << 4 ) }, { 174, 35 }, 0 }, //16 - { { 5 | ( 3 << 4 ) }, { 174, 13 }, 0 }, //17 - { { 4 | ( 3 << 4 ) }, { 174, 0 }, 0 }, //18 - { { 4 | ( 2 << 4 ) }, { 191, 3 }, 0 }, //19 - { { 5 | ( 2 << 4 ) }, { 191, 20 }, 0 }, //20 - { { 6 | ( 2 << 4 ) }, { 191, 37 }, 0 }, //21 - { { 6 | ( 1 << 4 ) }, { 208, 42 }, 0 }, //22 - { { 5 | ( 1 << 4 ) }, { 208, 24 }, 0 }, //23 - { { 4 | ( 1 << 4 ) }, { 208, 7 }, 0 }, //24 - { { 4 | ( 0 << 4 ) }, { 224, 7 }, 1 }, //25 - { { 5 | ( 0 << 4 ) }, { 224, 24 }, 1 }, //26 - { { 6 | ( 0 << 4 ) }, { 224, 41 }, 1 }, //27 - - }; - - const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - - //LEFT - { { 0xFF }, { 85, 16 }, 0 }, // 1 - { { 0xFF }, { 50, 13 }, 0 }, // 2 - { { 0xFF }, { 16, 20 }, 0 }, // 3 - { { 0xFF }, { 16, 38 }, 0 }, // 4 - { { 0xFF }, { 50, 48 }, 0 }, // 5 - { { 0xFF }, { 85, 52 }, 0 }, // 6 - - { { 3 | ( 5 << 4 ) }, { 95, 63 }, 1 }, // 7 - { { 2 | ( 5 << 4 ) }, { 85, 39 }, 0 }, // 8 - { { 1 | ( 5 << 4 ) }, { 85, 21 }, 0 }, // 9 - { { 0 | ( 5 << 4 ) }, { 85, 4 }, 0 }, //10 - { { 0 | ( 4 << 4 ) }, { 68, 02 }, 0 }, //11 - { { 1 | ( 4 << 4 ) }, { 68, 19 }, 0 }, //12 - { { 2 | ( 4 << 4 ) }, { 68, 37 }, 0 }, //13 - { { 3 | ( 4 << 4 ) }, { 80, 58 }, 1 }, //14 - { { 3 | ( 3 << 4 ) }, { 60, 55 }, 1 }, //15 - { { 2 | ( 3 << 4 ) }, { 50, 35 }, 0 }, //16 - { { 1 | ( 3 << 4 ) }, { 50, 13 }, 0 }, //17 - { { 0 | ( 3 << 4 ) }, { 50, 0 }, 0 }, //18 - { { 0 | ( 2 << 4 ) }, { 33, 3 }, 0 }, //19 - { { 1 | ( 2 << 4 ) }, { 33, 20 }, 0 }, //20 - { { 2 | ( 2 << 4 ) }, { 33, 37 }, 0 }, //21 - { { 2 | ( 1 << 4 ) }, { 16, 42 }, 0 }, //22 - { { 1 | ( 1 << 4 ) }, { 16, 24 }, 0 }, //23 - { { 0 | ( 1 << 4 ) }, { 16, 7 }, 0 }, //24 - { { 0 | ( 0 << 4 ) }, { 0, 7 }, 1 }, //25 - { { 1 | ( 0 << 4 ) }, { 0, 24 }, 1 }, //26 - { { 2 | ( 0 << 4 ) }, { 0, 41 }, 1 }, //27 - - //RIGHT - { { 0xFF }, { 139, 16 }, 0 }, // 1 - { { 0xFF }, { 174, 13 }, 0 }, // 2 - { { 0xFF }, { 208, 20 }, 0 }, // 3 - { { 0xFF }, { 208, 38 }, 0 }, // 4 - { { 0xFF }, { 174, 48 }, 0 }, // 5 - { { 0xFF }, { 139, 52 }, 0 }, // 6 - - { { 7 | ( 5 << 4 ) }, { 129, 63 }, 1 }, // 7 - { { 6 | ( 5 << 4 ) }, { 139, 39 }, 0 }, // 8 - { { 5 | ( 5 << 4 ) }, { 139, 21 }, 0 }, // 9 - { { 4 | ( 5 << 4 ) }, { 139, 4 }, 0 }, //10 - { { 4 | ( 4 << 4 ) }, { 156, 02 }, 0 }, //11 - { { 5 | ( 4 << 4 ) }, { 156, 19 }, 0 }, //12 - { { 6 | ( 4 << 4 ) }, { 156, 37 }, 0 }, //13 - { { 7 | ( 4 << 4 ) }, { 144, 58 }, 1 }, //14 - { { 7 | ( 3 << 4 ) }, { 164, 55 }, 1 }, //15 - { { 6 | ( 3 << 4 ) }, { 174, 35 }, 0 }, //16 - { { 5 | ( 3 << 4 ) }, { 174, 13 }, 0 }, //17 - { { 4 | ( 3 << 4 ) }, { 174, 0 }, 0 }, //18 - { { 4 | ( 2 << 4 ) }, { 191, 3 }, 0 }, //19 - { { 5 | ( 2 << 4 ) }, { 191, 20 }, 0 }, //20 - { { 6 | ( 2 << 4 ) }, { 191, 37 }, 0 }, //21 - { { 6 | ( 1 << 4 ) }, { 208, 42 }, 0 }, //22 - { { 5 | ( 1 << 4 ) }, { 208, 24 }, 0 }, //23 - { { 4 | ( 1 << 4 ) }, { 208, 7 }, 0 }, //24 - { { 4 | ( 0 << 4 ) }, { 224, 7 }, 1 }, //25 - { { 5 | ( 0 << 4 ) }, { 224, 24 }, 1 }, //26 - { { 6 | ( 0 << 4 ) }, { 224, 41 }, 1 }, //27 - - }; +#define RGB_MATRIX_LEFT_LEDS \ + { { 0xFF }, { 85, 16 }, 0 }, /* 1 */ \ + { { 0xFF }, { 50, 13 }, 0 }, /* 2 */ \ + { { 0xFF }, { 16, 20 }, 0 }, /* 3 */ \ + { { 0xFF }, { 16, 38 }, 0 }, /* 4 */ \ + { { 0xFF }, { 50, 48 }, 0 }, /* 5 */ \ + { { 0xFF }, { 85, 52 }, 0 }, /* 6 */ \ + { { 3 | ( 5 << 4 ) }, { 95, 63 }, 1 }, /* 7 */ \ + { { 2 | ( 5 << 4 ) }, { 85, 39 }, 0 }, /* 8 */ \ + { { 1 | ( 5 << 4 ) }, { 85, 21 }, 0 }, /* 9 */ \ + { { 0 | ( 5 << 4 ) }, { 85, 4 }, 0 }, /* 10 */ \ + { { 0 | ( 4 << 4 ) }, { 68, 02 }, 0 }, /* 11 */ \ + { { 1 | ( 4 << 4 ) }, { 68, 19 }, 0 }, /* 12 */ \ + { { 2 | ( 4 << 4 ) }, { 68, 37 }, 0 }, /* 13 */ \ + { { 3 | ( 4 << 4 ) }, { 80, 58 }, 1 }, /* 14 */ \ + { { 3 | ( 3 << 4 ) }, { 60, 55 }, 1 }, /* 15 */ \ + { { 2 | ( 3 << 4 ) }, { 50, 35 }, 0 }, /* 16 */ \ + { { 1 | ( 3 << 4 ) }, { 50, 13 }, 0 }, /* 17 */ \ + { { 0 | ( 3 << 4 ) }, { 50, 0 }, 0 }, /* 18 */ \ + { { 0 | ( 2 << 4 ) }, { 33, 3 }, 0 }, /* 19 */ \ + { { 1 | ( 2 << 4 ) }, { 33, 20 }, 0 }, /* 20 */ \ + { { 2 | ( 2 << 4 ) }, { 33, 37 }, 0 }, /* 21 */ \ + { { 2 | ( 1 << 4 ) }, { 16, 42 }, 0 }, /* 22 */ \ + { { 1 | ( 1 << 4 ) }, { 16, 24 }, 0 }, /* 23 */ \ + { { 0 | ( 1 << 4 ) }, { 16, 7 }, 0 }, /* 24 */ \ + { { 0 | ( 0 << 4 ) }, { 0, 7 }, 1 }, /* 25 */ \ + { { 1 | ( 0 << 4 ) }, { 0, 24 }, 1 }, /* 26 */ \ + { { 2 | ( 0 << 4 ) }, { 0, 41 }, 1 }, /* 27 */ + +#define RGB_MATRIX_RIGHT_LEDS \ + { { 0xFF }, { 139, 16 }, 0 }, /* 1 */ \ + { { 0xFF }, { 174, 13 }, 0 }, /* 2 */ \ + { { 0xFF }, { 208, 20 }, 0 }, /* 3 */ \ + { { 0xFF }, { 208, 38 }, 0 }, /* 4 */ \ + { { 0xFF }, { 174, 48 }, 0 }, /* 5 */ \ + { { 0xFF }, { 139, 52 }, 0 }, /* 6 */ \ + { { 7 | ( 5 << 4 ) }, { 129, 63 }, 1 }, /* 7 */ \ + { { 6 | ( 5 << 4 ) }, { 139, 39 }, 0 }, /* 8 */ \ + { { 5 | ( 5 << 4 ) }, { 139, 21 }, 0 }, /* 9 */ \ + { { 4 | ( 5 << 4 ) }, { 139, 4 }, 0 }, /* 10 */ \ + { { 4 | ( 4 << 4 ) }, { 156, 02 }, 0 }, /* 11 */ \ + { { 5 | ( 4 << 4 ) }, { 156, 19 }, 0 }, /* 12 */ \ + { { 6 | ( 4 << 4 ) }, { 156, 37 }, 0 }, /* 13 */ \ + { { 7 | ( 4 << 4 ) }, { 144, 58 }, 1 }, /* 14 */ \ + { { 7 | ( 3 << 4 ) }, { 164, 55 }, 1 }, /* 15 */ \ + { { 6 | ( 3 << 4 ) }, { 174, 35 }, 0 }, /* 16 */ \ + { { 5 | ( 3 << 4 ) }, { 174, 13 }, 0 }, /* 17 */ \ + { { 4 | ( 3 << 4 ) }, { 174, 0 }, 0 }, /* 18 */ \ + { { 4 | ( 2 << 4 ) }, { 191, 3 }, 0 }, /* 19 */ \ + { { 5 | ( 2 << 4 ) }, { 191, 20 }, 0 }, /* 20 */ \ + { { 6 | ( 2 << 4 ) }, { 191, 37 }, 0 }, /* 21 */ \ + { { 6 | ( 1 << 4 ) }, { 208, 42 }, 0 }, /* 22 */ \ + { { 5 | ( 1 << 4 ) }, { 208, 24 }, 0 }, /* 23 */ \ + { { 4 | ( 1 << 4 ) }, { 208, 7 }, 0 }, /* 24 */ \ + { { 4 | ( 0 << 4 ) }, { 224, 7 }, 1 }, /* 25 */ \ + { { 5 | ( 0 << 4 ) }, { 224, 24 }, 1 }, /* 26 */ \ + { { 6 | ( 0 << 4 ) }, { 224, 41 }, 1 }, /* 27 */ + +#ifdef RGB_MATRIX_SPLIT_RIGHT +const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { + RGB_MATRIX_RIGHT_LEDS + RGB_MATRIX_LEFT_LEDS + }; +#else +const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { + RGB_MATRIX_LEFT_LEDS + RGB_MATRIX_RIGHT_LEDS + }; +#endif #endif void matrix_init_kb(void) { diff --git a/keyboards/crkbd/rev1/rules.mk b/keyboards/crkbd/rev1/rules.mk index 6028b5a5b9..f12849f989 100644 --- a/keyboards/crkbd/rev1/rules.mk +++ b/keyboards/crkbd/rev1/rules.mk @@ -1,3 +1,9 @@ +RGB_MATRIX_SPLIT_RIGHT = no # if no, order LEDs for left hand, if yes, order LEDs for right hand + +ifeq ($(strip $(RGB_MATRIX_SPLIT_RIGHT)), yes) + OPT_DEFS += -DRGB_MATRIX_SPLIT_RIGHT +endif + SRC += rev1/matrix.c SRC += rev1/split_util.c SRC += rev1/split_scomm.c From edcedd53d1bfb761cca37553729ad881f2a738e6 Mon Sep 17 00:00:00 2001 From: zvecr Date: Sat, 20 Apr 2019 07:34:13 +0100 Subject: [PATCH 26/61] [Keyboard] Add LAYOUT macro and Configurator config (#5656) --- keyboards/touchpad/info.json | 19 +++++++++++++++++++ keyboards/touchpad/keymaps/default/keymap.c | 16 ++++++++-------- keyboards/touchpad/touchpad.h | 17 +++++++++++++++++ 3 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 keyboards/touchpad/info.json diff --git a/keyboards/touchpad/info.json b/keyboards/touchpad/info.json new file mode 100644 index 0000000000..625bbffd8e --- /dev/null +++ b/keyboards/touchpad/info.json @@ -0,0 +1,19 @@ +{ + "keyboard_name": "touchpad", + "url": "", + "maintainer": "qmk", + "width": 6, + "height": 6, + "layouts": { + "LAYOUT_ortho_6x6": { + "layout": [ + {"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, + {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, + {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, {"x":5, "y":2}, + {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, {"x":4, "y":3}, {"x":5, "y":3}, + {"x":0, "y":4}, {"x":1, "y":4}, {"x":2, "y":4}, {"x":3, "y":4}, {"x":4, "y":4}, {"x":5, "y":4}, + {"x":0, "y":5}, {"x":1, "y":5}, {"x":2, "y":5}, {"x":3, "y":5}, {"x":4, "y":5}, {"x":5, "y":5} + ] + } + } +} \ No newline at end of file diff --git a/keyboards/touchpad/keymaps/default/keymap.c b/keyboards/touchpad/keymaps/default/keymap.c index 92f772aaa8..7fcaa70c5d 100644 --- a/keyboards/touchpad/keymaps/default/keymap.c +++ b/keyboards/touchpad/keymaps/default/keymap.c @@ -18,13 +18,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = { - { KC_A, KC_B, KC_C, KC_D, KC_E, KC_F }, - { KC_A, KC_B, KC_C, KC_D, KC_E, KC_F }, - { KC_A, KC_B, KC_C, KC_D, KC_E, KC_F }, - { KC_A, KC_B, KC_C, KC_D, KC_E, KC_F }, - { KC_A, KC_B, KC_C, KC_D, KC_E, KC_F }, - { KC_A, KC_B, KC_C, KC_D, KC_E, KC_F } -} + [0] = LAYOUT_ortho_6x6( + KC_A, KC_B, KC_C, KC_D, KC_E, KC_F, + KC_A, KC_B, KC_C, KC_D, KC_E, KC_F, + KC_A, KC_B, KC_C, KC_D, KC_E, KC_F, + KC_A, KC_B, KC_C, KC_D, KC_E, KC_F, + KC_A, KC_B, KC_C, KC_D, KC_E, KC_F, + KC_A, KC_B, KC_C, KC_D, KC_E, KC_F + ) }; diff --git a/keyboards/touchpad/touchpad.h b/keyboards/touchpad/touchpad.h index 010d4b1383..97b59a033c 100644 --- a/keyboards/touchpad/touchpad.h +++ b/keyboards/touchpad/touchpad.h @@ -1,2 +1,19 @@ #pragma once #include "quantum.h" + +#define LAYOUT_ortho_6x6( \ + K00, K01, K02, K03, K04, K05, \ + K10, K11, K12, K13, K14, K15, \ + K20, K21, K22, K23, K24, K25, \ + K30, K31, K32, K33, K34, K35, \ + K40, K41, K42, K43, K44, K45, \ + K50, K51, K52, K53, K54, K55 \ +) \ +{ \ + { K00, K01, K02, K03, K04, K05 }, \ + { K10, K11, K12, K13, K14, K15 }, \ + { K20, K21, K22, K23, K24, K25 }, \ + { K30, K31, K32, K33, K34, K35 }, \ + { K40, K41, K42, K43, K44, K45 }, \ + { K50, K51, K52, K53, K54, K55 } \ +} From ed74bd95f641754d3f9a2949fc333590522210aa Mon Sep 17 00:00:00 2001 From: Rys Sommefeldt Date: Sat, 20 Apr 2019 07:35:46 +0100 Subject: [PATCH 27/61] [Keymap] Make the layout friendlier for use with the iPad (#5654) * Make the layout more similar to Apple keyboards to make it friendlier for using with an iPad * Fix config.h pragma, plus second layer mistakes --- keyboards/tada68/keymaps/mattgemmell/config.h | 3 ++ keyboards/tada68/keymaps/mattgemmell/keymap.c | 28 +++++++++---------- 2 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 keyboards/tada68/keymaps/mattgemmell/config.h diff --git a/keyboards/tada68/keymaps/mattgemmell/config.h b/keyboards/tada68/keymaps/mattgemmell/config.h new file mode 100644 index 0000000000..f4b045cd32 --- /dev/null +++ b/keyboards/tada68/keymaps/mattgemmell/config.h @@ -0,0 +1,3 @@ +#pragma once + +#define GRAVE_ESC_GUI_OVERRIDE diff --git a/keyboards/tada68/keymaps/mattgemmell/keymap.c b/keyboards/tada68/keymaps/mattgemmell/keymap.c index f446ddc5d2..1a8021ea40 100644 --- a/keyboards/tada68/keymaps/mattgemmell/keymap.c +++ b/keyboards/tada68/keymaps/mattgemmell/keymap.c @@ -6,43 +6,43 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap _BL: (Base Layer) Default Layer * ,----------------------------------------------------------------. - * |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |~ ` | + * |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | § | * |----------------------------------------------------------------| * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |Del | * |------------------------------------------------------- -----| - * |CAPS | A| S| D| F| G| H| J| K| L| ;| '| #|Entr|PgUp| + * |CAPS | A| S| D| F| G| H| J| K| L| ;| '| \ |Entr|PgUp| * |----------------------------------------------------------------| - * |Shift| \ | Z| X| C| V| B| N| M| ,| .| /|Rshift|Up|PgDn| + * |Shift| ` | Z| X| C| V| B| N| M| ,| .| /|Rshift|Up|PgDn| * |----------------------------------------------------------------| * |Ctrl|Alt |LGUI| Space |Alt| FN|Ctrl|Lef|Dow|Rig | * `----------------------------------------------------------------' */ [_BL] = LAYOUT_iso( - 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_GRV, \ + 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_NUBS, \ 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_DEL, \ 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_NUHS, KC_ENT, KC_PGUP, \ - KC_LSFT, KC_NUBS, 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_LSFT, KC_GRV, 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_RALT, MO(_FL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ), /* Keymap _FL1: Function Layer 1 * ,----------------------------------------------------------------. - * | | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | :D | + * | | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| |BR↑ | * |----------------------------------------------------------------| - * | |LMB| Up|RMB| | | | | | | | | | | | + * | | | | | | | | | | | | | | |BR↓ | * |------------------------------------------------------- -----| - * | |Lef|Dow|Rig| | | | | | | | | | |Home| + * | | | | | | | | | | | | | | |Home| * |----------------------------------------------------------------| - * | | | | | L+|LED| L-| | V+| V-|Mut| | MsBtn|↑ | End| + * | | | | | L+|LED| L-| | | V↓| V↑|Mut| | ↑ | End| * |----------------------------------------------------------------| - * | | | | Reset | | | | ← | ↓ | → | + * | | | | | | | | ← | ↓ | → | * `----------------------------------------------------------------' */ [_FL] = LAYOUT_iso( - _______, 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_BTN1, KC_UP, KC_BTN2, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, \ - _______, _______, _______, _______, BL_DEC, BL_TOGG, BL_INC, _______, KC_VOLU, KC_VOLD, KC_MUTE, _______, _______, KC_MS_U, KC_END, \ + _______, 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_BRMU, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BRMD, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, \ + _______, _______, _______, _______, BL_DEC, BL_TOGG, BL_INC, _______, _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, KC_MS_U, KC_END, \ _______, _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R ), }; From a1f251405183c39ade3b149a906b2b85162174ab Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Sat, 20 Apr 2019 08:37:19 +0200 Subject: [PATCH 28/61] [Keyboard] Layout and configuration updates for Signum 3.0 (#5652) * Make Signum 3.0 compatible with default ortho_4x12 layout * Disable unicode map by default * Add missing backspace key * Add missing delete key * Fix broken gui right command * Move MO5 to a different key an add Esc to L4 * Move MO5 to a different key * Add Del and Bspace to layer 4 --- keyboards/signum/3_0/elitec/elitec.h | 2 +- keyboards/signum/3_0/elitec/info.json | 35 ++++++++--------- .../3_0/elitec/keymaps/default/generate_km.py | 2 +- .../3_0/elitec/keymaps/default/keymap.c | 38 +++++++++---------- .../3_0/elitec/keymaps/default/layout.py | 12 +++--- .../3_0/elitec/keymaps/default/rules.mk | 1 + keyboards/signum/3_0/elitec/rules.mk | 4 +- 7 files changed, 49 insertions(+), 45 deletions(-) create mode 100644 keyboards/signum/3_0/elitec/keymaps/default/rules.mk diff --git a/keyboards/signum/3_0/elitec/elitec.h b/keyboards/signum/3_0/elitec/elitec.h index 1749969de3..d28d3d4769 100644 --- a/keyboards/signum/3_0/elitec/elitec.h +++ b/keyboards/signum/3_0/elitec/elitec.h @@ -2,7 +2,7 @@ #include "quantum.h" -#define LAYOUT( \ +#define LAYOUT_ortho_4x12( \ K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, \ K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, \ K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, \ diff --git a/keyboards/signum/3_0/elitec/info.json b/keyboards/signum/3_0/elitec/info.json index e93dceb13c..e414d15967 100644 --- a/keyboards/signum/3_0/elitec/info.json +++ b/keyboards/signum/3_0/elitec/info.json @@ -5,7 +5,8 @@ "width": 17, "height": 8, "layouts": { - "LAYOUT": { + "LAYOUT_ortho_4x12": { + "key_count": 48, "layout": [ { "x": 1.25, "y": 0.75, "r": 15 }, @@ -13,15 +14,15 @@ { "x": 1.25, "y": 2.75, "r": 15 }, { "x": 1.25, "y": 4.25, "r": 15 }, - { "x": 2.25, "y": 0.5, "r": 15 }, - { "x": 2.25, "y": 1.5, "r": 15 }, - { "x": 2.25, "y": 2.5, "r": 15 }, - { "x": 2.25, "y": 3.5, "r": 15 }, + { "x": 2.25, "y": 0.75, "r": 15 }, + { "x": 2.25, "y": 1.75, "r": 15 }, + { "x": 2.25, "y": 2.75, "r": 15 }, + { "x": 2.25, "y": 3.75, "r": 15 }, - { "x": 3.25, "y": 0, "r": 15 }, - { "x": 3.25, "y": 1, "r": 15 }, - { "x": 3.25, "y": 2, "r": 15 }, - { "x": 3.25, "y": 3, "r": 15 }, + { "x": 3.25, "y": 0.5, "r": 15 }, + { "x": 3.25, "y": 1.5, "r": 15 }, + { "x": 3.25, "y": 2.5, "r": 15 }, + { "x": 3.25, "y": 3.5, "r": 15 }, { "x": 4.25, "y": 0.25, "r": 15 }, { "x": 4.25, "y": 1.25, "r": 15 }, @@ -55,15 +56,15 @@ { "x": 11.25, "y": 1.25, "r": -15 }, { "x": 11.25, "y": 2.25, "r": -15 }, - { "x": 12.25, "y": 0, "r": -15 }, - { "x": 12.25, "y": 1, "r": -15 }, - { "x": 12.25, "y": 2, "r": -15 }, - { "x": 12.25, "y": 3, "r": -15 }, + { "x": 12.25, "y": 0.5, "r": -15 }, + { "x": 12.25, "y": 1.5, "r": -15 }, + { "x": 12.25, "y": 2.5, "r": -15 }, + { "x": 12.25, "y": 3.5, "r": -15 }, - { "x": 13.25, "y": 0.5, "r": -15 }, - { "x": 13.25, "y": 1.5, "r": -15 }, - { "x": 13.25, "y": 2.5, "r": -15 }, - { "x": 13.25, "y": 3.5, "r": -15 }, + { "x": 13.25, "y": 0.75, "r": -15 }, + { "x": 13.25, "y": 1.75, "r": -15 }, + { "x": 13.25, "y": 2.75, "r": -15 }, + { "x": 13.25, "y": 3.75, "r": -15 }, { "x": 14.25, "y": 0.75, "r": -15 }, { "x": 14.25, "y": 1.75, "r": -15 }, diff --git a/keyboards/signum/3_0/elitec/keymaps/default/generate_km.py b/keyboards/signum/3_0/elitec/keymaps/default/generate_km.py index 5147121b34..7778da8f55 100755 --- a/keyboards/signum/3_0/elitec/keymaps/default/generate_km.py +++ b/keyboards/signum/3_0/elitec/keymaps/default/generate_km.py @@ -104,7 +104,7 @@ if __name__ == "__main__": output.write(" * -------------------------------------------------\n") output.write(" */\n") - l_code = '\tLAYOUT(\n' + l_code = '\tLAYOUT_ortho_4x12(\n' for r in range(r_counter): r_counter -= 1 c_counter = 12 diff --git a/keyboards/signum/3_0/elitec/keymaps/default/keymap.c b/keyboards/signum/3_0/elitec/keymaps/default/keymap.c index d7feba349a..22d60085f4 100644 --- a/keyboards/signum/3_0/elitec/keymaps/default/keymap.c +++ b/keyboards/signum/3_0/elitec/keymaps/default/keymap.c @@ -634,7 +634,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * MO2 LGui LAlt | TT2 |LT6_SPC| TT4 | Enter | Space | TT2 | RAlt RGui RCtrl * ------------------------------------------------- */ - LAYOUT( + LAYOUT_ortho_4x12( 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_LCTRL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, @@ -652,7 +652,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * MO2 LGui LAlt | TT2 |LT6_SPC| TT4 | Enter | Space | TT2 | RAlt RGui RCtrl * ------------------------------------------------- */ - LAYOUT( + LAYOUT_ortho_4x12( KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_LCTRL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, @@ -665,16 +665,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ------------------------------------------------- ------------------------------------------------- * | | DF0 | DF1 | XXX | XXX | MO3 | | 4 | 4 | 5 | 6 | - | = | * ------------------------------------------------- ------------------------------------------------- - * | | MO5 | XXX | XXX | XXX | XXX | | 1 | 1 | 2 | 3 | \ | | + * | | XXX | XXX | XXX | XXX | MO5 | | 1 | 1 | 2 | 3 | \ | | * ----------------------------------------------------------------------------------------------------------------- - * TG2 | | | | | | 0 | + * TG2 | | Del | | |BSpace | 0 | * ------------------------------------------------- */ - LAYOUT( + LAYOUT_ortho_4x12( KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_RBRC, KC_TRNS, DF(0), DF(1), XXXXXXX, XXXXXXX, MO(3), KC_4, KC_4, KC_5, KC_6, KC_MINS, KC_EQL, - KC_TRNS, MO(5), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_1, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, - TG(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_0, KC_TRNS, KC_TRNS, KC_TRNS + KC_TRNS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, MO(5), KC_1, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, + TG(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_TRNS, KC_TRNS, KC_BSPC, KC_0, KC_TRNS, KC_TRNS, KC_TRNS ), /* Layer 3 @@ -688,7 +688,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * TG3 | | | | F10 | F11 | F12 | * ------------------------------------------------- */ - LAYOUT( + LAYOUT_ortho_4x12( KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, XXXXXXX, KC_TRNS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, MO(3), KC_F4, KC_F4, KC_F5, KC_F6, XXXXXXX, XXXXXXX, KC_TRNS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_F1, KC_F1, KC_F2, KC_F3, XXXXXXX, KC_TRNS, @@ -697,20 +697,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Layer 4 * ------------------------------------------------- ------------------------------------------------- - * | | Esc | Tab x | Tab n |CPg Dn |CPg Dn | |Pg Down| Home |^ Arrow|Insert |SInsert| Esc | + * | Esc | Esc | Tab x | Tab n |CPg Dn |CPg Dn | |Pg Down| Home |^ Arrow|Insert |SInsert| Esc | * ------------------------------------------------- ------------------------------------------------- - * | | Caps | < Gui |Gui Tab| 💥 | 💥 | |< Arrow|< Arrow|v Arrow|> Arrow| End |Pr Scr | + * | | Caps | < Gui |Gui Tab| > Gui | > Gui | |< Arrow|< Arrow|v Arrow|> Arrow| End |Pr Scr | * ------------------------------------------------- ------------------------------------------------- * | | XXX | XXX | XXX |CPg Up |CPg Up | | Pg Up | XXX |v Arrow| XXX | App | | * ----------------------------------------------------------------------------------------------------------------- - * TG4 | | | | | | | + * TG4 | | Del | | |BSpace | | * ------------------------------------------------- */ - LAYOUT( - KC_TRNS, KC_ESC, LCTL(KC_W), LCTL(KC_T), CTL_T(KC_PGDN), CTL_T(KC_PGDN), KC_PGDN, KC_HOME, KC_UP, KC_INS, SFT_T(KC_INS), KC_ESC, - KC_TRNS, KC_CAPS, LGUI_T(KC_RIGHT), LGUI_T(KC_TAB), XXXXXXX, XXXXXXX, KC_LEFT, KC_LEFT, KC_DOWN, KC_RIGHT, KC_END, KC_PSCR, + LAYOUT_ortho_4x12( + KC_ESC, KC_ESC, LCTL(KC_W), LCTL(KC_T), CTL_T(KC_PGDN), CTL_T(KC_PGDN), KC_PGDN, KC_HOME, KC_UP, KC_INS, SFT_T(KC_INS), KC_ESC, + KC_TRNS, KC_CAPS, LGUI_T(KC_LEFT), LGUI_T(KC_TAB), LGUI_T(KC_RIGHT), LGUI_T(KC_RIGHT), KC_LEFT, KC_LEFT, KC_DOWN, KC_RIGHT, KC_END, KC_PSCR, KC_TRNS, XXXXXXX, XXXXXXX, XXXXXXX, CTL_T(KC_PGUP), CTL_T(KC_PGUP), KC_PGUP, XXXXXXX, KC_DOWN, XXXXXXX, KC_APP, KC_TRNS, - TG(4), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + TG(4), KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_TRNS, KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), /* Layer 5 @@ -719,15 +719,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ------------------------------------------------- ------------------------------------------------- * | | XXX | |<< | Vol 0 | >>| | XXX | | XXX | XXX | XXX | XXX | XXX | Sleep | * ------------------------------------------------- ------------------------------------------------- - * | | XXX | XXX | Vol - | Vol - | XXX | | XXX | XXX | XXX | XXX | XXX | XXX | + * | | XXX | XXX | Vol - | Vol - | MO5 | | XXX | XXX | XXX | XXX | XXX | XXX | * ----------------------------------------------------------------------------------------------------------------- * TG5 | | | | | | | * ------------------------------------------------- */ - LAYOUT( + LAYOUT_ortho_4x12( KC_TRNS, XXXXXXX, KC_MPLY, KC_VOLU, KC_VOLU, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET, KC_PWR, KC_TRNS, XXXXXXX, KC_MPRV, KC_MUTE, KC_MNXT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_SLEP, - KC_TRNS, XXXXXXX, XXXXXXX, KC_VOLD, KC_VOLD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_TRNS, XXXXXXX, XXXXXXX, KC_VOLD, KC_VOLD, MO(5), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(5), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), @@ -742,7 +742,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * TG6 | | | | | | | * ------------------------------------------------- */ - LAYOUT( + LAYOUT_ortho_4x12( KC_TRNS, KC_ACL1, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_WH_U, KC_WH_L, KC_MS_U, KC_WH_R, XXXXXXX, XXXXXXX, KC_TRNS, KC_ACL2, KC_BTN3, KC_BTN2, KC_BTN1, KC_BTN1, KC_MS_L, KC_MS_L, KC_MS_D, KC_MS_R, XXXXXXX, XXXXXXX, KC_TRNS, KC_ACL0, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_WH_D, XXXXXXX, KC_MS_D, XXXXXXX, XXXXXXX, KC_TRNS, diff --git a/keyboards/signum/3_0/elitec/keymaps/default/layout.py b/keyboards/signum/3_0/elitec/keymaps/default/layout.py index 937fc172ce..323a583212 100644 --- a/keyboards/signum/3_0/elitec/keymaps/default/layout.py +++ b/keyboards/signum/3_0/elitec/keymaps/default/layout.py @@ -402,7 +402,7 @@ qmk_dict = { "Undo": "LCTL(KC_Z)", "Cut": "LCTL(KC_X)", "Copy": "LCTL(KC_C)", "Paste": "LCTL(KC_V)", "< Tab": "LCTL(S(KC_TAB))", "> Tab": "LCTL(KC_TAB)", "Tab x": "LCTL(KC_W)", "Tab n": "LCTL(KC_T)", - "Gui Tab": "LGUI_T(KC_TAB)", "< Gui": "LGUI_T(KC_LEFT)", "< Gui": "LGUI_T(KC_RIGHT)", + "Gui Tab": "LGUI_T(KC_TAB)", "< Gui": "LGUI_T(KC_LEFT)", "> Gui": "LGUI_T(KC_RIGHT)", "C+A+Del": "LCTL(LALT(KC_DEL))", "Mic 0": "LCTL(KC_M)", "Power": "KC_PWR", "Sleep": "KC_SLEP", @@ -446,8 +446,8 @@ colemak = [ numpad = [ ["`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "]"], ["", "DF0", "DF1", "XXX", "XXX", "MO3", "4", "4", "5", "6", "-", "="], - ["", "MO5", "XXX", "XXX", "XXX", "XXX", "1", "1", "2", "3", "\\", ""], - ["TG2", "", "", "", "", "", "", "", "0", "", "", ""], + ["", "XXX", "XXX", "XXX", "XXX", "MO5", "1", "1", "2", "3", "\\", ""], + ["TG2", "", "", "", "Del", "", "", "BSpace", "0", "", "", ""], ] # 3 @@ -460,17 +460,17 @@ fpad = [ # 4 movement = [ - ["", "Esc", "Tab x", "Tab n", "CPg Dn", "CPg Dn", "Pg Down", "Home", "^ Arrow", "Insert", "SInsert", "Esc"], + ["Esc", "Esc", "Tab x", "Tab n", "CPg Dn", "CPg Dn", "Pg Down", "Home", "^ Arrow", "Insert", "SInsert", "Esc"], ["", "Caps", "< Gui", "Gui Tab", "> Gui", "> Gui", "< Arrow", "< Arrow", "v Arrow", "> Arrow", "End", "Pr Scr"], ["", "XXX", "XXX", "XXX", "CPg Up", "CPg Up", "Pg Up", "XXX", "v Arrow", "XXX", "App", ""], - ["TG4", "", "", "", "", "", "", "", "", "", "", ""], + ["TG4", "", "", "", "Del", "", "", "BSpace", "", "", "", ""], ] # 5 media = [ ["", "XXX", "play/ps", "Vol +", "Vol +", "XXX", "XXX", "XXX", "XXX", "XXX", "_reset", "Power"], ["", "XXX", "|<<", "Vol 0", ">>|", "XXX", "XXX", "XXX", "XXX", "XXX", "XXX", "Sleep"], - ["", "XXX", "XXX", "Vol -", "Vol -", "XXX", "XXX", "XXX", "XXX", "XXX", "XXX", "XXX"], + ["", "XXX", "XXX", "Vol -", "Vol -", "MO5", "XXX", "XXX", "XXX", "XXX", "XXX", "XXX"], ["TG5", "", "", "", "", "", "", "", "", "", "", ""], ] diff --git a/keyboards/signum/3_0/elitec/keymaps/default/rules.mk b/keyboards/signum/3_0/elitec/keymaps/default/rules.mk new file mode 100644 index 0000000000..502b2def76 --- /dev/null +++ b/keyboards/signum/3_0/elitec/keymaps/default/rules.mk @@ -0,0 +1 @@ +UNICODEMAP_ENABLE = yes diff --git a/keyboards/signum/3_0/elitec/rules.mk b/keyboards/signum/3_0/elitec/rules.mk index d2f987b202..6a68eb443b 100644 --- a/keyboards/signum/3_0/elitec/rules.mk +++ b/keyboards/signum/3_0/elitec/rules.mk @@ -59,4 +59,6 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality AUDIO_ENABLE = no RGBLIGHT_ENABLE = no -UNICODEMAP_ENABLE = yes +UNICODEMAP_ENABLE = no + +LAYOUTS = ortho_4x12 From b5cb5ec6ddb15cfe336b835055f546f72d440a66 Mon Sep 17 00:00:00 2001 From: zvecr Date: Sat, 20 Apr 2019 16:02:59 +0100 Subject: [PATCH 29/61] Fix koyu readme encoding (#5655) --- keyboards/rama/koyu/readme.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/keyboards/rama/koyu/readme.md b/keyboards/rama/koyu/readme.md index 0372747f58..c249bf11b6 100644 --- a/keyboards/rama/koyu/readme.md +++ b/keyboards/rama/koyu/readme.md @@ -2,13 +2,13 @@ ![RAMA KOYU](https://static1.squarespace.com/static/563c788ae4b099120ae219e2/t/5b8bd6e6b8a045c95eac2003/1535891375794/RW-KOYU-A-RENDER-04-TOP.1335.jpg?format=1500w) -The wait for something isnt the most conscious desire, but that anticipation creates nostalgia. +The 'wait' for something isn't the most conscious desire, but that anticipation creates nostalgia. -At Rama Works, youve embraced this. From updates of the blog, to direct communication with the community, being part of a Rama Works product doesnt just start when you receive it. If youve ever received a Rama Works product, you know that no detail is overlooked. +At Rama Works, you've embraced this. From updates of the blog, to direct communication with the community, being part of a Rama Works product doesn't just start when you receive it. If you've ever received a Rama Works product, you know that no detail is overlooked. -Let us take you on a journey that will capture that sensory experience, and explore the gravitational interaction between aesthetic and design. The Rama Works X element personifies the understanding that taking something away doesnt necessarily make it less. +Let us take you on a journey that will capture that sensory experience, and explore the gravitational interaction between aesthetic and design. The Rama Works 'X' element personifies the understanding that taking something away doesn't necessarily make it less. -This is the sound of Rama Works. Never too busya feeling of delightful modern weightlessness. A rich sonic experience. Sparse and ethereal, this music boldly inhabits a nondescript, borderless space. Warm, synthetic textures, bespoke musical sound design. percussive elements percolating and accentuating movement on the screen and in the stereo field. a sonic palette full of clicks, taps and resonances evoking a sense of calm comfort and familiarity. +This is the sound of Rama Works. Never too busy-a feeling of delightful modern weightlessness. A rich sonic experience. Sparse and ethereal, this music boldly inhabits a nondescript, borderless space. Warm, synthetic textures, bespoke musical sound design. percussive elements percolating and accentuating movement on the screen and in the stereo field. a sonic palette full of clicks, taps and resonances evoking a sense of calm comfort and familiarity. [More info at RAMA WORKS](https://rama.works/koyu/) From 0a645225b9c863a106921185a6c2e0c340f10694 Mon Sep 17 00:00:00 2001 From: Ryan Caltabiano Date: Mon, 15 Apr 2019 22:32:57 -0500 Subject: [PATCH 30/61] OLED Driver Feature --- common_features.mk | 7 + docs/feature_oled_driver.md | 246 ++++++++ docs/hardware_drivers.md | 6 +- drivers/arm/i2c_master.c | 40 +- drivers/arm/i2c_master.h | 20 +- drivers/avr/i2c_master.c | 4 +- drivers/avr/i2c_master.h | 6 +- drivers/oled/glcdfont.c | 240 ++++++++ drivers/oled/oled_driver.c | 528 ++++++++++++++++++ drivers/oled/oled_driver.h | 183 ++++++ .../cannonkeys/satisfaction75/i2c_master.c | 46 +- keyboards/sol/common/glcdfont.c | 140 +++-- keyboards/sol/common/ssd1306.c | 329 ----------- keyboards/sol/common/ssd1306.h | 92 --- keyboards/sol/i2c.c | 162 ------ keyboards/sol/i2c.h | 49 -- keyboards/sol/keymaps/brianweyer/config.h | 2 - keyboards/sol/keymaps/brianweyer/keymap.c | 146 ++--- keyboards/sol/keymaps/brianweyer/rules.mk | 14 +- keyboards/sol/keymaps/danielhklein/keymap.c | 145 ++--- keyboards/sol/keymaps/danielhklein/rules.mk | 8 +- keyboards/sol/keymaps/default/keymap.c | 145 ++--- keyboards/sol/keymaps/default/rules.mk | 8 +- keyboards/sol/keymaps/kageurufu/rules.mk | 7 +- keyboards/sol/rev1/config.h | 6 - keyboards/sol/rev1/rev1.c | 7 - keyboards/sol/rev1/split_util.h | 2 - keyboards/sol/rules.mk | 7 +- quantum/quantum.c | 13 + quantum/quantum.h | 4 + 30 files changed, 1540 insertions(+), 1072 deletions(-) create mode 100644 docs/feature_oled_driver.md create mode 100644 drivers/oled/glcdfont.c create mode 100644 drivers/oled/oled_driver.c create mode 100644 drivers/oled/oled_driver.h delete mode 100644 keyboards/sol/common/ssd1306.c delete mode 100644 keyboards/sol/common/ssd1306.h delete mode 100644 keyboards/sol/i2c.c delete mode 100644 keyboards/sol/i2c.h diff --git a/common_features.mk b/common_features.mk index eb623d18fa..fbfbc3ebc6 100644 --- a/common_features.mk +++ b/common_features.mk @@ -336,3 +336,10 @@ ifeq ($(strip $(SPLIT_KEYBOARD)), yes) endif COMMON_VPATH += $(QUANTUM_PATH)/split_common endif + +ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes) + OPT_DEFS += -DOLED_DRIVER_ENABLE + COMMON_VPATH += $(DRIVER_PATH)/oled + QUANTUM_LIB_SRC += i2c_master.c + SRC += oled_driver.c +endif diff --git a/docs/feature_oled_driver.md b/docs/feature_oled_driver.md new file mode 100644 index 0000000000..f261bbef18 --- /dev/null +++ b/docs/feature_oled_driver.md @@ -0,0 +1,246 @@ +# OLED Driver + +## OLED Supported Hardware + +128x32 OLED modules using SSD1306 driver IC over I2C. Supported on AVR based keyboards. Possible but untested hardware includes ARM based keyboards and other sized OLED modules using SSD1306 over I2C, such as 128x64. + +!> Warning: This OLED Driver currently uses the new i2c_master driver from split common code. If your split keyboard uses i2c to communication between sides this driver could cause an address conflict (serial is fine). Please contact your keyboard vendor and ask them to migrate to the latest split common code to fix this. + +## Usage + +To enable the OLED feature, there are three steps. First, when compiling your keyboard, you'll need to set `OLED_DRIVER_ENABLE=yes` in `rules.mk`, e.g.: + +``` +BOOTMAGIC_ENABLE = no +MOUSEKEY_ENABLE = no +STENO_ENABLE = no +EXTRAKEY_ENABLE = yes +OLED_DRIVER_ENABLE = yes +``` + +This enables the feature and the `OLED_DRIVER_ENABLE` define. Then in your `keymap.c` file, you will need to implement the user task call, e.g: + +```C++ +#ifdef OLED_DRIVER_ENABLE +void oled_task_user(void) { + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer: "), false); + switch (biton32(layer_state)) { + case _QWERTY: + oled_write_P(PSTR("Default\n"), false); + break; + case _FN: + oled_write_P(PSTR("FN\n"), false); + break; + case _ADJ: + oled_write_P(PSTR("ADJ\n"), false); + break; + default: + // Or use the write_ln shortcut + oled_write_P(PSTR("Undefined\n"), false); + } + + // Host Keyboard LED Status + uint8_t led_usb_state = host_keyboard_leds(); + oled_write_P(led_usb_state & (1<Requires user to implement the below defines. | +|`OLED_DISPLAY_WIDTH` |`128` |The width of the OLED display. | +|`OLED_DISPLAY_HEIGHT` |`32` |The height of the OLED display. | +|`OLED_MATRIX_SIZE` |`512` |The local buffer size to allocate.
`(OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH)`| +|`OLED_BLOCK_TYPE` |`uint8_t` |The unsigned integer type to use for dirty rendering.| +|`OLED_BLOCK_COUNT` |`8` |The number of blocks the display is divided into for dirty rendering.
`(sizeof(OLED_BLOCK_TYPE) * 8)`| +|`OLED_BLOCK_SIZE` |`64` |The size of each block for dirty rendering
`(OLED_MATRIX_SIZE / OLED_BLOCK_COUNT)`| +|`OLED_SOURCE_MAP` |`{ 0, ... N }` |Precalculated source array to use for mapping source buffer to target OLED memory in 90 degree rendering. | +|`OLED_TARGET_MAP` |`{ 48, ... N }`|Precalculated target array to use for mapping source buffer to target OLED memory in 90 degree rendering. | + + +### 90 Degree Rotation - Technical Mumbo Jumbo + + OLED displays driven by SSD1306 drivers only natively support in hard ware 0 degree and 180 degree rendering. This feature is done in software and not free. Using this feature will increase the time to calculate what data to send over i2c to the OLED. If you are strapped for cycles, this can cause keycodes to not register. In testing however, the rendering time on an `atmega32u4` board only went from 2ms to 5ms and keycodes not registering was only noticed once we hit 15ms. + + 90 Degree Rotated Rendering is achieved by using bitwise operations to rotate each 8 block of memory and uses two precalculated arrays to remap buffer memory to OLED memory. The memory map defines are precalculated for remap performance and are calculated based on the OLED Height, Width, and Block Size. For example, in the default 128x32 implementation we have a 64 byte block size. This gives us eight 8 byte blocks that need to be rotated and rendered. The OLED renders horizontally two 8 byte blocks before moving down a page, e.g: + +| | | | | | | +|---|---|---|---|---|---| +| 0 | 1 | | | | | +| 2 | 3 | | | | | +| 4 | 5 | | | | | +| 6 | 7 | | | | | + +However the local buffer is stored as if it was Height x Width display instead of Width x Height, e.g: + +| | | | | | | +|---|---|---|---|---|---| +| 3 | 7 | | | | | +| 2 | 6 | | | | | +| 1 | 5 | | | | | +| 0 | 4 | | | | | + +So those precalculated arrays just index the memory offsets in the order in which each one iterates its data. + +## OLED API + +```C++ +// Initialize the OLED display, rotating the rendered output 180 degrees if true. +// Returns true if the OLED was initialized successfully +bool oled_init(bool flip180); + +// Called at the start of oled_init, weak function overridable by the user +// flip180 - the value passed into oled_init +// Return true if you want the oled to be flip180 +bool oled_init_user(bool flip180); + +// Clears the display buffer, resets cursor position to 0, and sets the buffer to dirty for rendering +void oled_clear(void); + +// Renders the dirty chunks of the buffer to OLED display +void oled_render(void); + +// Moves cursor to character position indicated by column and line, wraps if out of bounds +// Max column denoted by 'oled_max_chars()' and max lines by 'oled_max_lines()' functions +void oled_set_cursor(uint8_t col, uint8_t line); + +// Advances the cursor to the next page, writing ' ' if true +// Wraps to the begining when out of bounds +void oled_advance_page(bool clearPageRemainder); + +// Moves the cursor forward 1 character length +// Advance page if there is not enough room for the next character +// Wraps to the begining when out of bounds +void oled_advance_char(void); + +// Writes a single character to the buffer at current cursor position +// Advances the cursor while writing, inverts the pixels if true +// Main handler that writes character data to the display buffer +void oled_write_char(const char data, bool invert); + +// Writes a string to the buffer at current cursor position +// Advances the cursor while writing, inverts the pixels if true +void oled_write(const char *data, bool invert); + +// Writes a string to the buffer at current cursor position +// Advances the cursor while writing, inverts the pixels if true +// Advances the cursor to the next page, wiring ' ' to the remainder of the current page +void oled_write_ln(const char *data, bool invert); + +// Writes a PROGMEM string to the buffer at current cursor position +// Advances the cursor while writing, inverts the pixels if true +// Remapped to call 'void oled_write(const char *data, bool invert);' on ARM +void oled_write_P(const char *data, bool invert); + +// Writes a PROGMEM string to the buffer at current cursor position +// Advances the cursor while writing, inverts the pixels if true +// Advances the cursor to the next page, wiring ' ' to the remainder of the current page +// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM +void oled_write_ln_P(const char *data, bool invert); + +// Can be used to manually turn on the screen if it is off +// Returns true if the screen was on or turns on +bool oled_on(void); + +// Can be used to manually turn off the screen if it is on +// Returns true if the screen was off or turns off +bool oled_off(void); + +// Basically it's oled_render, but with timeout management and oled_task_user calling! +void oled_task(void); + +// Called at the start of oled_task, weak function overridable by the user +void oled_task_user(void); + +// Scrolls the entire display right +// Returns true if the screen was scrolling or starts scrolling +// NOTE: display contents cannot be changed while scrolling +bool oled_scroll_right(void); + +// Scrolls the entire display left +// Returns true if the screen was scrolling or starts scrolling +// NOTE: display contents cannot be changed while scrolling +bool oled_scroll_left(void); + +// Turns off display scrolling +// Returns true if the screen was not scrolling or stops scrolling +bool oled_scroll_off(void); + +// Returns the maximum number of characters that will fit on a line +uint8_t oled_max_chars(void); + +// Returns the maximum number of lines that will fit on the oled +uint8_t oled_max_lines(void); +``` + +## SSD1306.h driver conversion guide + +|Old API |Recommended New API | +|---------------------------|-----------------------------------| +|`struct CharacterMatrix` |*removed - delete all references* | +|`iota_gfx_init` |`oled_init` | +|`iota_gfx_on` |`oled_on` | +|`iota_gfx_off` |`oled_off` | +|`iota_gfx_flush` |`oled_render` | +|`iota_gfx_write_char` |`oled_write_char` | +|`iota_gfx_write` |`oled_write` | +|`iota_gfx_write_P` |`oled_write_P` | +|`iota_gfx_clear_screen` |`oled_clear` | +|`matrix_clear` |*removed - delete all references* | +|`matrix_write_char_inner` |`oled_write_char` | +|`matrix_write_char` |`oled_write_char` | +|`matrix_write` |`oled_write` | +|`matrix_write_ln` |`oled_write_ln` | +|`matrix_write_P` |`oled_write_P` | +|`matrix_write_ln_P` |`oled_write_ln_P` | +|`matrix_render` |`oled_render` | +|`iota_gfx_task` |`oled_task` | +|`iota_gfx_task_user` |`oled_task_user` | diff --git a/docs/hardware_drivers.md b/docs/hardware_drivers.md index 4c1266f224..023e92982c 100644 --- a/docs/hardware_drivers.md +++ b/docs/hardware_drivers.md @@ -14,9 +14,9 @@ QMK is used on a lot of different hardware. While support for the most common MC Support for addressing pins on the ProMicro by their Arduino name rather than their AVR name. This needs to be better documented, if you are trying to do this and reading the code doesn't help please [open an issue](https://github.com/qmk/qmk_firmware/issues/new) and we can help you through the process. -## SSD1306 (AVR Only) +## SSD1306 OLED Driver -Support for SSD1306 based OLED displays. This needs to be better documented, if you are trying to do this and reading the code doesn't help please [open an issue](https://github.com/qmk/qmk_firmware/issues/new) and we can help you through the process. +Support for SSD1306 based OLED displays. For more information see the [OLED Driver Feature](feature_oled_driver.md) page. ## uGFX @@ -32,4 +32,4 @@ Support for up to 2 drivers. Each driver impliments 2 charlieplex matrices to in ## IS31FL3733 -Support for up to a single driver with room for expansion. Each driver can control 192 individual LEDs or 64 RGB LEDs. For more information on how to setup the driver see the [RGB Matrix](feature_rgb_matrix.md) page. \ No newline at end of file +Support for up to a single driver with room for expansion. Each driver can control 192 individual LEDs or 64 RGB LEDs. For more information on how to setup the driver see the [RGB Matrix](feature_rgb_matrix.md) page. diff --git a/drivers/arm/i2c_master.c b/drivers/arm/i2c_master.c index 0e5edcc380..7369398cc4 100644 --- a/drivers/arm/i2c_master.c +++ b/drivers/arm/i2c_master.c @@ -42,6 +42,18 @@ static const I2CConfig i2cconfig = { 0 }; +static i2c_status_t chibios_to_qmk(const msg_t* status) { + switch (*status) { + case I2C_NO_ERROR: + return I2C_STATUS_SUCCESS; + case I2C_TIMEOUT: + return I2C_STATUS_TIMEOUT; + // I2C_BUS_ERROR, I2C_ARBITRATION_LOST, I2C_ACK_FAILURE, I2C_OVERRUN, I2C_PEC_ERROR, I2C_SMB_ALERT + default: + return I2C_STATUS_ERROR; + } +} + __attribute__ ((weak)) void i2c_init(void) { @@ -57,29 +69,30 @@ void i2c_init(void) //i2cInit(); //This is invoked by halInit() so no need to redo it. } -// This is usually not needed -uint8_t i2c_start(uint8_t address) +i2c_status_t i2c_start(uint8_t address) { i2c_address = address; i2cStart(&I2C_DRIVER, &i2cconfig); - return 0; + return I2C_STATUS_SUCCESS; } -uint8_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) +i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) { i2c_address = address; i2cStart(&I2C_DRIVER, &i2cconfig); - return i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, MS2ST(timeout)); + msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, MS2ST(timeout)); + return chibios_to_qmk(&status); } -uint8_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) +i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) { i2c_address = address; i2cStart(&I2C_DRIVER, &i2cconfig); - return i2cMasterReceiveTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, MS2ST(timeout)); + msg_t status = i2cMasterReceiveTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, MS2ST(timeout)); + return chibios_to_qmk(&status); } -uint8_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout) +i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout) { i2c_address = devaddr; i2cStart(&I2C_DRIVER, &i2cconfig); @@ -91,18 +104,19 @@ uint8_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t l } complete_packet[0] = regaddr; - return i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), complete_packet, length + 1, 0, 0, MS2ST(timeout)); + msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), complete_packet, length + 1, 0, 0, MS2ST(timeout)); + return chibios_to_qmk(&status); } -uint8_t i2c_readReg(uint8_t devaddr, uint8_t* regaddr, uint8_t* data, uint16_t length, uint16_t timeout) +i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t* regaddr, uint8_t* data, uint16_t length, uint16_t timeout) { i2c_address = devaddr; i2cStart(&I2C_DRIVER, &i2cconfig); - return i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), regaddr, 1, data, length, MS2ST(timeout)); + msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), regaddr, 1, data, length, MS2ST(timeout)); + return chibios_to_qmk(&status); } -uint8_t i2c_stop(void) +void i2c_stop(void) { i2cStop(&I2C_DRIVER); - return 0; } diff --git a/drivers/arm/i2c_master.h b/drivers/arm/i2c_master.h index 4ab2301f8c..a15f1702dd 100644 --- a/drivers/arm/i2c_master.h +++ b/drivers/arm/i2c_master.h @@ -40,11 +40,17 @@ #define I2C_DRIVER I2CD1 #endif +typedef int16_t i2c_status_t; + +#define I2C_STATUS_SUCCESS (0) +#define I2C_STATUS_ERROR (-1) +#define I2C_STATUS_TIMEOUT (-2) + void i2c_init(void); -uint8_t i2c_start(uint8_t address); -uint8_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout); -uint8_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout); -uint8_t i2c_transmit_receive(uint8_t address, uint8_t * tx_body, uint16_t tx_length, uint8_t * rx_body, uint16_t rx_length); -uint8_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout); -uint8_t i2c_readReg(uint8_t devaddr, uint8_t* regaddr, uint8_t* data, uint16_t length, uint16_t timeout); -uint8_t i2c_stop(void); +i2c_status_t i2c_start(uint8_t address); +i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout); +i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout); +i2c_status_t i2c_transmit_receive(uint8_t address, uint8_t * tx_body, uint16_t tx_length, uint8_t * rx_body, uint16_t rx_length); +i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout); +i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t* regaddr, uint8_t* data, uint16_t length, uint16_t timeout); +void i2c_stop(void); diff --git a/drivers/avr/i2c_master.c b/drivers/avr/i2c_master.c index ba6d0d1586..a7364bae08 100755 --- a/drivers/avr/i2c_master.c +++ b/drivers/avr/i2c_master.c @@ -121,7 +121,7 @@ int16_t i2c_read_nack(uint16_t timeout) { return TWDR; } -i2c_status_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) { +i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) { i2c_status_t status = i2c_start(address | I2C_WRITE, timeout); for (uint16_t i = 0; i < length && status >= 0; i++) { @@ -155,7 +155,7 @@ i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16 return (status < 0) ? status : I2C_STATUS_SUCCESS; } -i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout) { +i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout) { i2c_status_t status = i2c_start(devaddr | 0x00, timeout); if (status >= 0) { status = i2c_write(regaddr, timeout); diff --git a/drivers/avr/i2c_master.h b/drivers/avr/i2c_master.h index 81a7fb5e32..b4613115d9 100755 --- a/drivers/avr/i2c_master.h +++ b/drivers/avr/i2c_master.h @@ -22,10 +22,10 @@ i2c_status_t i2c_start(uint8_t address, uint16_t timeout); i2c_status_t i2c_write(uint8_t data, uint16_t timeout); int16_t i2c_read_ack(uint16_t timeout); int16_t i2c_read_nack(uint16_t timeout); -i2c_status_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout); +i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout); i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout); -i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout); +i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout); i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout); void i2c_stop(void); -#endif // I2C_MASTER_H \ No newline at end of file +#endif // I2C_MASTER_H diff --git a/drivers/oled/glcdfont.c b/drivers/oled/glcdfont.c new file mode 100644 index 0000000000..150be9e944 --- /dev/null +++ b/drivers/oled/glcdfont.c @@ -0,0 +1,240 @@ +#pragma once + +#ifdef __AVR__ + #include + #include +#elif defined(ESP8266) + #include +#else + #define PROGMEM +#endif + +// Helidox 8x6 font with QMK Firmware Logo +// Online editor: http://teripom.x0.com/ + +static const unsigned char font[] PROGMEM = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, + 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, + 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, + 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, + 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, + 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, + 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, + 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, + 0x00, 0x18, 0x24, 0x18, 0x00, 0x00, + 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, + 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, + 0x26, 0x29, 0x79, 0x29, 0x26, 0x00, + 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, + 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, + 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, + 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, + 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, + 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, + 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, + 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, + 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, + 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, + 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, + 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, + 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, + 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, + 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, + 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, + 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, + 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, + 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, + 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, + 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, + 0x23, 0x13, 0x08, 0x64, 0x62, 0x00, + 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, + 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, + 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, + 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, + 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, + 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, + 0x00, 0x80, 0x70, 0x30, 0x00, 0x00, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, + 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, + 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, + 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, + 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, + 0x72, 0x49, 0x49, 0x49, 0x46, 0x00, + 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, + 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, + 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, + 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, + 0x41, 0x21, 0x11, 0x09, 0x07, 0x00, + 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, + 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, + 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, + 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, + 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, + 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, + 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, + 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, + 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, + 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, + 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, + 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, + 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, + 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, + 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, + 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, + 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, + 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, + 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, + 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, + 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, + 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, + 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, + 0x03, 0x04, 0x78, 0x04, 0x03, 0x00, + 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, + 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, + 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, + 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, + 0x04, 0x02, 0x01, 0x02, 0x04, 0x00, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x00, 0x03, 0x07, 0x08, 0x00, 0x00, + 0x20, 0x54, 0x54, 0x78, 0x40, 0x00, + 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x28, 0x00, + 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, + 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, + 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, + 0x18, 0xA4, 0xA4, 0x9C, 0x78, 0x00, + 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, + 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, + 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, + 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, + 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, + 0xFC, 0x18, 0x24, 0x24, 0x18, 0x00, + 0x18, 0x24, 0x24, 0x18, 0xFC, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, + 0x48, 0x54, 0x54, 0x54, 0x24, 0x00, + 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, + 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, + 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, + 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, + 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, + 0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00, + 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, + 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, + 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, + 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, + 0x02, 0x01, 0x02, 0x04, 0x02, 0x00, + 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x40, 0x40, 0xF0, 0xF8, 0xF8, + 0xFF, 0x38, 0xFF, 0xF8, 0xF8, 0x3F, + 0xF8, 0xF8, 0xFF, 0x38, 0xFF, 0xF8, + 0xF8, 0xF0, 0x40, 0x40, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0xC0, 0xC0, 0xC0, 0x80, 0x00, 0x00, + 0xC0, 0xC0, 0x80, 0x00, 0x00, 0x00, + 0x80, 0xC0, 0xC0, 0x00, 0xC0, 0xC0, + 0x00, 0x00, 0x80, 0xC0, 0xC0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, + 0xC0, 0xC0, 0xC0, 0x00, 0xC0, 0xC0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, + 0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, + 0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, + 0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00, + 0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B, + 0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, + 0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE, + 0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00, + 0x00, 0x00, 0x00, 0xE0, 0xEC, 0xDF, + 0xFC, 0xE0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x49, 0x49, 0xFF, 0xFF, 0xFF, + 0xFF, 0xE0, 0xDF, 0xBF, 0xBF, 0x00, + 0xBF, 0xBF, 0xDF, 0xE0, 0xFF, 0xFF, + 0xFF, 0xFF, 0x49, 0x49, 0x49, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x3F, + 0x60, 0x60, 0xE0, 0xBF, 0x1F, 0x00, + 0x7F, 0x7F, 0x07, 0x1E, 0x38, 0x1E, + 0x07, 0x7F, 0x7F, 0x00, 0x7F, 0x7F, + 0x0E, 0x1F, 0x3B, 0x71, 0x60, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, + 0x0C, 0x0C, 0x0C, 0x00, 0x7E, 0x7E, + 0x00, 0x7F, 0x7E, 0x03, 0x03, 0x00, + 0x7F, 0x7E, 0x03, 0x03, 0x7E, 0x7E, + 0x03, 0x03, 0x7F, 0x7E, 0x00, 0x0F, + 0x3E, 0x70, 0x3C, 0x06, 0x3C, 0x70, + 0x3E, 0x0F, 0x00, 0x32, 0x7B, 0x49, + 0x49, 0x3F, 0x7E, 0x00, 0x7F, 0x7E, + 0x03, 0x03, 0x00, 0x1E, 0x3F, 0x69, + 0x69, 0x6F, 0x26, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, + 0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, + 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00, + 0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20, + 0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, + 0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F, + 0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00, + 0x40, 0x7C, 0x3F, 0x3F, 0x23, 0x01, + 0x23, 0x3F, 0x37, 0x6C, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x07, 0x0F, 0x0F, + 0x7F, 0x0F, 0x7F, 0x0F, 0x0F, 0x7E, + 0x0F, 0x0F, 0x7F, 0x0F, 0x7F, 0x0F, + 0x0F, 0x07, 0x01, 0x01, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c new file mode 100644 index 0000000000..aa025d7a4c --- /dev/null +++ b/drivers/oled/oled_driver.c @@ -0,0 +1,528 @@ +/* +Copyright 2019 Ryan Caltabiano + +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 "i2c_master.h" +#include "oled_driver.h" +#include OLED_FONT_H +#include "timer.h" +#include "print.h" + +#include + +#if defined(__AVR__) + #include + #include +#elif defined(ESP8266) + #include +#else // defined(ESP8266) + #define PROGMEM + #define memcpy_P(des, src, len) memcpy(des, src, len) +#endif // defined(__AVR__) + +// Used commands from spec sheet: https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf +// Fundamental Commands +#define CONTRAST 0x81 +#define DISPLAY_ALL_ON 0xA5 +#define DISPLAY_ALL_ON_RESUME 0xA4 +#define NORMAL_DISPLAY 0xA6 +#define DISPLAY_ON 0xAF +#define DISPLAY_OFF 0xAE + +// Scrolling Commands +#define ACTIVATE_SCROLL 0x2F +#define DEACTIVATE_SCROLL 0x2E +#define SCROLL_RIGHT 0x26 +#define SCROLL_LEFT 0x27 +#define SCROLL_RIGHT_UP 0x29 +#define SCROLL_LEFT_UP 0x2A + +// Addressing Setting Commands +#define MEMORY_MODE 0x20 +#define COLUMN_ADDR 0x21 +#define PAGE_ADDR 0x22 + +// Hardware Configuration Commands +#define DISPLAY_START_LINE 0x40 +#define SEGMENT_REMAP 0xA0 +#define SEGMENT_REMAP_INV 0xA1 +#define MULTIPLEX_RATIO 0xA8 +#define COM_SCAN_INC 0xC0 +#define COM_SCAN_DEC 0xC8 +#define DISPLAY_OFFSET 0xD3 +#define COM_PINS 0xDA + +// Timing & Driving Commands +#define DISPLAY_CLOCK 0xD5 +#define PRE_CHARGE_PERIOD 0xD9 +#define VCOM_DETECT 0xDB + +// Charge Pump Commands +#define CHARGE_PUMP 0x8D + +// Misc defines +#define OLED_TIMEOUT 60000 +#define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) +#define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) + +// i2c defines +#define I2C_CMD 0x00 +#define I2C_DATA 0x40 +#if defined(__AVR__) + // already defined on ARM + #define I2C_TIMEOUT 100 + #define I2C_TRANSMIT_P(data) i2c_transmit_P((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), I2C_TIMEOUT) +#else // defined(__AVR__) + #define I2C_TRANSMIT_P(data) i2c_transmit((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), I2C_TIMEOUT) +#endif // defined(__AVR__) +#define I2C_TRANSMIT(data) i2c_transmit((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), I2C_TIMEOUT) +#define I2C_WRITE_REG(mode, data, size) i2c_writeReg((OLED_DISPLAY_ADDRESS << 1), mode, data, size, I2C_TIMEOUT) + +#define HAS_FLAGS(bits, flags) ((bits & flags) == flags) + +// Display buffer's is the same as the OLED memory layout +// this is so we don't end up with rounding errors with +// parts of the display unusable or don't get cleared correctly +// and also allows for drawing & inverting +uint8_t oled_buffer[OLED_MATRIX_SIZE]; +uint8_t* oled_cursor; +OLED_BLOCK_TYPE oled_dirty = 0; +bool oled_initialized = false; +bool oled_active = false; +bool oled_scrolling = false; +uint8_t oled_rotation = 0; +uint8_t oled_rotation_width = 0; +#if !defined(OLED_DISABLE_TIMEOUT) + uint16_t oled_last_activity; +#endif + +// Internal variables to reduce math instructions + +#if defined(__AVR__) +// identical to i2c_transmit, but for PROGMEM since all initialization is in PROGMEM arrays currently +// probably should move this into i2c_master... +static i2c_status_t i2c_transmit_P(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) { + i2c_status_t status = i2c_start(address | I2C_WRITE, timeout); + + for (uint16_t i = 0; i < length && status >= 0; i++) { + status = i2c_write(pgm_read_byte((const char*)data++), timeout); + if (status) break; + } + + i2c_stop(); + + return status; +} +#endif + +// Flips the rendering bits for a character at the current cursor position +static void InvertCharacter(uint8_t *cursor) +{ + const uint8_t *end = cursor + OLED_FONT_WIDTH; + while (cursor < end) { + *cursor = ~(*cursor); + cursor++; + } +} + +bool oled_init(uint8_t rotation) { + oled_rotation = oled_init_user(rotation); + if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) { + oled_rotation_width = OLED_DISPLAY_WIDTH; + } else { + oled_rotation_width = OLED_DISPLAY_HEIGHT; + } + i2c_init(); + + static const uint8_t PROGMEM display_setup1[] = { + I2C_CMD, + DISPLAY_OFF, + DISPLAY_CLOCK, 0x80, + MULTIPLEX_RATIO, OLED_DISPLAY_HEIGHT - 1, + DISPLAY_OFFSET, 0x00, + DISPLAY_START_LINE | 0x00, + CHARGE_PUMP, 0x14, + MEMORY_MODE, 0x00, }; // Horizontal addressing mode + if (I2C_TRANSMIT_P(display_setup1) != I2C_STATUS_SUCCESS) { + print("oled_init cmd set 1 failed\n"); + return false; + } + + if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_180)) { + static const uint8_t PROGMEM display_normal[] = { + I2C_CMD, + SEGMENT_REMAP_INV, + COM_SCAN_DEC }; + if (I2C_TRANSMIT_P(display_normal) != I2C_STATUS_SUCCESS) { + print("oled_init cmd normal rotation failed\n"); + return false; + } + } else { + static const uint8_t PROGMEM display_flipped[] = { + I2C_CMD, + SEGMENT_REMAP, + COM_SCAN_INC }; + if (I2C_TRANSMIT_P(display_flipped) != I2C_STATUS_SUCCESS) { + print("display_flipped failed\n"); + return false; + } + } + + static const uint8_t PROGMEM display_setup2[] = { + I2C_CMD, + COM_PINS, 0x02, + CONTRAST, 0x8F, + PRE_CHARGE_PERIOD, 0xF1, + VCOM_DETECT, 0x40, + DISPLAY_ALL_ON_RESUME, + NORMAL_DISPLAY, + DEACTIVATE_SCROLL, + DISPLAY_ON }; + if (I2C_TRANSMIT_P(display_setup2) != I2C_STATUS_SUCCESS) { + print("display_setup2 failed\n"); + return false; + } + + oled_clear(); + oled_initialized = true; + oled_active = true; + oled_scrolling = false; + return true; +} + +__attribute__((weak)) +uint8_t oled_init_user(uint8_t rotation) { + return rotation; +} + +void oled_clear(void) { + memset(oled_buffer, 0, sizeof(oled_buffer)); + oled_cursor = &oled_buffer[0]; + oled_dirty = -1; // -1 will be max value as long as display_dirty is unsigned type +} + +static void calc_bounds(uint8_t update_start, uint8_t* cmd_array) +{ + cmd_array[1] = OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_WIDTH; + cmd_array[4] = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_WIDTH; + cmd_array[2] = (OLED_BLOCK_SIZE + OLED_DISPLAY_WIDTH - 1) % OLED_DISPLAY_WIDTH + cmd_array[1]; + cmd_array[5] = (OLED_BLOCK_SIZE + OLED_DISPLAY_WIDTH - 1) / OLED_DISPLAY_WIDTH - 1; +} + +static void calc_bounds_90(uint8_t update_start, uint8_t* cmd_array) +{ + cmd_array[1] = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_HEIGHT * 8; + cmd_array[4] = OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_HEIGHT; + cmd_array[2] = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) / OLED_DISPLAY_HEIGHT * 8 - 1 + cmd_array[1];; + cmd_array[5] = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) % OLED_DISPLAY_HEIGHT / 8; +} + +uint8_t crot(uint8_t a, int8_t n) +{ + const uint8_t mask = 0x7; + n &= mask; + return a << n | a >> (-n & mask); +} + +static void rotate_90(const uint8_t* src, uint8_t* dest) +{ + for (uint8_t i = 0, shift = 7; i < 8; ++i, --shift) { + uint8_t selector = (1 << i); + for (uint8_t j = 0; j < 8; ++j) { + dest[i] |= crot(src[j] & selector, shift - (int8_t)j); + } + } +} + +void oled_render(void) { + // Do we have work to do? + if (!oled_dirty || oled_scrolling) { + return; + } + + // Find first dirty block + uint8_t update_start = 0; + while (!(oled_dirty & (1 << update_start))) { ++update_start; } + + // Set column & page position + static uint8_t display_start[] = { + I2C_CMD, + COLUMN_ADDR, 0, OLED_DISPLAY_WIDTH - 1, + PAGE_ADDR, 0, OLED_DISPLAY_HEIGHT / 8 - 1 }; + if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) { + calc_bounds(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start + } else { + calc_bounds_90(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start + } + + // Send column & page position + if (I2C_TRANSMIT(display_start) != I2C_STATUS_SUCCESS) { + print("oled_render offset command failed\n"); + return; + } + + if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) { + // Send render data chunk as is + if (I2C_WRITE_REG(I2C_DATA, &oled_buffer[OLED_BLOCK_SIZE * update_start], OLED_BLOCK_SIZE) != I2C_STATUS_SUCCESS) { + print("oled_render data failed\n"); + return; + } + } else { + // Rotate the render chunks + const static uint8_t source_map[] = OLED_SOURCE_MAP; + const static uint8_t target_map[] = OLED_TARGET_MAP; + + static uint8_t temp_buffer[OLED_BLOCK_SIZE]; + memset(temp_buffer, 0, sizeof(temp_buffer)); + for(uint8_t i = 0; i < sizeof(source_map); ++i) { + rotate_90(&oled_buffer[OLED_BLOCK_SIZE * update_start + source_map[i]], &temp_buffer[target_map[i]]); + } + + // Send render data chunk after rotating + if (I2C_WRITE_REG(I2C_DATA, &temp_buffer[0], OLED_BLOCK_SIZE) != I2C_STATUS_SUCCESS) { + print("oled_render data failed\n"); + return; + } + } + + // Turn on display if it is off + oled_on(); + + // Clear dirty flag + oled_dirty &= ~(1 << update_start); +} + +void oled_set_cursor(uint8_t col, uint8_t line) { + uint16_t index = line * oled_rotation_width + col * OLED_FONT_WIDTH; + + // Out of bounds? + if (index >= OLED_MATRIX_SIZE) { + index = 0; + } + + oled_cursor = &oled_buffer[index]; +} + +void oled_advance_page(bool clearPageRemainder) { + uint16_t index = oled_cursor - &oled_buffer[0]; + uint8_t remaining = oled_rotation_width - (index % oled_rotation_width); + + if (clearPageRemainder) { + // Remaining Char count + remaining = remaining / OLED_FONT_WIDTH; + + // Write empty character until next line + while (remaining--) + oled_write_char(' ', false); + } else { + // Next page index out of bounds? + if (index + remaining >= OLED_MATRIX_SIZE) { + index = 0; + remaining = 0; + } + + oled_cursor = &oled_buffer[index + remaining]; + } +} + +void oled_advance_char(void) { + uint16_t nextIndex = oled_cursor - &oled_buffer[0] + OLED_FONT_WIDTH; + uint8_t remainingSpace = oled_rotation_width - (nextIndex % oled_rotation_width); + + // Do we have enough space on the current line for the next character + if (remainingSpace < OLED_FONT_WIDTH) { + nextIndex += remainingSpace; + } + + // Did we go out of bounds + if (nextIndex >= OLED_MATRIX_SIZE) { + nextIndex = 0; + } + + // Update cursor position + oled_cursor = &oled_buffer[nextIndex]; +} + +// Main handler that writes character data to the display buffer +void oled_write_char(const char data, bool invert) { + // Advance to the next line if newline + if (data == '\n') { + // Old source wrote ' ' until end of line... + oled_advance_page(true); + return; + } + + // copy the current render buffer to check for dirty after + static uint8_t oled_temp_buffer[OLED_FONT_WIDTH]; + memcpy(&oled_temp_buffer, oled_cursor, OLED_FONT_WIDTH); + + // set the reder buffer data + uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index + if (cast_data < OLED_FONT_START || cast_data > OLED_FONT_END) { + memset(oled_cursor, 0x00, OLED_FONT_WIDTH); + } else { + const uint8_t *glyph = &font[(cast_data - OLED_FONT_START) * OLED_FONT_WIDTH]; + memcpy_P(oled_cursor, glyph, OLED_FONT_WIDTH); + } + + // Invert if needed + if (invert) { + InvertCharacter(oled_cursor); + } + + // Dirty check + if (memcmp(&oled_temp_buffer, oled_cursor, OLED_FONT_WIDTH)) { + oled_dirty |= (1 << ((oled_cursor - &oled_buffer[0]) / OLED_BLOCK_SIZE)); + } + + // Finally move to the next char + oled_advance_char(); +} + +void oled_write(const char *data, bool invert) { + const char *end = data + strlen(data); + while (data < end) { + oled_write_char(*data, invert); + data++; + } +} + +void oled_write_ln(const char *data, bool invert) { + oled_write(data, invert); + oled_advance_page(true); +} + +#if defined(__AVR__) +void oled_write_P(const char *data, bool invert) { + uint8_t c = pgm_read_byte(data); + while (c != 0) { + oled_write_char(c, invert); + c = pgm_read_byte(++data); + } +} + +void oled_write_ln_P(const char *data, bool invert) { + oled_write_P(data, invert); + oled_advance_page(true); +} +#endif // defined(__AVR__) + +bool oled_on(void) { +#if !defined(OLED_DISABLE_TIMEOUT) + oled_last_activity = timer_read(); +#endif + + static const uint8_t PROGMEM display_on[] = { I2C_CMD, DISPLAY_ON }; + if (!oled_active) { + if (I2C_TRANSMIT_P(display_on) != I2C_STATUS_SUCCESS) { + print("oled_on cmd failed\n"); + return oled_active; + } + oled_active = true; + } + return oled_active; +} + +bool oled_off(void) { + static const uint8_t PROGMEM display_off[] = { I2C_CMD, DISPLAY_OFF }; + if (oled_active) { + if (I2C_TRANSMIT_P(display_off) != I2C_STATUS_SUCCESS) { + print("oled_off cmd failed\n"); + return oled_active; + } + oled_active = false; + } + return !oled_active; +} + +bool oled_scroll_right(void) { + // Dont enable scrolling if we need to update the display + // This prevents scrolling of bad data from starting the scroll too early after init + if (!oled_dirty && !oled_scrolling) { + static const uint8_t PROGMEM display_scroll_right[] = { + I2C_CMD, SCROLL_RIGHT, 0x00, 0x00, 0x00, 0x0F, 0x00, 0xFF, ACTIVATE_SCROLL }; + if (I2C_TRANSMIT_P(display_scroll_right) != I2C_STATUS_SUCCESS) { + print("oled_scroll_right cmd failed\n"); + return oled_scrolling; + } + oled_scrolling = true; + } + return oled_scrolling; +} + +bool oled_scroll_left(void) { + // Dont enable scrolling if we need to update the display + // This prevents scrolling of bad data from starting the scroll too early after init + if (!oled_dirty && !oled_scrolling) { + static const uint8_t PROGMEM display_scroll_left[] = { + I2C_CMD, SCROLL_LEFT, 0x00, 0x00, 0x00, 0x0F, 0x00, 0xFF, ACTIVATE_SCROLL }; + if (I2C_TRANSMIT_P(display_scroll_left) != I2C_STATUS_SUCCESS) { + print("oled_scroll_left cmd failed\n"); + return oled_scrolling; + } + oled_scrolling = true; + } + return oled_scrolling; +} + +bool oled_scroll_off(void) { + if (oled_scrolling) { + static const uint8_t PROGMEM display_scroll_off[] = { I2C_CMD, DEACTIVATE_SCROLL }; + if (I2C_TRANSMIT_P(display_scroll_off) != I2C_STATUS_SUCCESS) { + print("oled_scroll_off cmd failed\n"); + return oled_scrolling; + } + oled_scrolling = false; + } + return !oled_scrolling; +} + +uint8_t oled_max_chars(void) { + if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) { + return OLED_DISPLAY_WIDTH / OLED_FONT_WIDTH; + } + return OLED_DISPLAY_HEIGHT / OLED_FONT_WIDTH; +} + +uint8_t oled_max_lines(void) { + if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) { + return OLED_DISPLAY_HEIGHT / OLED_FONT_HEIGHT; + } + return OLED_DISPLAY_WIDTH / OLED_FONT_HEIGHT; +} + +void oled_task(void) { + if (!oled_initialized) { + return; + } + + oled_set_cursor(0, 0); + + oled_task_user(); + + // Smart render system, no need to check for dirty + oled_render(); + + // Display timeout check +#if !defined(OLED_DISABLE_TIMEOUT) + if (oled_active && timer_elapsed(oled_last_activity) > OLED_TIMEOUT) { + oled_off(); + } +#endif +} + +__attribute__((weak)) +void oled_task_user(void) { +} diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h new file mode 100644 index 0000000000..1ca31df114 --- /dev/null +++ b/drivers/oled/oled_driver.h @@ -0,0 +1,183 @@ +/* +Copyright 2019 Ryan Caltabiano + +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 . +*/ +#pragma once + +#include +#include + + +#if defined(OLED_DISPLAY_CUSTOM) + // Expected user to implement the necessary defines +#elif defined(OLED_DISPLAY_128X64) + // Double height 128x64 + #define OLED_DISPLAY_WIDTH 128 + #define OLED_DISPLAY_HEIGHT 64 + #define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 1024 (compile time mathed) + #define OLED_BLOCK_TYPE uint16_t + #define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 16 (compile time mathed) + #define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 64 (compile time mathed) + + // For 90 degree rotation, we map our internal matrix to oled matrix using fixed arrays + // The OLED writes to it's memory horizontally, starting top left, but our memory starts bottom left in this mode + #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 } + #define OLED_TARGET_MAP { 56, 48, 40, 32, 24, 16, 8, 0 } + // If OLED_BLOCK_TYPE is uint8_t, these tables would look like: + // #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 } + // #define OLED_TARGET_MAP { 56, 120, 48, 112, 40, 104, 32, 96, 24, 88, 16, 80, 8, 72, 0, 64 } +#else // defined(OLED_DISPLAY_128X64) + // Default 128x32 + #define OLED_DISPLAY_WIDTH 128 + #define OLED_DISPLAY_HEIGHT 32 + #define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 512 (compile time mathed) + #define OLED_BLOCK_TYPE uint8_t // Type to use for segmenting the oled display for smart rendering, use unsigned types only + #define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 8 (compile time mathed) + #define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 128 (compile time mathed) + + // For 90 degree rotation, we map our internal matrix to oled matrix using fixed arrays + // The OLED writes to it's memory horizontally, starting top left, but our memory starts bottom left in this mode + #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 } + #define OLED_TARGET_MAP { 48, 32, 16, 0, 56, 40, 24, 8 } +#endif // defined(OLED_DISPLAY_CUSTOM) + +// Address to use for tthe i2d oled communication +#if !defined(OLED_DISPLAY_ADDRESS) + #define OLED_DISPLAY_ADDRESS 0x3C +#endif + +// Custom font file to use +#if !defined(OLED_FONT_H) + #define OLED_FONT_H "glcdfont.c" +#endif +// unsigned char value of the first character in the font file +#if !defined(OLED_FONT_START) + #define OLED_FONT_START 0 +#endif +// unsigned char value of the last character in the font file +#if !defined(OLED_FONT_END) + #define OLED_FONT_END 224 +#endif +// Font render width +#if !defined(OLED_FONT_WIDTH) + #define OLED_FONT_WIDTH 6 +#endif +// Font render height +#if !defined(OLED_FONT_HEIGHT) + #define OLED_FONT_HEIGHT 8 +#endif + +#define OLED_ROTATION_0 0x00 +#define OLED_ROTATION_90 0x01 +#define OLED_ROTATION_180 0x02 +#define OLED_ROTATION_270 0x03 + +// Initialize the oled display, rotating the rendered output based on the define passed in. +// Returns true if the OLED was initialized successfully +bool oled_init(uint8_t rotation); + +// Called at the start of oled_init, weak function overridable by the user +// rotation - the value passed into oled_init +// Return new uint8_t if you want to override default rotation +uint8_t oled_init_user(uint8_t rotation); + +// Clears the display buffer, resets cursor position to 0, and sets the buffer to dirty for rendering +void oled_clear(void); + +// Renders the dirty chunks of the buffer to oled display +void oled_render(void); + +// Moves cursor to character position indicated by column and line, wraps if out of bounds +// Max column denoted by 'oled_max_chars()' and max lines by 'oled_max_lines()' functions +void oled_set_cursor(uint8_t col, uint8_t line); + +// Advances the cursor to the next page, writing ' ' if true +// Wraps to the begining when out of bounds +void oled_advance_page(bool clearPageRemainder); + +// Moves the cursor forward 1 character length +// Advance page if there is not enough room for the next character +// Wraps to the begining when out of bounds +void oled_advance_char(void); + +// Writes a single character to the buffer at current cursor position +// Advances the cursor while writing, inverts the pixels if true +// Main handler that writes character data to the display buffer +void oled_write_char(const char data, bool invert); + +// Writes a string to the buffer at current cursor position +// Advances the cursor while writing, inverts the pixels if true +void oled_write(const char *data, bool invert); + +// Writes a string to the buffer at current cursor position +// Advances the cursor while writing, inverts the pixels if true +// Advances the cursor to the next page, wiring ' ' to the remainder of the current page +void oled_write_ln(const char *data, bool invert); + +#if defined(__AVR__) +// Writes a PROGMEM string to the buffer at current cursor position +// Advances the cursor while writing, inverts the pixels if true +// Remapped to call 'void oled_write(const char *data, bool invert);' on ARM +void oled_write_P(const char *data, bool invert); + +// Writes a PROGMEM string to the buffer at current cursor position +// Advances the cursor while writing, inverts the pixels if true +// Advances the cursor to the next page, wiring ' ' to the remainder of the current page +// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM +void oled_write_ln_P(const char *data, bool invert); +#else + // Writes a string to the buffer at current cursor position + // Advances the cursor while writing, inverts the pixels if true + #define oled_write_P(data, invert) oled_write(data, invert) + + // Writes a string to the buffer at current cursor position + // Advances the cursor while writing, inverts the pixels if true + // Advances the cursor to the next page, wiring ' ' to the remainder of the current page + #define oled_write_ln_P(data, invert) oled_write(data, invert) +#endif // defined(__AVR__) + +// Can be used to manually turn on the screen if it is off +// Returns true if the screen was on or turns on +bool oled_on(void); + +// Can be used to manually turn off the screen if it is on +// Returns true if the screen was off or turns off +bool oled_off(void); + +// Basically it's oled_render, but with timeout management and oled_task_user calling! +void oled_task(void); + +// Called at the start of oled_task, weak function overridable by the user +void oled_task_user(void); + +// Scrolls the entire display right +// Returns true if the screen was scrolling or starts scrolling +// NOTE: display contents cannot be changed while scrolling +bool oled_scroll_right(void); + +// Scrolls the entire display left +// Returns true if the screen was scrolling or starts scrolling +// NOTE: display contents cannot be changed while scrolling +bool oled_scroll_left(void); + +// Turns off display scrolling +// Returns true if the screen was not scrolling or stops scrolling +bool oled_scroll_off(void); + +// Returns the maximum number of characters that will fit on a line +uint8_t oled_max_chars(void); + +// Returns the maximum number of lines that will fit on the oled +uint8_t oled_max_lines(void); diff --git a/keyboards/cannonkeys/satisfaction75/i2c_master.c b/keyboards/cannonkeys/satisfaction75/i2c_master.c index d81eb92d49..ce0e0a7ba1 100644 --- a/keyboards/cannonkeys/satisfaction75/i2c_master.c +++ b/keyboards/cannonkeys/satisfaction75/i2c_master.c @@ -29,8 +29,6 @@ #include "quantum.h" #include #include -#include "chtypes.h" -#include "ch.h" static uint8_t i2c_address; @@ -44,6 +42,18 @@ static const I2CConfig i2cconfig = { 0 }; +static i2c_status_t chibios_to_qmk(const msg_t* status) { + switch (*status) { + case I2C_NO_ERROR: + return I2C_STATUS_SUCCESS; + case I2C_TIMEOUT: + return I2C_STATUS_TIMEOUT; + // I2C_BUS_ERROR, I2C_ARBITRATION_LOST, I2C_ACK_FAILURE, I2C_OVERRUN, I2C_PEC_ERROR, I2C_SMB_ALERT + default: + return I2C_STATUS_ERROR; + } +} + __attribute__ ((weak)) void i2c_init(void) { @@ -59,34 +69,32 @@ void i2c_init(void) //i2cInit(); //This is invoked by halInit() so no need to redo it. } -// This is usually not needed -uint8_t i2c_start(uint8_t address) +i2c_status_t i2c_start(uint8_t address) { i2c_address = address; i2cStart(&I2C_DRIVER, &i2cconfig); - return 0; + return I2C_STATUS_SUCCESS; } -uint8_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) +i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) { - msg_t status = MSG_OK; - i2c_address = address; i2cStart(&I2C_DRIVER, &i2cconfig); i2cAcquireBus(&I2C_DRIVER); - status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, MS2ST(timeout)); + msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, MS2ST(timeout)); i2cReleaseBus(&I2C_DRIVER); - return status; + return chibios_to_qmk(&status); } -uint8_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) +i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) { i2c_address = address; i2cStart(&I2C_DRIVER, &i2cconfig); - return i2cMasterReceiveTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, MS2ST(timeout)); + msg_t status = i2cMasterReceiveTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, MS2ST(timeout)); + return chibios_to_qmk(&status); } -uint8_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout) +i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout) { i2c_address = devaddr; i2cStart(&I2C_DRIVER, &i2cconfig); @@ -98,19 +106,19 @@ uint8_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t l } complete_packet[0] = regaddr; - return i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), complete_packet, length + 1, 0, 0, MS2ST(timeout)); + msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), complete_packet, length + 1, 0, 0, MS2ST(timeout)); + return chibios_to_qmk(&status); } -uint8_t i2c_readReg(uint8_t devaddr, uint8_t* regaddr, uint8_t* data, uint16_t length, uint16_t timeout) +i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t* regaddr, uint8_t* data, uint16_t length, uint16_t timeout) { i2c_address = devaddr; i2cStart(&I2C_DRIVER, &i2cconfig); - return i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), regaddr, 1, data, length, MS2ST(timeout)); + msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), regaddr, 1, data, length, MS2ST(timeout)); + return chibios_to_qmk(&status); } -// This is usually not needed. It releases the driver to allow pins to become GPIO again. -uint8_t i2c_stop(void) +void i2c_stop(void) { i2cStop(&I2C_DRIVER); - return 0; } diff --git a/keyboards/sol/common/glcdfont.c b/keyboards/sol/common/glcdfont.c index 89665ba074..f772e31811 100644 --- a/keyboards/sol/common/glcdfont.c +++ b/keyboards/sol/common/glcdfont.c @@ -1,8 +1,4 @@ -// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. -// See gfxfont.h for newer custom bitmap font info. - -#ifndef FONT5X7_H -#define FONT5X7_H +#pragma once #ifdef __AVR__ #include @@ -13,7 +9,8 @@ #define PROGMEM #endif -// Standard ASCII 5x7 font +// Helidox 8x6 font with RGBKB SOL Logo +// Online editor: http://teripom.x0.com/ static const unsigned char font[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -144,27 +141,27 @@ static const unsigned char font[] PROGMEM = { 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, 0x02, 0x01, 0x02, 0x04, 0x02, 0x00, 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, - 0x03, 0x07, 0x1F, 0x7F, 0xFF, 0xFF, - 0xFE, 0xF8, 0xF0, 0xC0, 0x20, 0xF8, - 0xFE, 0xFF, 0xFE, 0x79, 0x27, 0x1F, - 0x7F, 0xFF, 0xFF, 0xFE, 0xF8, 0xF0, - 0xC0, 0x20, 0xF8, 0xFE, 0xFF, 0xFF, - 0x7F, 0x3F, 0x3F, 0x7F, 0xFF, 0xFE, - 0xF8, 0xF0, 0xC0, 0x00, 0x00, 0x00, - 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xFF, 0x7F, 0x7F, 0x7F, - 0xBF, 0xBF, 0xC0, 0xC0, 0xC0, 0xE0, - 0xE0, 0xE0, 0xE0, 0xF0, 0xF0, 0xF0, - 0xF8, 0x78, 0x78, 0x7C, 0x3C, 0x3C, - 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, - 0xBF, 0xBF, 0xDF, 0xDF, 0xEF, 0xEF, - 0x00, 0x03, 0x07, 0x1F, 0x7F, 0xFF, - 0xFF, 0xFF, 0xFE, 0xF8, 0xE0, 0xC0, - 0xE0, 0xF8, 0xFE, 0xFF, 0xFF, 0xFF, - 0x7F, 0x1F, 0x07, 0x03, 0x00, 0x00, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x0C, 0x90, + 0xB0, 0xE0, 0x72, 0x31, 0x9B, 0xDE, + 0xCE, 0xEC, 0xEE, 0xE9, 0xE9, 0xEC, + 0xCF, 0xDA, 0x99, 0x3E, 0x62, 0xE4, + 0xC4, 0x70, 0x10, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, + 0xC0, 0xC0, 0x80, 0x80, 0x02, 0x85, + 0x85, 0x87, 0x85, 0x89, 0x89, 0x92, + 0xEA, 0xC6, 0xC4, 0x48, 0x50, 0x60, + 0x40, 0x40, 0x40, 0x40, 0xC0, 0xE0, + 0x50, 0x28, 0x10, 0x10, 0x60, 0xC0, + 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, + 0x80, 0x80, 0x80, 0xE0, 0xF8, 0xFC, + 0xF8, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, 0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, 0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, @@ -173,30 +170,30 @@ static const unsigned char font[] PROGMEM = { 0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, 0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE, 0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xC1, 0xF3, - 0xCF, 0xBF, 0x7F, 0xFF, 0xFF, 0xFC, - 0xFB, 0xE7, 0x81, 0x00, 0x00, 0x00, - 0x00, 0x80, 0xE3, 0xCF, 0x3F, 0xFF, - 0xFF, 0xFF, 0xFC, 0xFB, 0xE7, 0x81, - 0x00, 0x00, 0x00, 0x00, 0x81, 0xE7, - 0xFF, 0xFF, 0xFF, 0xFF, 0x3C, 0x00, - 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xF8, 0xF8, 0xFC, 0x7C, 0x7E, - 0x7E, 0x3E, 0xFE, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xF7, 0xF7, 0xF7, 0xFB, - 0xFB, 0x7D, 0x7D, 0x7D, 0xBE, 0xBE, - 0xBE, 0xDF, 0xDF, 0xE0, 0xE0, 0x00, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x00, 0xFC, 0xFC, 0x7C, 0x7E, 0x7E, - 0x3E, 0x3E, 0x1F, 0x1F, 0x1F, 0x0F, + 0x00, 0x00, 0x00, 0xE0, 0xEC, 0xDF, + 0xFC, 0xE0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7F, 0x80, 0x80, + 0x80, 0x70, 0x0F, 0x00, 0x00, 0x80, + 0x7F, 0x00, 0x00, 0x7F, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x7F, + 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0xFF, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x21, 0x33, 0x3B, 0x7B, + 0xFF, 0x00, 0x7C, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, - 0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0x81, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF, 0x7C, 0x01, + 0xFF, 0xDE, 0x8C, 0x04, 0x0C, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x01, 0x01, 0x7F, 0x80, + 0x80, 0xBE, 0xBE, 0x80, 0x80, 0x80, + 0xC1, 0xFF, 0x80, 0x04, 0x32, 0x5E, + 0x1C, 0x3D, 0x26, 0x10, 0xC1, 0xFF, + 0x3E, 0x00, 0x00, 0x08, 0x36, 0xC1, + 0x08, 0x08, 0x14, 0x77, 0x94, 0x94, + 0x94, 0xF7, 0x94, 0xF7, 0x9C, 0x9C, + 0xFF, 0xFF, 0x1E, 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, 0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, @@ -205,30 +202,31 @@ static const unsigned char font[] PROGMEM = { 0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, 0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F, 0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00, + 0x40, 0x7C, 0x3F, 0x3F, 0x23, 0x01, + 0x23, 0x3F, 0x37, 0x6C, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x06, 0x02, 0x06, + 0x4D, 0x4F, 0x8C, 0xF9, 0x73, 0x37, + 0x27, 0x2F, 0x2F, 0xAF, 0xEF, 0x6F, + 0x77, 0x17, 0x33, 0x79, 0xCC, 0x1F, + 0x31, 0x20, 0x21, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0xE0, + 0xA0, 0xA0, 0xD0, 0x90, 0x48, 0x48, + 0x25, 0x2B, 0x11, 0x09, 0x05, 0x03, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x03, 0x02, 0x04, 0x03, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x03, 0x0F, 0x1F, + 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x60, 0x70, 0x7C, 0x7F, 0x7F, 0x7F, - 0x7F, 0x1F, 0x06, 0x01, 0x03, 0x0F, - 0x3F, 0x7F, 0x7F, 0x7E, 0x7C, 0x7C, - 0x7E, 0x7F, 0x7F, 0x7F, 0x1F, 0x06, - 0x01, 0x07, 0x0F, 0x3F, 0x7F, 0x7F, - 0x7E, 0x7C, 0x7C, 0x7E, 0x7F, 0x7F, - 0x3F, 0x0F, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, - 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x7F, - 0x7F, 0x7F, 0x7D, 0x7D, 0x3D, 0x3E, - 0x1E, 0x1F, 0x1F, 0x1F, 0x0F, 0x0F, - 0x07, 0x07, 0x07, 0x03, 0x03, 0x00, - 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, - 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, - 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x00, - 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, - 0x00, 0x40, 0x70, 0x78, 0x7E, 0x7F, - 0x7F, 0x7F, 0x3F, 0x0F, 0x03, 0x01, - 0x03, 0x0F, 0x3F, 0x7F, 0x7F, 0x7F, - 0x7E, 0x78, 0x70, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -239,6 +237,4 @@ static const unsigned char font[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -#endif // FONT5X7_H diff --git a/keyboards/sol/common/ssd1306.c b/keyboards/sol/common/ssd1306.c deleted file mode 100644 index b3e55a67c2..0000000000 --- a/keyboards/sol/common/ssd1306.c +++ /dev/null @@ -1,329 +0,0 @@ -#ifdef SSD1306OLED - -#include "ssd1306.h" -#include "i2c.h" -#include -#include "print.h" -#ifndef LOCAL_GLCDFONT -#include "common/glcdfont.c" -#else -#include -#endif -#ifdef ADAFRUIT_BLE_ENABLE -#include "adafruit_ble.h" -#endif -#ifdef PROTOCOL_LUFA -#include "lufa.h" -#endif -#include "sendchar.h" -#include "timer.h" - -// Set this to 1 to help diagnose early startup problems -// when testing power-on with ble. Turn it off otherwise, -// as the latency of printing most of the debug info messes -// with the matrix scan, causing keys to drop. -#define DEBUG_TO_SCREEN 0 - -//static uint16_t last_battery_update; -//static uint32_t vbat; -//#define BatteryUpdateInterval 10000 /* milliseconds */ -#define ScreenOffInterval 300000 /* milliseconds */ -#if DEBUG_TO_SCREEN -static uint8_t displaying; -#endif -static uint16_t last_flush; - -// Write command sequence. -// Returns true on success. -static inline bool _send_cmd1(uint8_t cmd) { - bool res = false; - - if (i2c_start_write(SSD1306_ADDRESS)) { - xprintf("failed to start write to %d\n", SSD1306_ADDRESS); - goto done; - } - - if (i2c_master_write(0x0 /* command byte follows */)) { - print("failed to write control byte\n"); - - goto done; - } - - if (i2c_master_write(cmd)) { - xprintf("failed to write command %d\n", cmd); - goto done; - } - res = true; -done: - i2c_master_stop(); - return res; -} - -// Write 2-byte command sequence. -// Returns true on success -static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) { - if (!_send_cmd1(cmd)) { - return false; - } - return _send_cmd1(opr); -} - -// Write 3-byte command sequence. -// Returns true on success -static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) { - if (!_send_cmd1(cmd)) { - return false; - } - if (!_send_cmd1(opr1)) { - return false; - } - return _send_cmd1(opr2); -} - -#define send_cmd1(c) if (!_send_cmd1(c)) {goto done;} -#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} -#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} - -static void clear_display(void) { - matrix_clear(&display); - - // Clear all of the display bits (there can be random noise - // in the RAM on startup) - send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); - send_cmd3(ColumnAddr, 0, DisplayWidth - 1); - - if (i2c_start_write(SSD1306_ADDRESS)) { - goto done; - } - if (i2c_master_write(0x40)) { - // Data mode - goto done; - } - for (uint8_t row = 0; row < MatrixRows; ++row) { - for (uint8_t col = 0; col < DisplayWidth; ++col) { - i2c_master_write(0); - } - } - - display.dirty = false; - -done: - i2c_master_stop(); -} - -#if DEBUG_TO_SCREEN -#undef sendchar -static int8_t capture_sendchar(uint8_t c) { - sendchar(c); - iota_gfx_write_char(c); - - if (!displaying) { - iota_gfx_flush(); - } - return 0; -} -#endif - -bool iota_gfx_init(bool rotate) { - bool success = false; - - i2c_master_init(); - send_cmd1(DisplayOff); - send_cmd2(SetDisplayClockDiv, 0x80); - send_cmd2(SetMultiPlex, DisplayHeight - 1); - - send_cmd2(SetDisplayOffset, 0); - - - send_cmd1(SetStartLine | 0x0); - send_cmd2(SetChargePump, 0x14 /* Enable */); - send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); - - if(rotate){ - // the following Flip the display orientation 180 degrees - send_cmd1(SegRemap); - send_cmd1(ComScanInc); - }else{ - // Flips the display orientation 0 degrees - send_cmd1(SegRemap | 0x1); - send_cmd1(ComScanDec); - } - - send_cmd2(SetComPins, 0x2); - send_cmd2(SetContrast, 0x8f); - send_cmd2(SetPreCharge, 0xf1); - send_cmd2(SetVComDetect, 0x40); - send_cmd1(DisplayAllOnResume); - send_cmd1(NormalDisplay); - send_cmd1(DeActivateScroll); - send_cmd1(DisplayOn); - - send_cmd2(SetContrast, 0); // Dim - - clear_display(); - - success = true; - - iota_gfx_flush(); - -#if DEBUG_TO_SCREEN - print_set_sendchar(capture_sendchar); -#endif - -done: - return success; -} - -bool iota_gfx_off(void) { - bool success = false; - - send_cmd1(DisplayOff); - success = true; - -done: - return success; -} - -bool iota_gfx_on(void) { - bool success = false; - - send_cmd1(DisplayOn); - success = true; - -done: - return success; -} - -void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { - *matrix->cursor = c; - ++matrix->cursor; - - if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) { - // We went off the end; scroll the display upwards by one line - memmove(&matrix->display[0], &matrix->display[1], - MatrixCols * (MatrixRows - 1)); - matrix->cursor = &matrix->display[MatrixRows - 1][0]; - memset(matrix->cursor, ' ', MatrixCols); - } -} - -void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { - matrix->dirty = true; - - if (c == '\n') { - // Clear to end of line from the cursor and then move to the - // start of the next line - uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols; - - while (cursor_col++ < MatrixCols) { - matrix_write_char_inner(matrix, ' '); - } - return; - } - - matrix_write_char_inner(matrix, c); -} - -void iota_gfx_write_char(uint8_t c) { - matrix_write_char(&display, c); -} - -void matrix_write(struct CharacterMatrix *matrix, const char *data) { - const char *end = data + strlen(data); - while (data < end) { - matrix_write_char(matrix, *data); - ++data; - } -} - -void iota_gfx_write(const char *data) { - matrix_write(&display, data); -} - -void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { - while (true) { - uint8_t c = pgm_read_byte(data); - if (c == 0) { - return; - } - matrix_write_char(matrix, c); - ++data; - } -} - -void iota_gfx_write_P(const char *data) { - matrix_write_P(&display, data); -} - -void matrix_clear(struct CharacterMatrix *matrix) { - memset(matrix->display, ' ', sizeof(matrix->display)); - matrix->cursor = &matrix->display[0][0]; - matrix->dirty = true; -} - -void iota_gfx_clear_screen(void) { - matrix_clear(&display); -} - -void matrix_render(struct CharacterMatrix *matrix) { - last_flush = timer_read(); - iota_gfx_on(); -#if DEBUG_TO_SCREEN - ++displaying; -#endif - - // Move to the home position - send_cmd3(PageAddr, 0, MatrixRows - 1); - send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); - - if (i2c_start_write(SSD1306_ADDRESS)) { - goto done; - } - if (i2c_master_write(0x40)) { - // Data mode - goto done; - } - - for (uint8_t row = 0; row < MatrixRows; ++row) { - for (uint8_t col = 0; col < MatrixCols; ++col) { - const uint8_t *glyph = font + (matrix->display[row][col] * FontWidth); - - for (uint8_t glyphCol = 0; glyphCol < FontWidth; ++glyphCol) { - uint8_t colBits = pgm_read_byte(glyph + glyphCol); - i2c_master_write(colBits); - } - - // 1 column of space between chars (it's not included in the glyph) - //i2c_master_write(0); - } - } - - matrix->dirty = false; - -done: - i2c_master_stop(); -#if DEBUG_TO_SCREEN - --displaying; -#endif -} - -void iota_gfx_flush(void) { - matrix_render(&display); -} - -__attribute__ ((weak)) -void iota_gfx_task_user(void) { -} - -void iota_gfx_task(void) { - iota_gfx_task_user(); - - if (display.dirty) { - iota_gfx_flush(); - } - - if (timer_elapsed(last_flush) > ScreenOffInterval) { - iota_gfx_off(); - } -} -#endif diff --git a/keyboards/sol/common/ssd1306.h b/keyboards/sol/common/ssd1306.h deleted file mode 100644 index 77ce7c211a..0000000000 --- a/keyboards/sol/common/ssd1306.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef SSD1306_H -#define SSD1306_H - -#include -#include -#include "pincontrol.h" - -enum ssd1306_cmds { - DisplayOff = 0xAE, - DisplayOn = 0xAF, - - SetContrast = 0x81, - DisplayAllOnResume = 0xA4, - - DisplayAllOn = 0xA5, - NormalDisplay = 0xA6, - InvertDisplay = 0xA7, - SetDisplayOffset = 0xD3, - SetComPins = 0xda, - SetVComDetect = 0xdb, - SetDisplayClockDiv = 0xD5, - SetPreCharge = 0xd9, - SetMultiPlex = 0xa8, - SetLowColumn = 0x00, - SetHighColumn = 0x10, - SetStartLine = 0x40, - - SetMemoryMode = 0x20, - ColumnAddr = 0x21, - PageAddr = 0x22, - - ComScanInc = 0xc0, - ComScanDec = 0xc8, - SegRemap = 0xa0, - SetChargePump = 0x8d, - ExternalVcc = 0x01, - SwitchCapVcc = 0x02, - - ActivateScroll = 0x2f, - DeActivateScroll = 0x2e, - SetVerticalScrollArea = 0xa3, - RightHorizontalScroll = 0x26, - LeftHorizontalScroll = 0x27, - VerticalAndRightHorizontalScroll = 0x29, - VerticalAndLeftHorizontalScroll = 0x2a, -}; - -// Controls the SSD1306 128x32 OLED display via i2c - -#ifndef SSD1306_ADDRESS -#define SSD1306_ADDRESS 0x3C -#endif - -#define DisplayHeight 32 -#define DisplayWidth 128 - -#define FontHeight 8 -#define FontWidth 6 - -#define MatrixRows (DisplayHeight / FontHeight) -#define MatrixCols (DisplayWidth / FontWidth) - -struct CharacterMatrix { - uint8_t display[MatrixRows][MatrixCols]; - uint8_t *cursor; - bool dirty; -}; - -struct CharacterMatrix display; - -bool iota_gfx_init(bool rotate); -void iota_gfx_task(void); -bool iota_gfx_off(void); -bool iota_gfx_on(void); -void iota_gfx_flush(void); -void iota_gfx_write_char(uint8_t c); -void iota_gfx_write(const char *data); -void iota_gfx_write_P(const char *data); -void iota_gfx_clear_screen(void); - -void iota_gfx_task_user(void); - -void matrix_clear(struct CharacterMatrix *matrix); -void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c); -void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c); -void matrix_write(struct CharacterMatrix *matrix, const char *data); -void matrix_write_P(struct CharacterMatrix *matrix, const char *data); -void matrix_render(struct CharacterMatrix *matrix); - - - -#endif diff --git a/keyboards/sol/i2c.c b/keyboards/sol/i2c.c deleted file mode 100644 index 4bee5c6398..0000000000 --- a/keyboards/sol/i2c.c +++ /dev/null @@ -1,162 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "i2c.h" - -#ifdef USE_I2C - -// Limits the amount of we wait for any one i2c transaction. -// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is -// 9 bits, a single transaction will take around 90μs to complete. -// -// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit -// poll loop takes at least 8 clock cycles to execute -#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 - -#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) - -volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; - -static volatile uint8_t slave_buffer_pos; -static volatile bool slave_has_register_set = false; - -// Wait for an i2c operation to finish -inline static -void i2c_delay(void) { - uint16_t lim = 0; - while(!(TWCR & (1<10. - // Check datasheets for more info. - TWBR = ((F_CPU/SCL_CLOCK)-16)/2; -} - -// Start a transaction with the given i2c slave address. The direction of the -// transfer is set with I2C_READ and I2C_WRITE. -// returns: 0 => success -// 1 => error -uint8_t i2c_master_start(uint8_t address) { - TWCR = (1< slave ACK -// 1 => slave NACK -uint8_t i2c_master_write(uint8_t data) { - TWDR = data; - TWCR = (1<= SLAVE_BUFFER_SIZE ) { - ack = 0; - slave_buffer_pos = 0; - } - slave_has_register_set = true; - } else { - i2c_slave_buffer[slave_buffer_pos] = TWDR; - BUFFER_POS_INC(); - } - break; - - case TW_ST_SLA_ACK: - case TW_ST_DATA_ACK: - // master has addressed this device as a slave transmitter and is - // requesting data. - TWDR = i2c_slave_buffer[slave_buffer_pos]; - BUFFER_POS_INC(); - break; - - case TW_BUS_ERROR: // something went wrong, reset twi state - TWCR = 0; - default: - break; - } - // Reset everything, so we are ready for the next TWI interrupt - TWCR |= (1< - -#ifndef F_CPU -#define F_CPU 16000000UL -#endif - -#define I2C_READ 1 -#define I2C_WRITE 0 - -#define I2C_ACK 1 -#define I2C_NACK 0 - -#define SLAVE_BUFFER_SIZE 0x10 - -// i2c SCL clock frequency 400kHz -#define SCL_CLOCK 400000L - -extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; - -void i2c_master_init(void); -uint8_t i2c_master_start(uint8_t address); -void i2c_master_stop(void); -uint8_t i2c_master_write(uint8_t data); -uint8_t i2c_master_read(int); -void i2c_reset_state(void); -void i2c_slave_init(uint8_t address); - - -static inline unsigned char i2c_start_read(unsigned char addr) { - return i2c_master_start((addr << 1) | I2C_READ); -} - -static inline unsigned char i2c_start_write(unsigned char addr) { - return i2c_master_start((addr << 1) | I2C_WRITE); -} - -// from SSD1306 scrips -extern unsigned char i2c_rep_start(unsigned char addr); -extern void i2c_start_wait(unsigned char addr); -extern unsigned char i2c_readAck(void); -extern unsigned char i2c_readNak(void); -extern unsigned char i2c_read(unsigned char ack); - -#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); - -#endif diff --git a/keyboards/sol/keymaps/brianweyer/config.h b/keyboards/sol/keymaps/brianweyer/config.h index 87b7dd2ac0..452cdda823 100755 --- a/keyboards/sol/keymaps/brianweyer/config.h +++ b/keyboards/sol/keymaps/brianweyer/config.h @@ -20,8 +20,6 @@ along with this program. If not, see . #pragma once -#define SSD1306OLED - // place overrides here diff --git a/keyboards/sol/keymaps/brianweyer/keymap.c b/keyboards/sol/keymaps/brianweyer/keymap.c index 2259e246d2..9fd6ad6153 100755 --- a/keyboards/sol/keymaps/brianweyer/keymap.c +++ b/keyboards/sol/keymaps/brianweyer/keymap.c @@ -3,9 +3,6 @@ #include "lufa.h" #include "split_util.h" #endif -#ifdef SSD1306OLED - #include "common/ssd1306.h" -#endif extern keymap_config_t keymap_config; @@ -175,38 +172,28 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } void matrix_init_user(void) { - #ifdef RGBLIGHT_ENABLE - RGB_current_mode = rgblight_config.mode; - #endif - //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h - #ifdef SSD1306OLED - iota_gfx_init(!has_usb()); // turns on the display - #endif +#ifdef RGBLIGHT_ENABLE + RGB_current_mode = rgblight_config.mode; +#endif } -void matrix_scan_user(void) { - #ifdef SSD1306OLED - // led_test_init(); - iota_gfx_task(); // this is what updates the display continuously - #endif -} +// OLED Driver Logic +#ifdef OLED_DRIVER_ENABLE -//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h -#ifdef SSD1306OLED +uint8_t oled_init_user(uint8_t rotation) { + if (!has_usb()) + return OLED_ROTATION_180; // flip 180 for offhand + return rotation; +} -// hook point for 'led_test' keymap -// 'default' keymap's led_test_init() is empty function, do nothing -// 'led_test' keymap's led_test_init() force rgblight_mode_noeeprom(35); -__attribute__ ((weak)) -void led_test_init(void) {} +static void render_logo(void) { + static const char PROGMEM sol_logo[] = { + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, + 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, + 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0}; -void matrix_update(struct CharacterMatrix *dest, - const struct CharacterMatrix *source) { - if (memcmp(dest->display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } + oled_write_P(sol_logo, false); } //assign the right code to your layers for OLED display @@ -215,77 +202,52 @@ void matrix_update(struct CharacterMatrix *dest, #define L_ADJ (1<<_ADJ) #define L_ADJ_TRI (L_ADJ|L_FN) -static void render_logo(struct CharacterMatrix *matrix) { - - static char logo[]={ - 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, - 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, - 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4, - 0}; - matrix_write(matrix, logo); -} - - - -void render_status(struct CharacterMatrix *matrix) { - +static void render_status(void) { // Render to mode icon - static char logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}}; - if(keymap_config.swap_lalt_lgui==false){ - matrix_write(matrix, logo[0][0]); - matrix_write_P(matrix, PSTR("\n")); - matrix_write(matrix, logo[0][1]); - }else{ - matrix_write(matrix, logo[1][0]); - matrix_write_P(matrix, PSTR("\n")); - matrix_write(matrix, logo[1][1]); + static const char PROGMEM mode_logo[4][4] = { + {0x95,0x96,0x0a,0}, + {0xb5,0xb6,0x0a,0}, + {0x97,0x98,0x0a,0}, + {0xb7,0xb8,0x0a,0} }; + + if (keymap_config.swap_lalt_lgui != false) { + oled_write_P(mode_logo[0], false); + oled_write_P(mode_logo[1], false); + } else { + oled_write_P(mode_logo[2], false); + oled_write_P(mode_logo[3], false); } // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below - char buf[40]; - snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); - matrix_write_P(matrix, PSTR("\nLayer: ")); - switch (layer_state) { - case L_BASE: - matrix_write_P(matrix, PSTR("Laser")); - break; - case L_FN: - matrix_write_P(matrix, PSTR("Function")); - break; - case L_ADJ: - case L_ADJ_TRI: - matrix_write_P(matrix, PSTR("Adjustment")); - break; - default: - matrix_write(matrix, buf); - } + + oled_write_P(PSTR("Layer: "), false); + switch (layer_state) { + case L_BASE: + oled_write_P(PSTR("Laser \n"), false); + break; + case L_FN: + oled_write_P(PSTR("Function \n"), false); + break; + case L_ADJ: + case L_ADJ_TRI: + oled_write_P(PSTR("Adjustment\n"), false); + break; + default: + oled_write_P(PSTR("Undefined \n"), false); + } // Host Keyboard LED Status - char led[40]; - snprintf(led, sizeof(led), "\n%s %s %s", - (host_keyboard_leds() & (1<display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } +static void render_logo(void) { + static const char PROGMEM sol_logo[] = { + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, + 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, + 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0}; + + oled_write_P(sol_logo, false); } //assign the right code to your layers for OLED display #define L_BASE 0 #define L_FN (1<<_FN) #define L_ADJ (1<<_ADJ) +#define L_ADJ_TRI (L_ADJ|L_FN) -static void render_logo(struct CharacterMatrix *matrix) { - - static char logo[]={ - 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, - 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, - 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4, - 0}; - matrix_write(matrix, logo); - //matrix_write_P(&matrix, PSTR(" Split keyboard kit")); -} - - - -void render_status(struct CharacterMatrix *matrix) { - +static void render_status(void) { // Render to mode icon - static char logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}}; - if(keymap_config.swap_lalt_lgui==false){ - matrix_write(matrix, logo[0][0]); - matrix_write_P(matrix, PSTR("\n")); - matrix_write(matrix, logo[0][1]); - }else{ - matrix_write(matrix, logo[1][0]); - matrix_write_P(matrix, PSTR("\n")); - matrix_write(matrix, logo[1][1]); + static const char PROGMEM mode_logo[4][4] = { + {0x95,0x96,0x0a,0}, + {0xb5,0xb6,0x0a,0}, + {0x97,0x98,0x0a,0}, + {0xb7,0xb8,0x0a,0} }; + + if (keymap_config.swap_lalt_lgui != false) { + oled_write_P(mode_logo[0], false); + oled_write_P(mode_logo[1], false); + } else { + oled_write_P(mode_logo[2], false); + oled_write_P(mode_logo[3], false); } // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below - char buf[40]; - snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); - matrix_write_P(matrix, PSTR("\nLayer: ")); - switch (layer_state) { - case L_BASE: - matrix_write_P(matrix, PSTR("Default")); - break; - case L_FN: - matrix_write_P(matrix, PSTR("FN")); - break; - case L_ADJ: - case L_ADJ_TRI: - matrix_write_P(matrix, PSTR("ADJ")); - break; - default: - matrix_write(matrix, buf); - } + oled_write_P(PSTR("Layer: "), false); + switch (layer_state) { + case L_BASE: + oled_write_P(PSTR("Default\n"), false); + break; + case L_FN: + oled_write_P(PSTR("FN \n"), false); + break; + case L_ADJ: + case L_ADJ_TRI: + oled_write_P(PSTR("ADJ \n"), false); + break; + default: + oled_write_P(PSTR("UNDEF \n"), false); + } // Host Keyboard LED Status - char led[40]; - snprintf(led, sizeof(led), "\n%s %s %s", - (host_keyboard_leds() & (1<display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } +static void render_logo(void) { + static const char PROGMEM sol_logo[] = { + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, + 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, + 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0}; + + oled_write_P(sol_logo, false); } //assign the right code to your layers for OLED display #define L_BASE 0 #define L_FN (1<<_FN) #define L_ADJ (1<<_ADJ) +#define L_ADJ_TRI (L_ADJ|L_FN) -static void render_logo(struct CharacterMatrix *matrix) { - - static char logo[]={ - 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, - 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, - 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4, - 0}; - matrix_write(matrix, logo); - //matrix_write_P(&matrix, PSTR(" Split keyboard kit")); -} - - - -void render_status(struct CharacterMatrix *matrix) { - +static void render_status(void) { // Render to mode icon - static char logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}}; - if(keymap_config.swap_lalt_lgui==false){ - matrix_write(matrix, logo[0][0]); - matrix_write_P(matrix, PSTR("\n")); - matrix_write(matrix, logo[0][1]); - }else{ - matrix_write(matrix, logo[1][0]); - matrix_write_P(matrix, PSTR("\n")); - matrix_write(matrix, logo[1][1]); + static const char PROGMEM mode_logo[4][4] = { + {0x95,0x96,0x0a,0}, + {0xb5,0xb6,0x0a,0}, + {0x97,0x98,0x0a,0}, + {0xb7,0xb8,0x0a,0} }; + + if (keymap_config.swap_lalt_lgui != false) { + oled_write_P(mode_logo[0], false); + oled_write_P(mode_logo[1], false); + } else { + oled_write_P(mode_logo[2], false); + oled_write_P(mode_logo[3], false); } // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below - char buf[40]; - snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); - matrix_write_P(matrix, PSTR("\nLayer: ")); - switch (layer_state) { - case L_BASE: - matrix_write_P(matrix, PSTR("Default")); - break; - case L_FN: - matrix_write_P(matrix, PSTR("FN")); - break; - case L_ADJ: - case L_ADJ_TRI: - matrix_write_P(matrix, PSTR("ADJ")); - break; - default: - matrix_write(matrix, buf); - } + oled_write_P(PSTR("Layer: "), false); + switch (layer_state) { + case L_BASE: + oled_write_P(PSTR("Default\n"), false); + break; + case L_FN: + oled_write_P(PSTR("FN \n"), false); + break; + case L_ADJ: + case L_ADJ_TRI: + oled_write_P(PSTR("ADJ \n"), false); + break; + default: + oled_write_P(PSTR("UNDEF \n"), false); + } // Host Keyboard LED Status - char led[40]; - snprintf(led, sizeof(led), "\n%s %s %s", - (host_keyboard_leds() & (1<. // #define MASTER_RIGHT // #define EE_HANDS -// Helix keyboard OLED support -// see ./rules.mk: OLED_ENABLE=yes or no -#ifdef OLED_ENABLE - #define SSD1306OLED -#endif - /* Select rows configuration */ // Rows are 4 or 5 // #define HELIX_ROWS 5 see ./rules.mk diff --git a/keyboards/sol/rev1/rev1.c b/keyboards/sol/rev1/rev1.c index 9d869a4af4..049b5c2186 100644 --- a/keyboards/sol/rev1/rev1.c +++ b/keyboards/sol/rev1/rev1.c @@ -1,12 +1,5 @@ #include "sol.h" -#ifdef SSD1306OLED -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - //led_set_user(usb_led); -} -#endif - #ifdef RGB_MATRIX_ENABLE const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { // Left Hand Mapped Left to Right diff --git a/keyboards/sol/rev1/split_util.h b/keyboards/sol/rev1/split_util.h index 59b3624152..4421638969 100644 --- a/keyboards/sol/rev1/split_util.h +++ b/keyboards/sol/rev1/split_util.h @@ -12,6 +12,4 @@ void matrix_slave_scan(void); void split_keyboard_setup(void); bool has_usb(void); -void matrix_master_OLED_init (void); - #endif diff --git a/keyboards/sol/rules.mk b/keyboards/sol/rules.mk index aa18721b6c..bafdd9c52d 100644 --- a/keyboards/sol/rules.mk +++ b/keyboards/sol/rules.mk @@ -1,6 +1,4 @@ -SRC += i2c.c \ - serial.c \ - common/ssd1306.c +SRC += serial.c # MCU name #MCU = at90usb1287 @@ -47,6 +45,9 @@ BOOTLOADER = qmk-dfu # Interrupt driven control endpoint task(+60) OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT +# Custom local font file +OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\" + # Build Options # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically diff --git a/quantum/quantum.c b/quantum/quantum.c index a64878c729..9aa498dadb 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -275,6 +275,12 @@ bool process_record_quantum(keyrecord_t *record) { preprocess_tap_dance(keycode, record); #endif + #if defined(OLED_DRIVER_ENABLE) && !defined(OLED_DISABLE_TIMEOUT) + // Wake up oled if user is using those fabulous keys! + if (record->event.pressed) + oled_on(); + #endif + if (!( #if defined(KEY_LOCK_ENABLE) // Must run first to be able to mask key_up events. @@ -1087,6 +1093,9 @@ void matrix_init_quantum() { #ifdef OUTPUT_AUTO_ENABLE set_output(OUTPUT_AUTO); #endif + #ifdef OLED_DRIVER_ENABLE + oled_init(OLED_ROTATION_0); + #endif matrix_init_kb(); } @@ -1123,6 +1132,10 @@ void matrix_scan_quantum() { haptic_task(); #endif + #ifdef OLED_DRIVER_ENABLE + oled_task(); + #endif + matrix_scan_kb(); } #if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_PIN) diff --git a/quantum/quantum.h b/quantum/quantum.h index e2f467125e..987516dedb 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -139,6 +139,10 @@ extern uint32_t default_layer_state; #include "haptic.h" #endif +#ifdef OLED_DRIVER_ENABLE + #include "oled_driver.h" +#endif + //Function substitutions to ease GPIO manipulation #ifdef __AVR__ #define PIN_ADDRESS(p, offset) _SFR_IO8(ADDRESS_BASE + (p >> PORT_SHIFTER) + offset) From dd3a813f871b911012da55a499955307c309a7a5 Mon Sep 17 00:00:00 2001 From: Ryan Caltabiano Date: Tue, 16 Apr 2019 18:36:55 -0500 Subject: [PATCH 31/61] Reducing size of data send in one frame & update Zen rev2 oled usage --- docs/feature_oled_driver.md | 42 ++++++++++++++------ drivers/oled/oled_driver.c | 7 +++- drivers/oled/oled_driver.h | 43 +++++++++++++-------- keyboards/sol/keymaps/brianweyer/keymap.c | 2 +- keyboards/sol/keymaps/danielhklein/keymap.c | 2 +- keyboards/sol/keymaps/default/keymap.c | 2 +- keyboards/zen/rev2/config.h | 13 ------- keyboards/zen/rev2/rev2.c | 8 ++-- keyboards/zen/rev2/rules.mk | 7 +--- 9 files changed, 69 insertions(+), 57 deletions(-) diff --git a/docs/feature_oled_driver.md b/docs/feature_oled_driver.md index f261bbef18..7011f14571 100644 --- a/docs/feature_oled_driver.md +++ b/docs/feature_oled_driver.md @@ -56,7 +56,7 @@ In split keyboards, it is very common to have two OLED displays that each render ```C++ #ifdef OLED_DRIVER_ENABLE -uint8_t oled_init_user(uint8_t rotation) { +oled_rotation_t oled_init_user(oled_rotation_t rotation) { if (!is_keyboard_master()) return OLED_ROTATION_180; // flips the display 180 degrees if offhand return rotation; @@ -99,18 +99,28 @@ void oled_task_user(void) { |`OLED_DISPLAY_WIDTH` |`128` |The width of the OLED display. | |`OLED_DISPLAY_HEIGHT` |`32` |The height of the OLED display. | |`OLED_MATRIX_SIZE` |`512` |The local buffer size to allocate.
`(OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH)`| -|`OLED_BLOCK_TYPE` |`uint8_t` |The unsigned integer type to use for dirty rendering.| -|`OLED_BLOCK_COUNT` |`8` |The number of blocks the display is divided into for dirty rendering.
`(sizeof(OLED_BLOCK_TYPE) * 8)`| -|`OLED_BLOCK_SIZE` |`64` |The size of each block for dirty rendering
`(OLED_MATRIX_SIZE / OLED_BLOCK_COUNT)`| +|`OLED_BLOCK_TYPE` |`uint16_t` |The unsigned integer type to use for dirty rendering.| +|`OLED_BLOCK_COUNT` |`16` |The number of blocks the display is divided into for dirty rendering.
`(sizeof(OLED_BLOCK_TYPE) * 8)`| +|`OLED_BLOCK_SIZE` |`32` |The size of each block for dirty rendering
`(OLED_MATRIX_SIZE / OLED_BLOCK_COUNT)`| |`OLED_SOURCE_MAP` |`{ 0, ... N }` |Precalculated source array to use for mapping source buffer to target OLED memory in 90 degree rendering. | -|`OLED_TARGET_MAP` |`{ 48, ... N }`|Precalculated target array to use for mapping source buffer to target OLED memory in 90 degree rendering. | +|`OLED_TARGET_MAP` |`{ 24, ... N }`|Precalculated target array to use for mapping source buffer to target OLED memory in 90 degree rendering. | ### 90 Degree Rotation - Technical Mumbo Jumbo +```C +// OLED Rotation enum values are flags +typedef enum { + OLED_ROTATION_0 = 0, + OLED_ROTATION_90 = 1, + OLED_ROTATION_180 = 2, + OLED_ROTATION_270 = 3, // OLED_ROTATION_90 | OLED_ROTATION_180 +} oled_rotation_t; +``` + OLED displays driven by SSD1306 drivers only natively support in hard ware 0 degree and 180 degree rendering. This feature is done in software and not free. Using this feature will increase the time to calculate what data to send over i2c to the OLED. If you are strapped for cycles, this can cause keycodes to not register. In testing however, the rendering time on an `atmega32u4` board only went from 2ms to 5ms and keycodes not registering was only noticed once we hit 15ms. - 90 Degree Rotated Rendering is achieved by using bitwise operations to rotate each 8 block of memory and uses two precalculated arrays to remap buffer memory to OLED memory. The memory map defines are precalculated for remap performance and are calculated based on the OLED Height, Width, and Block Size. For example, in the default 128x32 implementation we have a 64 byte block size. This gives us eight 8 byte blocks that need to be rotated and rendered. The OLED renders horizontally two 8 byte blocks before moving down a page, e.g: + 90 Degree Rotated Rendering is achieved by using bitwise operations to rotate each 8 block of memory and uses two precalculated arrays to remap buffer memory to OLED memory. The memory map defines are precalculated for remap performance and are calculated based on the OLED Height, Width, and Block Size. For example, in the 128x32 implementation with a `uint8_t` block type, we have a 64 byte block size. This gives us eight 8 byte blocks that need to be rotated and rendered. The OLED renders horizontally two 8 byte blocks before moving down a page, e.g: | | | | | | | |---|---|---|---|---|---| @@ -133,14 +143,22 @@ So those precalculated arrays just index the memory offsets in the order in whic ## OLED API ```C++ -// Initialize the OLED display, rotating the rendered output 180 degrees if true. +// OLED Rotation enum values are flags +typedef enum { + OLED_ROTATION_0 = 0, + OLED_ROTATION_90 = 1, + OLED_ROTATION_180 = 2, + OLED_ROTATION_270 = 3, // OLED_ROTATION_90 | OLED_ROTATION_180 +} oled_rotation_t; + +// Initialize the OLED display, rotating the rendered output based on the define passed in. // Returns true if the OLED was initialized successfully -bool oled_init(bool flip180); +bool oled_init(oled_rotation_t rotation); // Called at the start of oled_init, weak function overridable by the user -// flip180 - the value passed into oled_init -// Return true if you want the oled to be flip180 -bool oled_init_user(bool flip180); +// rotation - the value passed into oled_init +// Return new oled_rotation_t if you want to override default rotation +oled_rotation_t oled_init_user(oled_rotation_t rotation); // Clears the display buffer, resets cursor position to 0, and sets the buffer to dirty for rendering void oled_clear(void); @@ -217,7 +235,7 @@ bool oled_scroll_off(void); // Returns the maximum number of characters that will fit on a line uint8_t oled_max_chars(void); -// Returns the maximum number of lines that will fit on the oled +// Returns the maximum number of lines that will fit on the OLED uint8_t oled_max_lines(void); ``` diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c index aa025d7a4c..96ea58ccb2 100644 --- a/drivers/oled/oled_driver.c +++ b/drivers/oled/oled_driver.c @@ -203,7 +203,7 @@ bool oled_init(uint8_t rotation) { } __attribute__((weak)) -uint8_t oled_init_user(uint8_t rotation) { +oled_rotation_t oled_init_user(oled_rotation_t rotation) { return rotation; } @@ -384,7 +384,10 @@ void oled_write_char(const char data, bool invert) { // Dirty check if (memcmp(&oled_temp_buffer, oled_cursor, OLED_FONT_WIDTH)) { - oled_dirty |= (1 << ((oled_cursor - &oled_buffer[0]) / OLED_BLOCK_SIZE)); + uint16_t index = oled_cursor - &oled_buffer[0]; + oled_dirty |= (1 << (index / OLED_BLOCK_SIZE)); + // Edgecase check if the written data spans the 2 chunks + oled_dirty |= (1 << ((index + OLED_FONT_WIDTH) / OLED_BLOCK_SIZE)); } // Finally move to the next char diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h index 1ca31df114..ec07f1d9b8 100644 --- a/drivers/oled/oled_driver.h +++ b/drivers/oled/oled_driver.h @@ -27,14 +27,17 @@ along with this program. If not, see . #define OLED_DISPLAY_WIDTH 128 #define OLED_DISPLAY_HEIGHT 64 #define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 1024 (compile time mathed) - #define OLED_BLOCK_TYPE uint16_t - #define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 16 (compile time mathed) - #define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 64 (compile time mathed) + #define OLED_BLOCK_TYPE uint32_t + #define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 32 (compile time mathed) + #define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed) // For 90 degree rotation, we map our internal matrix to oled matrix using fixed arrays // The OLED writes to it's memory horizontally, starting top left, but our memory starts bottom left in this mode - #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 } - #define OLED_TARGET_MAP { 56, 48, 40, 32, 24, 16, 8, 0 } + #define OLED_SOURCE_MAP { 32, 40, 48, 56 } + #define OLED_TARGET_MAP { 24, 16, 8, 0 } + // If OLED_BLOCK_TYPE is uint16_t, these tables would look like: + // #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 } + // #define OLED_TARGET_MAP { 56, 48, 40, 32, 24, 16, 8, 0 } // If OLED_BLOCK_TYPE is uint8_t, these tables would look like: // #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 } // #define OLED_TARGET_MAP { 56, 120, 48, 112, 40, 104, 32, 96, 24, 88, 16, 80, 8, 72, 0, 64 } @@ -43,14 +46,17 @@ along with this program. If not, see . #define OLED_DISPLAY_WIDTH 128 #define OLED_DISPLAY_HEIGHT 32 #define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 512 (compile time mathed) - #define OLED_BLOCK_TYPE uint8_t // Type to use for segmenting the oled display for smart rendering, use unsigned types only - #define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 8 (compile time mathed) - #define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 128 (compile time mathed) + #define OLED_BLOCK_TYPE uint16_t // Type to use for segmenting the oled display for smart rendering, use unsigned types only + #define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 16 (compile time mathed) + #define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed) // For 90 degree rotation, we map our internal matrix to oled matrix using fixed arrays // The OLED writes to it's memory horizontally, starting top left, but our memory starts bottom left in this mode - #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 } - #define OLED_TARGET_MAP { 48, 32, 16, 0, 56, 40, 24, 8 } + #define OLED_SOURCE_MAP { 0, 8, 16, 24 } + #define OLED_TARGET_MAP { 24, 16, 8, 0 } + // If OLED_BLOCK_TYPE is uint8_t, these tables would look like: + // #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 } + // #define OLED_TARGET_MAP { 48, 32, 16, 0, 56, 40, 24, 8 } #endif // defined(OLED_DISPLAY_CUSTOM) // Address to use for tthe i2d oled communication @@ -79,19 +85,22 @@ along with this program. If not, see . #define OLED_FONT_HEIGHT 8 #endif -#define OLED_ROTATION_0 0x00 -#define OLED_ROTATION_90 0x01 -#define OLED_ROTATION_180 0x02 -#define OLED_ROTATION_270 0x03 +// OLED Rotation enum values are flags +typedef enum { + OLED_ROTATION_0 = 0, + OLED_ROTATION_90 = 1, + OLED_ROTATION_180 = 2, + OLED_ROTATION_270 = 3, // OLED_ROTATION_90 | OLED_ROTATION_180 +} oled_rotation_t; // Initialize the oled display, rotating the rendered output based on the define passed in. // Returns true if the OLED was initialized successfully -bool oled_init(uint8_t rotation); +bool oled_init(oled_rotation_t rotation); // Called at the start of oled_init, weak function overridable by the user // rotation - the value passed into oled_init -// Return new uint8_t if you want to override default rotation -uint8_t oled_init_user(uint8_t rotation); +// Return new oled_rotation_t if you want to override default rotation +oled_rotation_t oled_init_user(oled_rotation_t rotation); // Clears the display buffer, resets cursor position to 0, and sets the buffer to dirty for rendering void oled_clear(void); diff --git a/keyboards/sol/keymaps/brianweyer/keymap.c b/keyboards/sol/keymaps/brianweyer/keymap.c index 9fd6ad6153..87d603d817 100755 --- a/keyboards/sol/keymaps/brianweyer/keymap.c +++ b/keyboards/sol/keymaps/brianweyer/keymap.c @@ -181,7 +181,7 @@ void matrix_init_user(void) { // OLED Driver Logic #ifdef OLED_DRIVER_ENABLE -uint8_t oled_init_user(uint8_t rotation) { +oled_rotation_t oled_init_user(oled_rotation_t rotation) { if (!has_usb()) return OLED_ROTATION_180; // flip 180 for offhand return rotation; diff --git a/keyboards/sol/keymaps/danielhklein/keymap.c b/keyboards/sol/keymaps/danielhklein/keymap.c index cfc295323f..9bcc5761af 100644 --- a/keyboards/sol/keymaps/danielhklein/keymap.c +++ b/keyboards/sol/keymaps/danielhklein/keymap.c @@ -246,7 +246,7 @@ void matrix_init_user(void) { // OLED Driver Logic #ifdef OLED_DRIVER_ENABLE -uint8_t oled_init_user(uint8_t rotation) { +oled_rotation_t oled_init_user(oled_rotation_t rotation) { if (!has_usb()) return OLED_ROTATION_180; // flip 180 for offhand return rotation; diff --git a/keyboards/sol/keymaps/default/keymap.c b/keyboards/sol/keymaps/default/keymap.c index 1742fc597c..a40bc40b73 100644 --- a/keyboards/sol/keymaps/default/keymap.c +++ b/keyboards/sol/keymaps/default/keymap.c @@ -254,7 +254,7 @@ void matrix_init_user(void) { // OLED Driver Logic #ifdef OLED_DRIVER_ENABLE -uint8_t oled_init_user(uint8_t rotation) { +oled_rotation_t oled_init_user(oled_rotation_t rotation) { if (!has_usb()) return OLED_ROTATION_180; // flip 180 for offhand return rotation; diff --git a/keyboards/zen/rev2/config.h b/keyboards/zen/rev2/config.h index dc37472f6b..5fa2627602 100644 --- a/keyboards/zen/rev2/config.h +++ b/keyboards/zen/rev2/config.h @@ -66,19 +66,6 @@ along with this program. If not, see . /* ws2812 RGB LED */ #define RGBLED_NUM 34 // Number of LEDs -// If using 90 Degree rotation, increase block cout -#ifdef OLED_ROTATE90 - #define OLED_DISPLAY_CUSTOM - #define OLED_DISPLAY_WIDTH 128 - #define OLED_DISPLAY_HEIGHT 32 - #define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 512 (compile time mathed) - #define OLED_BLOCK_TYPE uint16_t // Type to use for segmenting the oled display for smart rendering, use unsigned types only - #define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 8 (compile time mathed) - #define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed) - #define OLED_SOURCE_MAP { 0, 8, 16, 24 } - #define OLED_TARGET_MAP { 24, 16, 8, 0 } -#endif - /* * Feature disable options * These options are also useful to firmware size reduction. diff --git a/keyboards/zen/rev2/rev2.c b/keyboards/zen/rev2/rev2.c index 4104460db1..7bd8efbdd0 100644 --- a/keyboards/zen/rev2/rev2.c +++ b/keyboards/zen/rev2/rev2.c @@ -47,11 +47,11 @@ void render_status(void) { oled_write_P(led_usb_state & (1< Date: Fri, 19 Apr 2019 16:44:09 -0500 Subject: [PATCH 32/61] Fixing readme from feedback --- docs/feature_oled_driver.md | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/feature_oled_driver.md b/docs/feature_oled_driver.md index 7011f14571..fcc19515a9 100644 --- a/docs/feature_oled_driver.md +++ b/docs/feature_oled_driver.md @@ -11,10 +11,6 @@ To enable the OLED feature, there are three steps. First, when compiling your keyboard, you'll need to set `OLED_DRIVER_ENABLE=yes` in `rules.mk`, e.g.: ``` -BOOTMAGIC_ENABLE = no -MOUSEKEY_ENABLE = no -STENO_ENABLE = no -EXTRAKEY_ENABLE = yes OLED_DRIVER_ENABLE = yes ``` @@ -36,8 +32,8 @@ void oled_task_user(void) { oled_write_P(PSTR("ADJ\n"), false); break; default: - // Or use the write_ln shortcut - oled_write_P(PSTR("Undefined\n"), false); + // Or use the write_ln shortcut over adding '\n' to the end of your string + oled_write_ln_P(PSTR("Undefined"), false); } // Host Keyboard LED Status @@ -49,6 +45,20 @@ void oled_task_user(void) { #endif ``` +## Logo Example + +In the default font, ranges in the font file are reserved for a QMK Logo. To Render this logo to the oled screen, use the following code example: + +```C++ +static void render_logo(void) { + static const char PROGMEM qmk_logo[] = { + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, + 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, + 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0}; + + oled_write_P(qmk_logo, false); +} +``` ## Other Examples From d3268280ef7077ec1c800d30b8e98f1976192a14 Mon Sep 17 00:00:00 2001 From: Ryan Caltabiano Date: Fri, 19 Apr 2019 17:27:11 -0500 Subject: [PATCH 33/61] Removed / replaced questionable logos and added licenses file for safe logos --- drivers/oled/glcdfont.c | 24 ++++++++++----------- drivers/oled/licenses.txt | 45 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 drivers/oled/licenses.txt diff --git a/drivers/oled/glcdfont.c b/drivers/oled/glcdfont.c index 150be9e944..8b969057e5 100644 --- a/drivers/oled/glcdfont.c +++ b/drivers/oled/glcdfont.c @@ -162,16 +162,16 @@ static const unsigned char font[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, - 0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, - 0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, - 0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00, + 0x00, 0xC0, 0xF0, 0xF8, 0xFC, 0x3E, + 0x1E, 0x06, 0x01, 0x00, 0x00, 0x00, + 0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00, + 0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B, 0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, 0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE, 0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00, - 0x00, 0x00, 0x00, 0xE0, 0xEC, 0xDF, - 0xFC, 0xE0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x49, 0x49, 0xFF, 0xFF, 0xFF, @@ -194,16 +194,16 @@ static const unsigned char font[] PROGMEM = { 0x03, 0x03, 0x00, 0x1E, 0x3F, 0x69, 0x69, 0x6F, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, - 0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, - 0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, - 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00, + 0x00, 0x03, 0x0F, 0x1F, 0x3F, 0x3C, + 0x78, 0x70, 0x60, 0x00, 0x00, 0x00, + 0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00, + 0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00, 0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20, 0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, 0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F, 0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00, - 0x40, 0x7C, 0x3F, 0x3F, 0x23, 0x01, - 0x23, 0x3F, 0x37, 0x6C, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x07, 0x0F, 0x0F, diff --git a/drivers/oled/licenses.txt b/drivers/oled/licenses.txt new file mode 100644 index 0000000000..111603ebf3 --- /dev/null +++ b/drivers/oled/licenses.txt @@ -0,0 +1,45 @@ +The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. + + +This is the Linux-penguin again... + +Originally drewn by Larry Ewing (http://www.isc.tamu.edu/~lewing/) +(with the GIMP) the Linux Logo has been vectorized by me (Simon Budig, +http://www.home.unix-ag.org/simon/). + +This happened quite some time ago with Corel Draw 4. But luckily +meanwhile there are tools available to handle vector graphics with +Linux. Bernhard Herzog (bernhard@users.sourceforge.net) deserves kudos +for creating Sketch (http://sketch.sourceforge.net), a powerful free +tool for creating vector graphics. He converted the Corel Draw file to +the Sketch native format. Since I am unable to maintain the Corel Draw +file any longer, the Sketch version now is the "official" one. + +Anja Gerwinski (anja@gerwinski.de) has created an alternate version of +the penguin (penguin-variant.sk) with a thinner mouth line and slightly +altered gradients. It also features a nifty drop shadow. + +The third bird (penguin-flat.sk) is a version reduced to three colors +(black/white/yellow) for e.g. silk screen printing. I made this version +for a mug, available at the friendly folks at +http://www.kernelconcepts.de/ - they do good stuff, mail Petra +(pinguin@kernelconcepts.de) if you need something special or don't +understand the german :-) + +These drawings are copyrighted by Larry Ewing and Simon Budig +(penguin-variant.sk also by Anja Gerwinski), redistribution is free but +has to include this README/Copyright notice. + +The use of these drawings is free. However I am happy about a sample of +your mug/t-shirt/whatever with this penguin on it... + +Have fun + Simon Budig + + +Simon.Budig@unix-ag.org +http://www.home.unix-ag.org/simon/ + +Simon Budig +Am Hardtkoeppel 2 +D-61279 Graevenwiesbach From ff9cd1dd0c2cc3be2a25b388eab183f6ff20b5b6 Mon Sep 17 00:00:00 2001 From: William Chang Date: Sat, 20 Apr 2019 17:38:33 -0700 Subject: [PATCH 34/61] Added keymap/userspace for dz60 build 4 with readme (#5668) * Initial commit * Modified keymap and updated readme. * fixed numbering in readme * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Made requested changes in PR. * Rename README.md to readme.md --- .../dz60/keymaps/billiams/build_flash.sh | 9 +++ keyboards/dz60/keymaps/billiams/config.h | 1 + keyboards/dz60/keymaps/billiams/keymap.c | 48 ++++++++++++ keyboards/dz60/keymaps/billiams/readme.md | 73 +++++++++++++++++++ 4 files changed, 131 insertions(+) create mode 100644 keyboards/dz60/keymaps/billiams/build_flash.sh create mode 100644 keyboards/dz60/keymaps/billiams/config.h create mode 100644 keyboards/dz60/keymaps/billiams/keymap.c create mode 100644 keyboards/dz60/keymaps/billiams/readme.md diff --git a/keyboards/dz60/keymaps/billiams/build_flash.sh b/keyboards/dz60/keymaps/billiams/build_flash.sh new file mode 100644 index 0000000000..e7a8111441 --- /dev/null +++ b/keyboards/dz60/keymaps/billiams/build_flash.sh @@ -0,0 +1,9 @@ +# dfu-programmer atmega32u4 erase --force +# dfu-programmer atmega32u4 flash /path/to/firmware.hex +# dfu-programmer atmega32u4 reset + +# run this in the qmk_firmware directory +make dz60:billiams +dfu-programmer atmega32u4 erase --force && \ +dfu-programmer atmega32u4 flash dz60_billiams.hex && \ +dfu-programmer atmega32u4 reset \ No newline at end of file diff --git a/keyboards/dz60/keymaps/billiams/config.h b/keyboards/dz60/keymaps/billiams/config.h new file mode 100644 index 0000000000..9560d51a6f --- /dev/null +++ b/keyboards/dz60/keymaps/billiams/config.h @@ -0,0 +1 @@ +#define GRAVE_ESC_GUI_OVERRIDE # Always send Escape if GUI is pressed diff --git a/keyboards/dz60/keymaps/billiams/keymap.c b/keyboards/dz60/keymaps/billiams/keymap.c new file mode 100644 index 0000000000..88ce0f329c --- /dev/null +++ b/keyboards/dz60/keymaps/billiams/keymap.c @@ -0,0 +1,48 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Qwerty + * ,-----------------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Bkspc | + * |-----------------------------------------------------------------------------------------+ + * | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | + * |-----------------------------------------------------------------------------------------+ + * | Fn | A | S | D | F | G | H | J | K | L | ; | ' | Enter | + * |-----------------------------------------------------------------------------------------+ + * | Shift | Z | X | C | V | B | N | M | , | . |Tap(/) Shft| U | ESC | + * |-----------------------------------------------------------------------------------------+ + * | Ctrl | Alt | Cmd | Space | Cmd | Fn | L | D | R | + * `-----------------------------------------------------------------------------------------' + */ + + LAYOUT_directional( + KC_GRAVE, 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_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, + MO(1), 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, _______, RSFT_T(KC_SLSH) , KC_UP, KC_ESCAPE, + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RGUI, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* FN Layer + * ,-----------------------------------------------------------------------------------------. + * | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DEL | + * |-----------------------------------------------------------------------------------------+ + * | |RBB T|RGB M| Hue-| Hue+| Sat-| Sat+| Val-| Val+| | | MUTE | Vol- | Vol+ | + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | | | | | Prev | Next | Play/Pause | + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | | |Scr- |Scr+ | |PG_UP|RESET| + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | HOME|PG_DN| END | + * `-----------------------------------------------------------------------------------------' + */ + + LAYOUT_directional( + _______, 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_DEL, + _______, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, _______, _______, KC_MUTE, KC__VOLDOWN, KC__VOLUP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MRWD, KC_MFFD, + KC_MPLY, _______, _______, _______, _______, _______, _______, _______, _______, KC_BRID, KC_BRIU, _______, _______, KC_PGUP, RESET, + _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDOWN, KC_END + ), +}; diff --git a/keyboards/dz60/keymaps/billiams/readme.md b/keyboards/dz60/keymaps/billiams/readme.md new file mode 100644 index 0000000000..5a3a7213f8 --- /dev/null +++ b/keyboards/dz60/keymaps/billiams/readme.md @@ -0,0 +1,73 @@ +## Billiam's DZ60 layout + +This layout is optimized for MacOS and is for a Build 4 DZ60 with a 2U left shift, 2U right shift and an arrow +cluster in the bottom right. Don't use this layout if you didn't get Build 4, you will enter a world of pain Donny. + +Settings: + +* The `CAPS LOCK` key is replaced with a second function key. +* The `ALT` and `CMD` keys are swapped to replicate the Mac layout. +* Del is available as `Fn` + `Backspace` +* `/ ?` are available when you tap the right shift. Otherwise RShift is shift when held down +* RESET is available as `Fn`+ ` ESC` +* Underglow toggle and mode selection are available as `Fn` + `Q` and `Fn` + `S`. Yes your keyboard has lights even if you didn't get the LEDs. Bonus! +* Media play/pause doesn't seem to work with anything but iTunes at the moment. FML + + +### Initial Installation + +I found the instructions to be longer than they had to be, and I ended up having to Google some steps anyway. These are the steps I took to get my keyboard setup, in case you are new to the process. + +1. Clone the qmk_firmware repo locally +``` +# Choose one: +git clone git@github.com:qmk/qmk_firmware.git # OR +git clone https://github.com/qmk/qmk_firmware.git +``` +2. Customize your layout by starting with a [keymap](https://github.com/qmk/qmk_firmware/tree/master/keyboards/dz60/keymaps). I copied [StephenGrier](https://github.com/qmk/qmk_firmware/tree/master/keyboards/dz60/keymaps/stephengrier)'s and modified it for DZ60 Build 4 and changed a few things, like the `grave` key, `ESC` and `/`. + +3. Build your hex file +``` +make dz60:billiams # be in the qmk_firmware directory to do this +``` +A hex file `dz60_billiams.hex` will be created in the base qmk_firmware directory + +4. Before plugging in your keyboard into your computer, hold `SPACE` and `B` keys down +5. Holding those keys down, plug the keyboard into your computer, which will put the keyboard in bootlegger mode +6. If you are using [QMK toolbox](https://github.com/qmk/qmk_toolbox/releases), upload the .hex file you made above, select it and hit the flash button. For the love of all that is good and holy on Earth, don't hit the load button, that will load the default keymap and that's not what you want! Unless it is, in which case click away. + +Note: If you didn't follow my instructions in 4 and accidentally loaded the default keymap, then to `RESET` the keyboard and kick it into bootleg mode again, hold the `down arrow` key and `\`. The default layout is Build 1 and sets the `MENU` key on that build to `Fn`. `MENU` corresponds to `down arrow` in build 4. Note that you don't have to unplug the keyboard. + +Hope this helps! + +### 0 Qwerty +``` +,-----------------------------------------------------------------------------------------. +| ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Bkspc | +|-----------------------------------------------------------------------------------------+ +| Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | +|-----------------------------------------------------------------------------------------+ +| Fn | A | S | D | F | G | H | J | K | L | ; | ' | Enter | +|-----------------------------------------------------------------------------------------+ +| Shift | Z | X | C | V | B | N | M | , | . | Tap:/ RSh | U | ESC | +|-----------------------------------------------------------------------------------------+ +| Ctrl | Alt | Cmd | Space | Cmd | Fn | L | D | R | +`-----------------------------------------------------------------------------------------' +``` + +### 1 Fn Layer +``` +FN Layer +,-----------------------------------------------------------------------------------------. +| ` | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DEL | +|-----------------------------------------------------------------------------------------+ +| |RBB T|RGB M| Hue-| Hue+| Sat-| Sat+| Val-| Val+| | | MUTE | Vol- | Vol+ | +|-----------------------------------------------------------------------------------------+ +| | | | | | | | | | | Prev | Next | Play/Pause | +|-----------------------------------------------------------------------------------------+ +| | | | | | | | |Scr- |Scr+ | | PG_UP |RESET| +|-----------------------------------------------------------------------------------------+ +| | | | | | | HOME | PG_DN | END | +`-----------------------------------------------------------------------------------------' +``` + From 829ccd3491ca43be79e110b12bdabe96d6e76b0f Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Sat, 20 Apr 2019 20:21:22 -0500 Subject: [PATCH 35/61] RGB Matrix docs update from mechmerlin discussion (#5667) * RGB Matrix docs update from mechmerlin discussion * alignment * Apply suggestions from code review Co-Authored-By: XScorpion2 --- docs/feature_rgb_matrix.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 05c1ebba81..acef4717dd 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -124,7 +124,7 @@ Configure the hardware via your `config.h`: --- -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. The struct rgb_led array tells the system for each led, what key electrical matrix it represents, what the physical position is on the board, and if the led is for a modifier key or not. Here is a brief example: ```C const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { @@ -138,14 +138,14 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { } ``` -The format for the matrix position used in this array is `{row | (col << 4)}`. The `x` is between (inclusive) 0-224, and `y` is between (inclusive) 0-64. The easiest way to calculate these positions is: +The first part, `{row | col << 4}`, tells the system what key this LED represents by using the key's electrical matrix row & col. The second part, `{x=0..224, y=0..64}` represents the LED's physical position on the keyboard. The `x` is between (inclusive) 0-224, and `y` is between (inclusive) 0-64 as the effects are based on this range. The easiest way to calculate these positions is imagine your keyboard is a grid, and the top left of the keyboard represents x, y coordinate 0, 0 and the bottom right of your keyboard represents 224, 64. Using this as a basis, you can use the following formula to calculate the physical position: ```C -x = 224 / ( NUMBER_OF_COLS - 1 ) * ROW_POSITION -y = 64 / (NUMBER_OF_ROWS - 1 ) * COL_POSITION +x = 224 / (NUMBER_OF_COLS - 1) * COL_POSITION +y = 64 / (NUMBER_OF_ROWS - 1) * ROW_POSITION ``` -Where all variables are decimels/floats. +Where NUMBER_OF_COLS, NUMBER_OF_ROWS, COL_POSITION, & ROW_POSITION are all based on the physical layout of your keyboard, not the electrical layout. `modifier` is a boolean, whether or not a certain key is considered a modifier (used in some effects). From b27ddf1edbc5baa317507d7c91054abd2e14de8a Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Sun, 21 Apr 2019 11:13:44 -0500 Subject: [PATCH 36/61] [Keyboard] Updated rules.mk for Sol to use the correct feature flag (#5672) --- keyboards/sol/keymaps/default/rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/sol/keymaps/default/rules.mk b/keyboards/sol/keymaps/default/rules.mk index 40167b3755..526b72fe7f 100644 --- a/keyboards/sol/keymaps/default/rules.mk +++ b/keyboards/sol/keymaps/default/rules.mk @@ -19,7 +19,7 @@ UNICODE_ENABLE = no # Unicode SWAP_HANDS_ENABLE = no # Enable one-hand typing ENCODER_ENABLE_CUSTOM = yes # Enable rotary encoder (+90) -OLED_ENABLE = no # OLED_ENABLE (+5000) +OLED_DRIVER_ENABLE = no # Enable the OLED Driver (+5000) IOS_DEVICE_ENABLE = no # Limit max brightness to connect to IOS device (iPad,iPhone) # Do not edit past here From e2843c25ceb35ab8c1e22ec16605ee6a854b59d9 Mon Sep 17 00:00:00 2001 From: Rys Sommefeldt Date: Sun, 21 Apr 2019 17:15:19 +0100 Subject: [PATCH 37/61] [Keymap] Shuffle FL1 some more to match keycap legends (#5673) --- keyboards/tada68/keymaps/mattgemmell/keymap.c | 12 ++++++------ keyboards/tada68/keymaps/mattgemmell/readme.md | 7 +++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/keyboards/tada68/keymaps/mattgemmell/keymap.c b/keyboards/tada68/keymaps/mattgemmell/keymap.c index 1a8021ea40..f2afd3cd48 100644 --- a/keyboards/tada68/keymaps/mattgemmell/keymap.c +++ b/keyboards/tada68/keymaps/mattgemmell/keymap.c @@ -29,20 +29,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ,----------------------------------------------------------------. * | | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| |BR↑ | * |----------------------------------------------------------------| - * | | | | | | | | | | | | | | |BR↓ | + * | | | | | | | | |Prn|Scl|Pau|Up | | |BR↓ | * |------------------------------------------------------- -----| - * | | | | | | | | | | | | | | |Home| + * | | V+| V-|Mut| | | | |Hom|PgU|Lft|Rig| | |Home| * |----------------------------------------------------------------| - * | | | | | L+|LED| L-| | | V↓| V↑|Mut| | ↑ | End| + * | | | | | L+|LED| L-| | |End|PgDn|Dow| | ↑ | End| * |----------------------------------------------------------------| * | | | | | | | | ← | ↓ | → | * `----------------------------------------------------------------' */ [_FL] = LAYOUT_iso( _______, 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_BRMU, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BRMD, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, \ - _______, _______, _______, _______, BL_DEC, BL_TOGG, BL_INC, _______, _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, KC_MS_U, KC_END, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______, KC_BRMD, \ + _______, KC_VOLU, KC_VOLD, KC_MUTE, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, _______, KC_HOME, \ + _______, _______, _______, _______, BL_DEC, BL_TOGG, BL_INC, _______, _______, KC_END, KC_PGDN, KC_DOWN, _______, KC_MS_U, KC_END, \ _______, _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R ), }; diff --git a/keyboards/tada68/keymaps/mattgemmell/readme.md b/keyboards/tada68/keymaps/mattgemmell/readme.md index a67e25ae27..de8e0c4980 100644 --- a/keyboards/tada68/keymaps/mattgemmell/readme.md +++ b/keyboards/tada68/keymaps/mattgemmell/readme.md @@ -1,9 +1,8 @@ -# Custom Tada68 layout for ISO UK with Apple-y tweaks +# Custom TADA68 layout for ISO UK with Apple-specific tweaks -This layout is based on the [ISO UK](../iso-uk) layout, with the following -changes: +This layout is based on the [ISO UK](../iso-uk) layout, with changes to make it +more user friendly when used on Apple devices, like iPads and the Mac. -Swap Win and Alt on the left side (Option and Command on macOS) ## Installation From 50e0bdab0012c96736f2a9fe7ef88802c6839e20 Mon Sep 17 00:00:00 2001 From: moyi4681 Date: Mon, 22 Apr 2019 00:33:36 +0800 Subject: [PATCH 38/61] [Keyboard] dz60rgb: update default keymap (#5661) * Update keymap.c * Update config.h * Update dz60rgb.c * Update keymap.c --- keyboards/dztech/dz60rgb/config.h | 2 +- keyboards/dztech/dz60rgb/dz60rgb.c | 113 ++---------------- .../dztech/dz60rgb/keymaps/default/keymap.c | 58 +++------ 3 files changed, 28 insertions(+), 145 deletions(-) diff --git a/keyboards/dztech/dz60rgb/config.h b/keyboards/dztech/dz60rgb/config.h index f43b39810f..0c04acce3f 100644 --- a/keyboards/dztech/dz60rgb/config.h +++ b/keyboards/dztech/dz60rgb/config.h @@ -22,7 +22,7 @@ #define DEBOUNCE 3 #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_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended #define RGB_MATRIX_KEYPRESSES #define RGB_MATRIX_LED_PROCESS_LIMIT 4 #define RGB_MATRIX_LED_FLUSH_LIMIT 26 diff --git a/keyboards/dztech/dz60rgb/dz60rgb.c b/keyboards/dztech/dz60rgb/dz60rgb.c index 99e3b5646f..a6825e750f 100644 --- a/keyboards/dztech/dz60rgb/dz60rgb.c +++ b/keyboards/dztech/dz60rgb/dz60rgb.c @@ -1,14 +1,7 @@ #include "dz60rgb.h" #include "config.h" #if defined (dzrgb60_iso) - const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { -/* Refer to IS31 manual for these locations - * driver - * | R location - * | | G location - * | | | B location - * | | | | */ {0, K_14, J_14, L_14}, {0, K_13, J_13, L_13}, {0, K_12, J_12, L_12}, @@ -23,7 +16,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, K_3, J_3, L_3}, {0, K_2, J_2, L_2}, {0, K_1, J_1, L_1}, - {0, H_15, G_15, I_15}, {0, H_13, G_13, I_13}, {0, H_12, G_12, I_12}, @@ -38,7 +30,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, H_3, G_3, I_3}, {0, H_2, G_2, I_2}, {0, H_1, G_1, I_1}, - {0, B_14, A_14, C_14}, {0, E_12, D_12, F_12}, {0, E_11, D_11, F_11}, @@ -52,7 +43,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, E_3, D_3, F_3}, {0, E_2, D_2, F_2}, {0, E_1, D_1, F_1}, - {0, B_13, A_13, C_13}, {0, B_11, A_11, C_11}, {0, B_10, A_10, C_10}, @@ -65,7 +55,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, B_3, A_3, C_3}, {0, B_2, A_2, C_2}, {0, B_1, A_1, C_1}, - {0, B_15, A_15, C_15}, {0, E_13, D_13, F_13}, {0, B_12, A_12, C_12}, @@ -73,9 +62,8 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, B_16, A_16, C_16}, {0, E_16, D_16, F_16}, {0, H_16, G_16, I_16}, - {0, K_16, J_16, L_16} + {0, K_16, J_16, L_16}, }; - const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{0|(13<<4)}, {16*13.5, 0}, 1}, {{0|(12<<4)}, {16*12, 0}, 1}, @@ -91,7 +79,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{0|(2<<4)}, {16*2, 0}, 1}, {{0|(1<<4)}, {16*1, 0}, 1}, {{0|(0<<4)}, {16*0, 0}, 1}, - {{2|(13<<4)}, {16*13.75, 24}, 1}, {{1|(12<<4)}, {16*12.5, 16}, 0}, {{1|(11<<4)}, {16*11.5, 16}, 0}, @@ -106,7 +93,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{1|(2<<4)}, { 16*2.5, 16}, 0}, {{1|(1<<4)}, { 16*1.5, 16}, 0}, {{1|(0<<4)}, { 16*0.25, 16}, 1}, - {{1|(13<<4)}, {16*12.75, 32}, 1}, {{2|(11<<4)}, {16*11.75, 32}, 0}, {{2|(10<<4)}, {16*10.75, 32}, 0}, @@ -120,7 +106,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{2|(2<<4)}, { 16*2.75, 32}, 0}, {{2|(1<<4)}, { 16*1.75, 32}, 0}, {{2|(0<<4)}, { 16*0.375, 32}, 1}, - {{3|(11<<4)}, {16*13.125, 48}, 1}, {{3|(10<<4)}, {16*11.25, 48}, 0}, {{3|(9<<4)}, {16*10.25, 48}, 0}, @@ -133,7 +118,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{3|(2<<4)}, {16*3.25, 48}, 0}, {{3|(1<<4)}, {16*1.25, 48}, 0}, {{3|(0<<4)}, {16*0.625, 48}, 1}, - {{4|(13<<4)}, {16*13.875, 64}, 1}, {{4|(11<<4)}, {16*12.625, 64}, 1}, {{4|(10<<4)}, {16*11.375, 64}, 1}, @@ -141,21 +125,10 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{4|(5<<4)}, { 16*6.375, 64}, 0}, {{4|(2<<4)}, { 16*2.625, 64}, 1}, {{4|(1<<4)}, { 16*1.375, 64}, 1}, - {{4|(0<<4)}, { 16*0.125, 64}, 1} - + {{4|(0<<4)}, { 16*0.125, 64}, 1}, }; - - - #elif defined (dzrgb60_hhkb) - const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { -/* Refer to IS31 manual for these locations - * driver - * | R location - * | | G location - * | | | B location - * | | | | */ {0, H_15, G_15, I_15}, {0, K_14, J_14, L_14}, {0, K_13, J_13, L_13}, @@ -171,7 +144,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, K_3, J_3, L_3}, {0, K_2, J_2, L_2}, {0, K_1, J_1, L_1}, - {0, H_14, G_14, I_14}, {0, H_13, G_13, I_13}, {0, H_12, G_12, I_12}, @@ -186,7 +158,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, H_3, G_3, I_3}, {0, H_2, G_2, I_2}, {0, H_1, G_1, I_1}, - {0, E_14, D_14, F_14}, {0, E_12, D_12, F_12}, {0, E_11, D_11, F_11}, @@ -200,7 +171,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, E_3, D_3, F_3}, {0, E_2, D_2, F_2}, {0, E_1, D_1, F_1}, - {0, B_14, A_14, C_14}, {0, B_13, A_13, C_13}, {0, B_11, A_11, C_11}, @@ -214,16 +184,14 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, B_3, A_3, C_3}, {0, B_2, A_2, C_2}, {0, B_1, A_1, C_1}, - {0, B_15, A_15, C_15}, {0, E_13, D_13, F_13}, {0, B_12, A_12, C_12}, {0, B_16, A_16, C_16}, {0, E_16, D_16, F_16}, {0, H_16, G_16, I_16}, - {0, K_16, J_16, L_16} + {0, K_16, J_16, L_16}, }; - const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{2|(12<<4)}, {16*14, 0}, 1}, {{0|(13<<4)}, {16*13, 0}, 1}, @@ -240,7 +208,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{0|(2<<4)}, {16*2, 0}, 1}, {{0|(1<<4)}, {16*1, 0}, 1}, {{0|(0<<4)}, {16*0, 0}, 1}, - {{1|(13<<4)}, {16*13.75, 16}, 1}, {{1|(12<<4)}, {16*12.5, 16}, 0}, {{1|(11<<4)}, {16*11.5, 16}, 0}, @@ -255,7 +222,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{1|(2<<4)}, { 16*2.5, 16}, 0}, {{1|(1<<4)}, { 16*1.5, 16}, 0}, {{1|(0<<4)}, { 16*0.25, 16}, 1}, - {{2|(13<<4)}, {16*12.75, 32}, 1}, {{2|(11<<4)}, {16*11.75, 32}, 0}, {{2|(10<<4)}, {16*10.75, 32}, 0}, @@ -269,7 +235,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{2|(2<<4)}, { 16*2.75, 32}, 0}, {{2|(1<<4)}, { 16*1.75, 32}, 0}, {{2|(0<<4)}, { 16*0.375, 32}, 1}, - {{3|(13<<4)}, {16*14, 48}, 1}, {{3|(11<<4)}, {16*12.625, 48}, 0}, {{3|(10<<4)}, {16*11.25, 48}, 0}, @@ -283,24 +248,16 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{3|(2<<4)}, {16*3.25, 48}, 0}, {{3|(1<<4)}, {16*1.25, 48}, 0}, {{3|(0<<4)}, {16*0.625, 48}, 1}, - {{4|(13<<4)}, {16*13.625, 64}, 1}, {{4|(11<<4)}, {16*12.375, 64}, 1}, {{4|(10<<4)}, {16*11.125, 64}, 1}, {{4|(5<<4)}, { 16*7, 64}, 0}, {{4|(2<<4)}, { 16*2.875, 64}, 1}, {{4|(1<<4)}, { 16*1.625, 64}, 1}, - {{4|(0<<4)}, { 16*0.375, 64}, 1} - + {{4|(0<<4)}, { 16*0.375, 64}, 1}, }; #elif defined (dzrgb60_hhkb_iso) const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { -/* Refer to IS31 manual for these locations - * driver - * | R location - * | | G location - * | | | B location - * | | | | */ {0, H_15, G_15, I_15}, {0, K_14, J_14, L_14}, {0, K_13, J_13, L_13}, @@ -316,7 +273,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, K_3, J_3, L_3}, {0, K_2, J_2, L_2}, {0, K_1, J_1, L_1}, - {0, K_15, J_15, L_15}, {0, H_13, G_13, I_13}, {0, H_12, G_12, I_12}, @@ -331,7 +287,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, H_3, G_3, I_3}, {0, H_2, G_2, I_2}, {0, H_1, G_1, I_1}, - {0, E_15, D_15, F_15}, {0, E_12, D_12, F_12}, {0, E_11, D_11, F_11}, @@ -345,7 +300,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, E_3, D_3, F_3}, {0, E_2, D_2, F_2}, {0, E_1, D_1, F_1}, - {0, B_14, A_14, C_14}, {0, B_13, A_13, C_13}, {0, B_11, A_11, C_11}, @@ -359,16 +313,14 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, B_3, A_3, C_3}, {0, B_2, A_2, C_2}, {0, B_1, A_1, C_1}, - {0, B_15, A_15, C_15}, {0, E_13, D_13, F_13}, {0, B_12, A_12, C_12}, {0, B_16, A_16, C_16}, {0, E_16, D_16, F_16}, {0, H_16, G_16, I_16}, - {0, K_16, J_16, L_16} + {0, K_16, J_16, L_16}, }; - const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{2|(12<<4)}, {16*14, 0}, 1}, {{0|(13<<4)}, {16*13, 0}, 1}, @@ -385,7 +337,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{0|(2<<4)}, {16*2, 0}, 1}, {{0|(1<<4)}, {16*1, 0}, 1}, {{0|(0<<4)}, {16*0, 0}, 1}, - {{2|(13<<4)}, {16*13.75, 24}, 1}, {{1|(12<<4)}, {16*12.5, 16}, 0}, {{1|(11<<4)}, {16*11.5, 16}, 0}, @@ -400,7 +351,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{1|(2<<4)}, { 16*2.5, 16}, 0}, {{1|(1<<4)}, { 16*1.5, 16}, 0}, {{1|(0<<4)}, { 16*0.25, 16}, 1}, - {{1|(13<<4)}, {16*12.75, 32}, 1}, {{2|(11<<4)}, {16*11.75, 32}, 0}, {{2|(10<<4)}, {16*10.75, 32}, 0}, @@ -414,7 +364,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{2|(2<<4)}, { 16*2.75, 32}, 0}, {{2|(1<<4)}, { 16*1.75, 32}, 0}, {{2|(0<<4)}, { 16*0.375, 32}, 1}, - {{3|(13<<4)}, {16*14, 48}, 1}, {{3|(11<<4)}, {16*12.625, 48}, 0}, {{3|(10<<4)}, {16*11.25, 48}, 0}, @@ -428,24 +377,16 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{3|(2<<4)}, {16*3.25, 48}, 0}, {{3|(1<<4)}, {16*1.25, 48}, 0}, {{3|(0<<4)}, {16*0.625, 48}, 1}, - {{4|(13<<4)}, {16*13.625, 64}, 1}, {{4|(11<<4)}, {16*12.375, 64}, 1}, {{4|(10<<4)}, {16*11.125, 64}, 1}, {{4|(5<<4)}, { 16*7, 64}, 0}, {{4|(2<<4)}, { 16*2.875, 64}, 1}, {{4|(1<<4)}, { 16*1.625, 64}, 1}, - {{4|(0<<4)}, { 16*0.375, 64}, 1} - + {{4|(0<<4)}, { 16*0.375, 64}, 1}, }; #elif defined (dzrgb60_ansi) const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { -/* Refer to IS31 manual for these locations - * driver - * | R location - * | | G location - * | | | B location - * | | | | */ {0, K_14, J_14, L_14}, {0, K_13, J_13, L_13}, {0, K_12, J_12, L_12}, @@ -460,7 +401,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, K_3, J_3, L_3}, {0, K_2, J_2, L_2}, {0, K_1, J_1, L_1}, - {0, H_14, G_14, I_14}, {0, H_13, G_13, I_13}, {0, H_12, G_12, I_12}, @@ -475,7 +415,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, H_3, G_3, I_3}, {0, H_2, G_2, I_2}, {0, H_1, G_1, I_1}, - {0, E_14, D_14, F_14}, {0, E_12, D_12, F_12}, {0, E_11, D_11, F_11}, @@ -489,7 +428,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, E_3, D_3, F_3}, {0, E_2, D_2, F_2}, {0, E_1, D_1, F_1}, - {0, B_13, A_13, C_13}, {0, B_11, A_11, C_11}, {0, B_10, A_10, C_10}, @@ -502,7 +440,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, B_3, A_3, C_3}, {0, B_2, A_2, C_2}, {0, B_1, A_1, C_1}, - {0, B_15, A_15, C_15}, {0, E_13, D_13, F_13}, {0, B_12, A_12, C_12}, @@ -510,9 +447,8 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, B_16, A_16, C_16}, {0, E_16, D_16, F_16}, {0, H_16, G_16, I_16}, - {0, K_16, J_16, L_16} + {0, K_16, J_16, L_16}, }; - const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{0|(13<<4)}, {16*13.5, 0}, 1}, {{0|(12<<4)}, {16*12, 0}, 1}, @@ -528,7 +464,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{0|(2<<4)}, {16*2, 0}, 1}, {{0|(1<<4)}, {16*1, 0}, 1}, {{0|(0<<4)}, {16*0, 0}, 1}, - {{1|(13<<4)}, {16*13.75, 16}, 1}, {{1|(12<<4)}, {16*12.5, 16}, 0}, {{1|(11<<4)}, {16*11.5, 16}, 0}, @@ -543,7 +478,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{1|(2<<4)}, { 16*2.5, 16}, 0}, {{1|(1<<4)}, { 16*1.5, 16}, 0}, {{1|(0<<4)}, { 16*0.25, 16}, 1}, - {{2|(13<<4)}, {16*13.375, 24}, 1}, {{2|(11<<4)}, {16*11.75, 32}, 0}, {{2|(10<<4)}, {16*10.75, 32}, 0}, @@ -557,7 +491,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{2|(2<<4)}, { 16*2.75, 32}, 0}, {{2|(1<<4)}, { 16*1.75, 32}, 0}, {{2|(0<<4)}, { 16*0.375, 32}, 1}, - {{3|(11<<4)}, {16*13.125, 48}, 1}, {{3|(10<<4)}, {16*11.25, 48}, 0}, {{3|(9<<4)}, {16*10.25, 48}, 0}, @@ -570,7 +503,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{3|(2<<4)}, {16*3.25, 48}, 0}, {{3|(1<<4)}, {16*1.25, 48}, 0}, {{3|(0<<4)}, {16*0.625, 48}, 1}, - {{4|(13<<4)}, {16*13.875, 64}, 1}, {{4|(11<<4)}, {16*12.625, 64}, 1}, {{4|(10<<4)}, {16*11.375, 64}, 1}, @@ -578,17 +510,10 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{4|(5<<4)}, { 16*6.375, 64}, 0}, {{4|(2<<4)}, { 16*2.625, 64}, 1}, {{4|(1<<4)}, { 16*1.375, 64}, 1}, - {{4|(0<<4)}, { 16*0.125, 64}, 1} + {{4|(0<<4)}, { 16*0.125, 64}, 1}, }; #else - const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { -/* Refer to IS31 manual for these locations - * driver - * | R location - * | | G location - * | | | B location - * | | | | */ {0, K_14, J_14, L_14}, {0, K_13, J_13, L_13}, {0, K_12, J_12, L_12}, @@ -603,7 +528,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, K_3, J_3, L_3}, {0, K_2, J_2, L_2}, {0, K_1, J_1, L_1}, - {0, H_14, G_14, I_14}, {0, H_13, G_13, I_13}, {0, H_12, G_12, I_12}, @@ -618,7 +542,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, H_3, G_3, I_3}, {0, H_2, G_2, I_2}, {0, H_1, G_1, I_1}, - {0, E_14, D_14, F_14}, {0, E_12, D_12, F_12}, {0, E_11, D_11, F_11}, @@ -632,7 +555,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, E_3, D_3, F_3}, {0, E_2, D_2, F_2}, {0, E_1, D_1, F_1}, - {0, B_14, A_14, C_14}, {0, B_13, A_13, C_13}, {0, B_11, A_11, C_11}, @@ -646,7 +568,6 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, B_3, A_3, C_3}, {0, B_2, A_2, C_2}, {0, B_1, A_1, C_1}, - {0, B_15, A_15, C_15}, {0, E_13, D_13, F_13}, {0, B_12, A_12, C_12}, @@ -655,9 +576,8 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, B_16, A_16, C_16}, {0, E_16, D_16, F_16}, {0, H_16, G_16, I_16}, - {0, K_16, J_16, L_16} + {0, K_16, J_16, L_16}, }; - const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{0|(13<<4)}, {17.23*13, 0}, 1}, {{0|(12<<4)}, {17.23*12, 0}, 1}, @@ -673,7 +593,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{0|(2<<4)}, { 17.23*2, 0}, 1}, {{0|(1<<4)}, { 17.23*1, 0}, 1}, {{0|(0<<4)}, { 17.23*0, 0}, 1}, - {{1|(13<<4)}, {17.23*13, 16}, 1}, {{1|(12<<4)}, {17.23*12, 16}, 0}, {{1|(11<<4)}, {17.23*11, 16}, 0}, @@ -688,7 +607,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{1|(2<<4)}, { 17.23*2, 16}, 0}, {{1|(1<<4)}, { 17.23*1, 16}, 0}, {{1|(0<<4)}, { 17.23*0, 16}, 1}, - {{2|(13<<4)}, {17.23*13, 32}, 1}, {{2|(11<<4)}, {17.23*11, 32}, 0}, {{2|(10<<4)}, {17.23*10, 32}, 0}, @@ -702,7 +620,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{2|(2<<4)}, { 17.23*2, 32}, 0}, {{2|(1<<4)}, { 17.23*1, 32}, 0}, {{2|(0<<4)}, { 17.23*0, 32}, 1}, - {{3|(13<<4)}, {17.23*13, 48}, 1}, {{3|(11<<4)}, {17.23*11, 48}, 0}, {{3|(10<<4)}, {17.23*10, 48}, 0}, @@ -716,7 +633,6 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{3|(2<<4)}, { 17.23*2, 48}, 0}, {{3|(1<<4)}, { 17.23*1, 48}, 0}, {{3|(0<<4)}, { 17.23*0, 48}, 1}, - {{4|(13<<4)}, {17.23*13, 64}, 1}, {{4|(11<<4)}, {17.23*11, 64}, 1}, {{4|(10<<4)}, {17.23*10, 64}, 1}, @@ -725,32 +641,27 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{4|(5<<4)}, { 17.23*5, 64}, 0}, {{4|(2<<4)}, { 17.23*2, 64}, 1}, {{4|(1<<4)}, { 17.23*1, 64}, 1}, - {{4|(0<<4)}, { 17.23*0, 64}, 1} - + {{4|(0<<4)}, { 17.23*0, 64}, 1}, }; #endif void matrix_init_kb(void) { matrix_init_user(); } - - void matrix_scan_kb(void) { matrix_scan_user(); } - - bool process_record_kb(uint16_t keycode, keyrecord_t *record) { return process_record_user(keycode, record); } - - void suspend_power_down_kb(void) { rgb_matrix_set_suspend_state(true); + suspend_power_down_user(); } void suspend_wakeup_init_kb(void) { rgb_matrix_set_suspend_state(false); + suspend_wakeup_init_user(); } diff --git a/keyboards/dztech/dz60rgb/keymaps/default/keymap.c b/keyboards/dztech/dz60rgb/keymaps/default/keymap.c index 0eff4ca8a3..c0bc1b89b1 100644 --- a/keyboards/dztech/dz60rgb/keymaps/default/keymap.c +++ b/keyboards/dztech/dz60rgb/keymaps/default/keymap.c @@ -5,26 +5,23 @@ extern bool g_suspend_state; #define _LAYER2 2 #define _LAYER3 3 #define _LAYER4 4 -#define _LAYER5 5 -#define _LAYER6 6 -#define _LAYER7 7 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_LAYER0] = LAYOUT( /* Base */ - 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_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_BSLASH,\ - CTL_T(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, RSFT_T(KC_SLSH), KC_UP, LT(2, KC_DEL),\ - KC_LCTL, KC_LGUI, LM(1, MOD_LALT), KC_SPC, KC_RALT, MO(1) , KC_LEFT, KC_DOWN, KC_RIGHT), + 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_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_BSLASH,\ + CTL_T(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, RSFT_T(KC_SLSH), KC_UP, LT(2, KC_DEL),\ + KC_LCTL, KC_LGUI, LM(1, MOD_LALT), KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT), [_LAYER1] = LAYOUT( /* FN */ TO(3), 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_DEL ,\ KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_CALC, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, RESET ,\ - KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS,\ + KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, EEP_RST,\ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_PGDOWN,KC_VOLU, KC_MUTE,\ KC_TRNS, KC_TRNS, KC_TRNS, TO(4), KC_TRNS, KC_TRNS, KC_MPRV, KC_VOLD, KC_MNXT), [_LAYER2] = LAYOUT( /* LIGHT */ KC_TRNS, 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_DEL ,\ KC_TRNS, RGB_TOG, KC_TRNS, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, RGB_MOD, KC_TRNS, KC_TRNS, KC_TRNS, RESET ,\ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_SPI, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS,\ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_SPI, RGB_SPD, KC_TRNS, KC_TRNS, EEP_RST,\ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), [_LAYER3] = LAYOUT( /* NUMPAD */ @@ -33,38 +30,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_P4, KC_P5, KC_P6, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P4, KC_P5, KC_P6, KC_TRNS, KC_PENT,\ KC_TRNS, KC_P1, KC_P2, KC_P3, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_TRNS, KC_TRNS,\ KC_TRNS, KC_P0, KC_PDOT, KC_PENT, KC_P0, KC_PDOT, KC_TRNS, KC_TRNS, KC_TRNS), - [_LAYER4] = LAYOUT( /* MAC */ - 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_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_BSLASH,\ - CTL_T(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, RSFT_T(KC_SLSH), KC_UP, LT(2, KC_DEL),\ - KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, MO(5) , KC_LEFT, KC_DOWN, KC_RIGHT), + [_LAYER4] = LAYOUT( /* SWITCH LALT AND LGUI */ + 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_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_BSLASH,\ + CTL_T(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, RSFT_T(KC_SLSH), KC_UP, LT(2, KC_DEL),\ + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, TO(0), KC_LEFT, KC_DOWN, KC_RIGHT), }; - - -void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { - rgb_led led; - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - led = g_rgb_leds[i]; - if (led.matrix_co.raw < 0xFF) { - if (led.modifier) { - rgb_matrix_set_color( i, red, green, blue ); - } - } - } -} - void rgb_matrix_indicators_user(void) { uint8_t this_led = host_keyboard_leds(); if (!g_suspend_state) { switch (biton32(layer_state)) { - case _LAYER1: - rgb_matrix_layer_helper(0xFF, 0x00, 0x00, false); - break; - case _LAYER2: - rgb_matrix_layer_helper(0x00, 0xFF, 0x00, false); - break; case _LAYER3: if ( this_led & (1< Date: Sun, 21 Apr 2019 19:43:23 +0300 Subject: [PATCH 39/61] [Keymap] Add keymap for keebio/quefrency 65% version (#5666) * add keymap * fix readme title * renamed README.md to lowercase, fix typo * renamed README.md to lowercase, for real * add double spaces for github * lowercase name in readme * rename directory to lowercase --- .../quefrency/keymaps/georgepetri/config.h | 24 ++++++++++ .../quefrency/keymaps/georgepetri/keymap.c | 44 +++++++++++++++++ .../quefrency/keymaps/georgepetri/readme.md | 48 +++++++++++++++++++ .../quefrency/keymaps/georgepetri/rules.mk | 0 4 files changed, 116 insertions(+) create mode 100644 keyboards/keebio/quefrency/keymaps/georgepetri/config.h create mode 100644 keyboards/keebio/quefrency/keymaps/georgepetri/keymap.c create mode 100644 keyboards/keebio/quefrency/keymaps/georgepetri/readme.md create mode 100644 keyboards/keebio/quefrency/keymaps/georgepetri/rules.mk diff --git a/keyboards/keebio/quefrency/keymaps/georgepetri/config.h b/keyboards/keebio/quefrency/keymaps/georgepetri/config.h new file mode 100644 index 0000000000..d72d7760ef --- /dev/null +++ b/keyboards/keebio/quefrency/keymaps/georgepetri/config.h @@ -0,0 +1,24 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +Copyright 2015 Jack Humbert +Copyright 2018 Danny Nguyen + +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 . +*/ + +#pragma once + +#define USE_I2C \ No newline at end of file diff --git a/keyboards/keebio/quefrency/keymaps/georgepetri/keymap.c b/keyboards/keebio/quefrency/keymaps/georgepetri/keymap.c new file mode 100644 index 0000000000..f08ab4f834 --- /dev/null +++ b/keyboards/keebio/quefrency/keymaps/georgepetri/keymap.c @@ -0,0 +1,44 @@ +#include QMK_KEYBOARD_H + +extern keymap_config_t keymap_config; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _BASE 0 +#define _FN1 1 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT_65( +// ┌────────┬────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┐ + 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_HOME,\ +// ├────────┴────┬───┴────┬───┴────┬───┴────┬───┴────┬───┴────┬───┘ ┌───┴────┬───┴────┬───┴────┬───┴────┬───┴────┬───┴────┬───┴────┬───┴────────┼────────┤ + 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_END, \ +// ├─────────────┴─┬──────┴─┬──────┴─┬──────┴─┬──────┴─┬──────┴─┐ └─┬──────┴─┬──────┴─┬──────┴─┬──────┴─┬──────┴─┬──────┴─┬──────┴────────────┼────────┤ + 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_PGDN,\ +// ├──────────┬──────────┴┬───────┴──┬─────┴─────┬──┴────────┴────────┤ ├────────┴────────┴────┬───┴────┬───┴────┬───┴────┬────────┬────────┼────────┤ + KC_LCTL, KC_LGUI, KC_LALT, MO(_FN1), KC_SPC, KC_SPC ,_______, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +// └──────────┴───────────┴──────────┴───────────┴────────────────────┘ └──────────────────────┴────────┴────────┴────────┴────────┴────────┴────────┘ + ), + + [_FN1] = LAYOUT_65( +// ┌────────┬────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┐ + 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_BSPC, KC_DEL, KC_INS, \ +// ├────────┴────┬───┴────┬───┴────┬───┴────┬───┴────┬───┴────┬───┘ ┌───┴────┬───┴────┬───┴────┬───┴────┬───┴────┬───┴────┬───┴────┬───┴────────┼────────┤ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PAUS,\ +// ├─────────────┴─┬──────┴─┬──────┴─┬──────┴─┬──────┴─┬──────┴─┐ └─┬──────┴─┬──────┴─┬──────┴─┬──────┴─┬──────┴─┬──────┴─┬──────┴────────────┼────────┤ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\ +// ├───────────────┴─────┬──┴─────┬──┴─────┬──┴─────┬──┴─────┬──┴─────┐ └─────┬──┴─────┬──┴─────┬──┴─────┬──┴─────┬──┴─────┬──┴───────────────────┼────────┤ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\ +// ├──────────┬──────────┴┬───────┴──┬─────┴─────┬──┴────────┴────────┤ ├────────┴────────┴────┬───┴────┬───┴────┬───┴────┬────────┬────────┼────────┤ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +// └──────────┴───────────┴──────────┴───────────┴────────────────────┘ └──────────────────────┴────────┴────────┴────────┴────────┴────────┴────────┘ + ) +}; diff --git a/keyboards/keebio/quefrency/keymaps/georgepetri/readme.md b/keyboards/keebio/quefrency/keymaps/georgepetri/readme.md new file mode 100644 index 0000000000..425190d198 --- /dev/null +++ b/keyboards/keebio/quefrency/keymaps/georgepetri/readme.md @@ -0,0 +1,48 @@ +# George Petri's Quefrency 65 layout + +``` +make keebio/quefrency:georgepetri +``` + +Based on the default querty layout with minor tweaks. +The position of the arrow keys in a line in the bottom right. +The backspace key is 1u and to the left of the delete key. +Grave, pause and insert are on the function layer. + +### Base Layer +``` +┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐ ┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐ +│ ESC ││ 1 ││ 2 ││ 3 ││ 4 ││ 5 ││ 6 │ │ 7 ││ 8 ││ 9 ││ 0 ││ MINS││ EQL ││ BSPC││ DEL ││ HOME│ +└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘ └──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘ +┌──────────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐ ┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────────┐┌──────┐ +│ TAB ││ Q ││ W ││ E ││ R ││ T │ │ Y ││ U ││ I ││ O ││ P ││ LBRC││ RBRC││ BSLS ││ END │ +└──────────┘└──────┘└──────┘└──────┘└──────┘└──────┘ └──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────────┘└──────┘ +┌────────────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐ ┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌────────────────┐┌──────┐ +│ CAPS ││ A ││ S ││ D ││ F ││ G │ │ H ││ J ││ K ││ L ││ SCLN││ QUOT││ ENT ││ PGUP│ +└────────────┘└──────┘└──────┘└──────┘└──────┘└──────┘ └──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└────────────────┘└──────┘ +┌────────────────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐ ┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌────────────────────┐┌──────┐ +│ LSFT ││ Z ││ X ││ C ││ V ││ B │ │ N ││ M ││ COMM││ DOT ││ SLSH││ RSFT ││ PGDN│ +└────────────────┘└──────┘└──────┘└──────┘└──────┘└──────┘ └──────┘└──────┘└──────┘└──────┘└──────┘└────────────────────┘└──────┘ +┌────────┐┌────────┐┌────────┐┌────────┐┌────────────────┐ ┌────────────────────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐ +│ LCTL ││ LGUI ││ LALT ││MO(_FN1)││ SPC │ │ SPC ││ RALT││ RCTL││ LEFT││ DOWN││ UP ││ RGHT│ +└────────┘└────────┘└────────┘└────────┘└────────────────┘ └────────────────────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘ +``` + +### Function +``` +┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐ ┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐ +│ GRV ││ F1 ││ F2 ││ F3 ││ F4 ││ F5 ││ F6 │ │ F7 ││ F8 ││ F9 ││ F10 ││ F11 ││ F12 ││ BSPC││ DEL ││ INS │ +└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘ └──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘ +┌──────────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐ ┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────────┐┌──────┐ +│ ││ ││ ││ ││ ││ │ │ ││ ││ ││ ││ ││ ││ ││ ││ PAUS│ +└──────────┘└──────┘└──────┘└──────┘└──────┘└──────┘ └──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────────┘└──────┘ +┌────────────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐ ┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌────────────────┐┌──────┐ +│ ││ ││ ││ ││ ││ │ │ ││ ││ ││ ││ ││ ││ ││ │ +└────────────┘└──────┘└──────┘└──────┘└──────┘└──────┘ └──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└────────────────┘└──────┘ +┌────────────────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐ ┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌────────────────────┐┌──────┐ +│ ││ ││ ││ ││ ││ │ │ ││ ││ ││ ││ ││ ││ │ +└────────────────┘└──────┘└──────┘└──────┘└──────┘└──────┘ └──────┘└──────┘└──────┘└──────┘└──────┘└────────────────────┘└──────┘ +┌────────┐┌────────┐┌────────┐┌────────┐┌────────────────┐ ┌────────────────────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐ +│ ││ ││ ││ ││ │ │ ││ ││ ││ ││ ││ ││ │ +└────────┘└────────┘└────────┘└────────┘└────────────────┘ └────────────────────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘ +``` \ No newline at end of file diff --git a/keyboards/keebio/quefrency/keymaps/georgepetri/rules.mk b/keyboards/keebio/quefrency/keymaps/georgepetri/rules.mk new file mode 100644 index 0000000000..e69de29bb2 From 81d8e6ef3e4d69dba8e9ba40db525ab4181ab3e3 Mon Sep 17 00:00:00 2001 From: MechMerlin <30334081+mechmerlin@users.noreply.github.com> Date: Sun, 21 Apr 2019 19:59:39 -0700 Subject: [PATCH 40/61] [Keyboard] Doro67 RGB PCB (#5677) * initial commit * get rid of some of the vanilla code * set up matrix and pins * Create LAYOUT macro and an appropriate keymap * support for caps lock LED * add some documentation to the doro67 parent readme * align the language used in the several readme files * initial commit * get rid of some of the vanilla code * set up matrix and pins * Create LAYOUT macro and an appropriate keymap * support for caps lock LED * add some documentation to the doro67 parent readme * align the language used in the several readme files * Use RGB Matrix and fix enter key bug * fix formatting * remove merge conflict artifacts * make a more useful default keymap * add configurator support for the RGB pcb * fix rgb matrix based on new info. Multipler should be reversed * forgot to actually set the pin output for caps lock led * fix offset keys in layer 1 keymap * code cleanup * use macros for the rgb_led calculations struct * set RGB led num to 67 as I mistakenly counted the caps lock led * cleanup config.h file * add RGB note in readme * get consistent naming in config file * fix some inconsistencies * readjust matrix and get rid of macros based on drashna's suggestions --- keyboards/doro67/multi/readme.md | 7 +- keyboards/doro67/readme.md | 12 ++ keyboards/doro67/regular/config.h | 4 +- keyboards/doro67/regular/readme.md | 6 +- keyboards/doro67/rgb/config.h | 71 ++++++++++ keyboards/doro67/rgb/info.json | 82 +++++++++++ keyboards/doro67/rgb/keymaps/default/config.h | 19 +++ keyboards/doro67/rgb/keymaps/default/keymap.c | 62 +++++++++ .../doro67/rgb/keymaps/default/readme.md | 1 + keyboards/doro67/rgb/readme.md | 17 +++ keyboards/doro67/rgb/rgb.c | 127 ++++++++++++++++++ keyboards/doro67/rgb/rgb.h | 41 ++++++ keyboards/doro67/rgb/rules.mk | 83 ++++++++++++ 13 files changed, 522 insertions(+), 10 deletions(-) create mode 100644 keyboards/doro67/rgb/config.h create mode 100644 keyboards/doro67/rgb/info.json create mode 100644 keyboards/doro67/rgb/keymaps/default/config.h create mode 100644 keyboards/doro67/rgb/keymaps/default/keymap.c create mode 100644 keyboards/doro67/rgb/keymaps/default/readme.md create mode 100644 keyboards/doro67/rgb/readme.md create mode 100644 keyboards/doro67/rgb/rgb.c create mode 100644 keyboards/doro67/rgb/rgb.h create mode 100644 keyboards/doro67/rgb/rules.mk diff --git a/keyboards/doro67/multi/readme.md b/keyboards/doro67/multi/readme.md index ac1484cd74..40fd53ee11 100644 --- a/keyboards/doro67/multi/readme.md +++ b/keyboards/doro67/multi/readme.md @@ -1,9 +1,6 @@ -Doro67 Multi PCB -=== +# Doro67 Multi PCB -A custom 65% keyboard with multiple layout support. - -Do not flash RGB firmware for this board. +65% custom keyboard made by 80ultraman/Alf/Backprop Studios with multiple layout support. Despite the layout options available, layout is dictated by the selected integrated plate. Keyboard Maintainer: [ShadeDream](https://github.com/shadedream) Hardware Supported: Doro67 Multi PCB diff --git a/keyboards/doro67/readme.md b/keyboards/doro67/readme.md index e69de29bb2..1648fbde57 100644 --- a/keyboards/doro67/readme.md +++ b/keyboards/doro67/readme.md @@ -0,0 +1,12 @@ +# Doro67 + +The Doro67 is a 65% USB C, integrated plate keyboard with blocker based on the M65-a by Keyclack/Rama. + +The [Group Buy](https://geekhack.org/index.php?topic=97265.0) was run by 80ultraman in coordination with Alf for machining and Backprop Studios for PCB design. + +There were 3 different PCBs available for this group buy. +## **Please be aware of which PCB you own and flash the correct firmware on it.** + +**Regular:** PCB made for the China GB which only had 1 layout. +**Multi:** PCB made for the international GB comprising of multiple layouts. While several layouts were possible, layout was determined by the integrated plate layout chosen by the customer. +**RGB:** PCB made for the international GB which had an identical switch matrix and layout to the regular PCB, with the addition of per key RGB LEDs. \ No newline at end of file diff --git a/keyboards/doro67/regular/config.h b/keyboards/doro67/regular/config.h index 9ba591cdd9..8c5c670da9 100644 --- a/keyboards/doro67/regular/config.h +++ b/keyboards/doro67/regular/config.h @@ -6,8 +6,8 @@ #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x0000 #define DEVICE_VER 0x0001 -#define MANUFACTURER 80ultraman -#define PRODUCT doro67 +#define MANUFACTURER Backprop Studio +#define PRODUCT Doro67 Regular PCB #define DESCRIPTION 65% custom keyboard /* key matrix size */ diff --git a/keyboards/doro67/regular/readme.md b/keyboards/doro67/regular/readme.md index 71d27ceb52..7635a40f95 100644 --- a/keyboards/doro67/regular/readme.md +++ b/keyboards/doro67/regular/readme.md @@ -1,8 +1,8 @@ -# Regular PCB for the Doro67 +# Doro67 Regular PCB -Regular PCB for the Doro67 having ONLY one layout. This is not the PCB with RGB support. +65% custom keyboard made by 80ultraman/Alf/Backprop Studios available during the China Group Buy. -Do not flash RGB firmware for this board. +This is not the PCB with RGB support. Do not flash RGB firmware for this board. Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin) Hardware Supported: Doro67 Regular PCB diff --git a/keyboards/doro67/rgb/config.h b/keyboards/doro67/rgb/config.h new file mode 100644 index 0000000000..87a30e0847 --- /dev/null +++ b/keyboards/doro67/rgb/config.h @@ -0,0 +1,71 @@ +/* +Copyright 2019 MechMerlin + +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 . +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x0000 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Backprop Studio +#define PRODUCT Doro67 RGB PCB +#define DESCRIPTION 65% custom keyboard + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ +#define MATRIX_ROW_PINS { D0, D1, D2, D3, D5 } +#define MATRIX_COL_PINS { B0, B1, B2, B3, D4, D6, D7, B4, B5, B6, C6, C7, F5, F6, F7 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW + +// The pin connected to the data pin of the LEDs +#define RGB_DI_PIN B7 +// The number of LEDs connected +#define DRIVER_LED_TOTAL 67 + +#define RGB_MATRIX_KEYPRESSES + +/* + * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. + */ +#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6 + +#define RGBLED_NUM 67 + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE diff --git a/keyboards/doro67/rgb/info.json b/keyboards/doro67/rgb/info.json new file mode 100644 index 0000000000..2d9b79a23e --- /dev/null +++ b/keyboards/doro67/rgb/info.json @@ -0,0 +1,82 @@ +{ + "keyboard_name": "Doro 67 RGB", + "url": "", + "maintainer": "qmk", + "width": 16, + "height": 5, + "layouts": { + "LAYOUT": { + "key_count": 67, + "layout": [ + {"label":"K00", "x":0, "y":0}, + {"label":"K01", "x":1, "y":0}, + {"label":"K02", "x":2, "y":0}, + {"label":"K03", "x":3, "y":0}, + {"label":"K04", "x":4, "y":0}, + {"label":"K05", "x":5, "y":0}, + {"label":"K06", "x":6, "y":0}, + {"label":"K07", "x":7, "y":0}, + {"label":"K08", "x":8, "y":0}, + {"label":"K09", "x":9, "y":0}, + {"label":"K0A", "x":10, "y":0}, + {"label":"K0B", "x":11, "y":0}, + {"label":"K0C", "x":12, "y":0}, + {"label":"K0D", "x":13, "y":0, "w":2}, + {"label":"K0E", "x":15, "y":0}, + {"label":"K10", "x":0, "y":1, "w":1.5}, + {"label":"K11", "x":1.5, "y":1}, + {"label":"K12", "x":2.5, "y":1}, + {"label":"K13", "x":3.5, "y":1}, + {"label":"K14", "x":4.5, "y":1}, + {"label":"K15", "x":5.5, "y":1}, + {"label":"K16", "x":6.5, "y":1}, + {"label":"K17", "x":7.5, "y":1}, + {"label":"K18", "x":8.5, "y":1}, + {"label":"K19", "x":9.5, "y":1}, + {"label":"K1A", "x":10.5, "y":1}, + {"label":"K1B", "x":11.5, "y":1}, + {"label":"K1C", "x":12.5, "y":1}, + {"label":"K1D", "x":13.5, "y":1, "w":1.5}, + {"label":"K1E", "x":15, "y":1}, + {"label":"K20", "x":0, "y":2, "w":1.75}, + {"label":"K21", "x":1.75, "y":2}, + {"label":"K22", "x":2.75, "y":2}, + {"label":"K23", "x":3.75, "y":2}, + {"label":"K24", "x":4.75, "y":2}, + {"label":"K25", "x":5.75, "y":2}, + {"label":"K26", "x":6.75, "y":2}, + {"label":"K27", "x":7.75, "y":2}, + {"label":"K28", "x":8.75, "y":2}, + {"label":"K29", "x":9.75, "y":2}, + {"label":"K2A", "x":10.75, "y":2}, + {"label":"K2B", "x":11.75, "y":2}, + {"label":"K2D", "x":12.75, "y":2, "w":2.25}, + {"label":"K2E", "x":15, "y":2}, + {"label":"K30", "x":0, "y":3, "w":2.25}, + {"label":"K32", "x":2.25, "y":3}, + {"label":"K33", "x":3.25, "y":3}, + {"label":"K34", "x":4.25, "y":3}, + {"label":"K35", "x":5.25, "y":3}, + {"label":"K36", "x":6.25, "y":3}, + {"label":"K37", "x":7.25, "y":3}, + {"label":"K38", "x":8.25, "y":3}, + {"label":"K39", "x":9.25, "y":3}, + {"label":"K3A", "x":10.25, "y":3}, + {"label":"K3B", "x":11.25, "y":3}, + {"label":"K3C", "x":12.25, "y":3, "w":1.75}, + {"label":"K3D", "x":14, "y":3}, + {"label":"K3E", "x":15, "y":3}, + {"label":"K40", "x":0, "y":4, "w":1.25}, + {"label":"K41", "x":1.25, "y":4, "w":1.25}, + {"label":"K42", "x":2.5, "y":4, "w":1.25}, + {"label":"K43", "x":3.75, "y":4, "w":6.25}, + {"label":"K49", "x":10, "y":4, "w":1.25}, + {"label":"K4A", "x":11.25, "y":4, "w":1.25}, + {"label":"K4C", "x":13, "y":4}, + {"label":"K4D", "x":14, "y":4}, + {"label":"K4E", "x":15, "y":4} + ] + } + } + } + \ No newline at end of file diff --git a/keyboards/doro67/rgb/keymaps/default/config.h b/keyboards/doro67/rgb/keymaps/default/config.h new file mode 100644 index 0000000000..26c6d6ade1 --- /dev/null +++ b/keyboards/doro67/rgb/keymaps/default/config.h @@ -0,0 +1,19 @@ +/* Copyright 2019 MechMerlin + * + * 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 . + */ + +#pragma once + +// place overrides here diff --git a/keyboards/doro67/rgb/keymaps/default/keymap.c b/keyboards/doro67/rgb/keymaps/default/keymap.c new file mode 100644 index 0000000000..d02665ae76 --- /dev/null +++ b/keyboards/doro67/rgb/keymaps/default/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2019 MechMerlin + * + * 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 QMK_KEYBOARD_H + +// Defines the keycodes used by our macros in process_record_user +enum custom_keycodes { + QMKBEST = SAFE_RANGE, + QMKURL +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = 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_INS, \ + 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_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_LSFT, KC_UP, KC_PGDN, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_LALT, 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_TRNS, \ + QMKBEST, QMKURL, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, RGB_RMOD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QMKBEST: + if (record->event.pressed) { + // when keycode QMKBEST is pressed + SEND_STRING("QMK is the best thing ever!"); + } else { + // when keycode QMKBEST is released + } + break; + case QMKURL: + if (record->event.pressed) { + // when keycode QMKURL is pressed + SEND_STRING("https://qmk.fm/" SS_TAP(X_ENTER)); + } else { + // when keycode QMKURL is released + } + break; + } + return true; +} diff --git a/keyboards/doro67/rgb/keymaps/default/readme.md b/keyboards/doro67/rgb/keymaps/default/readme.md new file mode 100644 index 0000000000..4ba5eb30fd --- /dev/null +++ b/keyboards/doro67/rgb/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for rgb diff --git a/keyboards/doro67/rgb/readme.md b/keyboards/doro67/rgb/readme.md new file mode 100644 index 0000000000..3a527c933c --- /dev/null +++ b/keyboards/doro67/rgb/readme.md @@ -0,0 +1,17 @@ +# Doro67 RGB PCB + +65% custom keyboard made by 80ultraman/Alf/Backprop Studios with in switch RGB featuring the same switch matrix and layout as the regular PCB. + +Flashing the regular PCB firmware on this board will work, but will disable RGB lighting. + +Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin) +Hardware Supported: Doro 67 RGB PCB +Hardware Availability: [Geekhack GB](https://geekhack.org/index.php?topic=97265.0) + +Make example for this keyboard (after setting up your build environment): + + make doro67/rgb:default + +**RGB Note:** The WS2812 string of LEDs starts from the `K00` key connected to pin `B7` and is connected from left to right, top to bottom, following the physical layout of the board. + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/doro67/rgb/rgb.c b/keyboards/doro67/rgb/rgb.c new file mode 100644 index 0000000000..6f39e00c61 --- /dev/null +++ b/keyboards/doro67/rgb/rgb.c @@ -0,0 +1,127 @@ +/* Copyright 2019 MechMerlin + * + * 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 "rgb.h" + +// Optional override functions below. +// You can leave any or all of these undefined. +// These are only required if you want to perform custom actions. + + + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + setPinOutput(E6); + matrix_init_user(); +} + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + + matrix_scan_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware + + return process_record_user(keycode, record); +} + +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { + writePinLow(E6); + } else { + writePinHigh(E6); + } + led_set_user(usb_led); +} + +const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { + {{0|(0<<4)}, {15*0, 0}, 0}, // Esc + {{0|(1<<4)}, {15*1, 0}, 0}, // 1 + {{0|(2<<4)}, {15*2, 0}, 0}, // 2 + {{0|(3<<4)}, {15*3, 0}, 0}, // 3 + {{0|(4<<4)}, {15*4, 0}, 0}, // 4 + {{0|(5<<4)}, {15*5, 0}, 0}, // 5 + {{0|(6<<4)}, {15*6, 0}, 0}, // 6 + {{0|(7<<4)}, {15*7, 0}, 0}, // 7 + {{0|(8<<4)}, {15*8, 0}, 0}, // 8 + {{0|(9<<4)}, {15*9, 0}, 0}, // 9 + {{0|(10<<4)}, {15*10, 0}, 0}, // 0 + {{0|(11<<4)}, {15*11, 0}, 0}, // - + {{0|(12<<4)}, {15*12, 0}, 0}, // = + {{0|(13<<4)}, {15*13.5, 0}, 1}, // Backspace + {{0|(14<<4)}, {15*15, 0}, 1}, // Ins + + {{1|(0<<4)}, {15*0.5, 16}, 1}, // Tab + {{1|(1<<4)}, {15*1.5, 16}, 0}, // Q + {{1|(2<<4)}, {15*2.5, 16}, 0}, // W + {{1|(3<<4)}, {15*3.5, 16}, 0}, // E + {{1|(4<<4)}, {15*4.5, 16}, 0}, // R + {{1|(5<<4)}, {15*5.5, 16}, 0}, // T + {{1|(6<<4)}, {15*6.5, 16}, 0}, // Y + {{1|(7<<4)}, {15*7.5, 16}, 0}, // U + {{1|(8<<4)}, {15*8.5, 16}, 0}, // I + {{1|(9<<4)}, {15*9.5, 16}, 0}, // O + {{1|(10<<4)}, {15*10.5, 16}, 0}, // P + {{1|(11<<4)}, {15*11.5, 16}, 0}, // [ + {{1|(12<<4)}, {15*12.5, 16}, 0}, // ] + {{1|(13<<4)}, {15*13.75, 16}, 1}, // + {{1|(14<<4)}, {15*15, 16}, 1}, // Del + + {{2|(0<<4)}, {15*0.75, 32}, 1}, // Capslock + {{2|(1<<4)}, {15*1.75, 32}, 0}, // A + {{2|(2<<4)}, {15*2.75, 32}, 0}, // S + {{2|(3<<4)}, {15*3.75, 32}, 0}, // D + {{2|(4<<4)}, {15*4.75, 32}, 0}, // F + {{2|(5<<4)}, {15*5.75, 32}, 0}, // G + {{2|(6<<4)}, {15*6.75, 32}, 0}, // H + {{2|(7<<4)}, {15*7.75, 32}, 0}, // J + {{2|(8<<4)}, {15*8.75, 32}, 0}, // K + {{2|(9<<4)}, {15*9.75, 32}, 0}, // L + {{2|(10<<4)}, {15*10.75, 32}, 0}, // ; + {{2|(11<<4)}, {15*11.75, 32}, 0}, // ' + {{2|(13<<4)}, {15*13.25, 32}, 1}, // Enter + {{2|(14<<4)}, {15*15, 32}, 1}, // Pgup + + {{3|(0<<4)}, {15*1.25, 48}, 1}, // LShift + {{3|(2<<4)}, {15*2, 48}, 0}, // Z + {{3|(3<<4)}, {15*3, 48}, 0}, // X + {{3|(4<<4)}, {15*4, 48}, 0}, // C + {{3|(5<<4)}, {15*5, 48}, 0}, // V + {{3|(6<<4)}, {15*6, 48}, 0}, // B + {{3|(7<<4)}, {15*7, 48}, 0}, // N + {{3|(8<<4)}, {15*8, 48}, 0}, // M + {{3|(9<<4)}, {15*9, 48}, 0}, // , + {{3|(10<<4)}, {15*10, 48}, 0}, // . + {{3|(11<<4)}, {15*11, 48}, 0}, // / + {{3|(12<<4)}, {15*12.75, 48}, 1}, // Shift + {{3|(13<<4)}, {15*14, 48}, 1}, // Up + {{3|(14<<4)}, {15*15, 48}, 1}, // Pgdn + + {{4|(0<<4)}, {15*0.25, 64}, 1}, // Ctrl + {{4|(1<<4)}, {15*1.5, 64}, 1}, // GUI + {{4|(2<<4)}, {15*2.25, 64}, 1}, // Alt + {{4|(3<<4)}, {15*6.75, 64}, 0}, // Space + {{4|(9<<4)}, {15*9, 64}, 1}, // RAlt + {{4|(10<<4)}, {15*10.25, 64}, 1}, // FN + {{4|(12<<4)}, {15*13, 64}, 1}, // Left + {{4|(13<<4)}, {15*14, 64}, 1}, // Down + {{4|(14<<4)}, {15*15, 64}, 1}, // Right +}; diff --git a/keyboards/doro67/rgb/rgb.h b/keyboards/doro67/rgb/rgb.h new file mode 100644 index 0000000000..aafba11d0e --- /dev/null +++ b/keyboards/doro67/rgb/rgb.h @@ -0,0 +1,41 @@ +/* Copyright 2019 MechMerlin + * + * 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 . + */ +#pragma once + +#include "quantum.h" + +/* This a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ +#define LAYOUT( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2D, k2E, \ + k30, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \ + k40, k41, k42, k43, k49, k4A, k4C, k4D, k4E \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, KC_NO, k2D, k2E }, \ + { k30, KC_NO, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \ + { k40, k41, k42, k43, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, k49, k4A, KC_NO, k4C, k4D, k4E }, \ +} diff --git a/keyboards/doro67/rgb/rules.mk b/keyboards/doro67/rgb/rules.mk new file mode 100644 index 0000000000..6438868dc0 --- /dev/null +++ b/keyboards/doro67/rgb/rules.mk @@ -0,0 +1,83 @@ +# MCU name +#MCU = at90usb1286 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# atmega32a bootloadHID +BOOTLOADER = atmel-dfu + + +# If you don't know the bootloader type, then you can specify the +# Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +# OPT_DEFS += -DBOOTLOADER_SIZE=4096 + +RGB_MATRIX_ENABLE = WS2812 + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # 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 +# 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 = no # 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) +UNICODE_ENABLE = no # Unicode +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) From 4ecaa25f3e9ae1bd1b61bab52f6a46cbaf512ae8 Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Mon, 22 Apr 2019 10:14:57 -0500 Subject: [PATCH 41/61] forgot to update the define usage when 90 degree rotation was moved to a runtime switch (#5676) --- keyboards/zen/rev2/rev2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/zen/rev2/rev2.c b/keyboards/zen/rev2/rev2.c index 7bd8efbdd0..3f4a92c63d 100644 --- a/keyboards/zen/rev2/rev2.c +++ b/keyboards/zen/rev2/rev2.c @@ -41,7 +41,7 @@ void render_status(void) { // Host Keyboard LED Status uint8_t led_usb_state = host_keyboard_leds(); - oled_set_cursor(0, OLED_MAX_LINES - 4); // Line 13 + oled_set_cursor(0, oled_max_lines() - 4); // Line 13 oled_write_P(led_usb_state & (1< Date: Tue, 23 Apr 2019 01:15:56 +1000 Subject: [PATCH 42/61] Atreus rules.mk and readme (#5678) * Update rules and readme to reflect new make usage. * Minor edit. * Minor edit. --- keyboards/atreus/readme.md | 21 ++++++----- keyboards/atreus/rules.mk | 77 +++++++++++++++++++++----------------- 2 files changed, 54 insertions(+), 44 deletions(-) diff --git a/keyboards/atreus/readme.md b/keyboards/atreus/readme.md index 50901ee328..5cd797da96 100644 --- a/keyboards/atreus/readme.md +++ b/keyboards/atreus/readme.md @@ -1,21 +1,24 @@ Atreus -=== +====== A small mechanical keyboard that is based around the shape of the human hand. -These configuration files are specifically for the Atreus keyboards created by Phil Hagelberg (@technomancy). This keyboard is available in two variants: one powered by a Teensy 2, (usually hand-wired) one powered by an A-Star. (usually using a PCB) This repository currently assumes that you have an A-Star powered Atreus. If you are using a Teensy2, specify that by adding `TEENSY2=yes` to your `make` commands. - Keyboard Maintainer: [Phil Hagelberg](https://github.com/technomancy) Hardware Supported: Atreus, PCB-based or hand-wired Hardware Availability: https://atreus.technomancy.us -Make example for this keyboard (after setting up your build environment): +These configuration files are specifically for the Atreus keyboards created by Phil Hagelberg (@technomancy). This keyboard is available in two variants: one powered by a Teensy 2 (usually hand-wired), one powered by an A-Star (usually using a PCB). You will need to use different `make` commands depending on the variant you have; see examples below. + +A-Star:\ +`make atreus:default:avrdude` - make atreus:default:avrdude +Teensy:\ +`make TEENSY2=yes atreus:default:teensy` + +If your keyboard layout is a mirror image of what you expected (i.e. you do not get QWERTY on the left but YTREWQ on the right), then you have an A-Star powered Atreus (older than March 2016) with PCB labels facing *down* instead of up. Specify that by adding `PCBDOWN=yes` to your `make` commands, e.g. -Unlike the TMK firmware, this command should be run from the root of -the repository, not the directory containing this readme. +`make PCBDOWN=yes atreus:default:avrdude` -If your keyboard layout is a mirror image of what you expected (i.e. you do not get QWERTY on the left but YTREWQ on the right), then you have an A-Star powered Atreus (older than March 2016) with PCB labels facing *down* instead of up. Specify that by adding `PCBDOWN=yes` to your `make` commands. +*Unlike the TMK firmware, these commands should be run from the root of the repository, not the directory containing this readme.* -See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. +See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools), then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. diff --git a/keyboards/atreus/rules.mk b/keyboards/atreus/rules.mk index 2488fd5e87..eda77404a0 100644 --- a/keyboards/atreus/rules.mk +++ b/keyboards/atreus/rules.mk @@ -1,19 +1,4 @@ - - -ifdef TEENSY2 - OPT_DEFS += -DATREUS_TEENSY2 - ATREUS_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex -else - OPT_DEFS += -DATREUS_ASTAR -ifdef PCBDOWN - OPT_DEFS += -DPCBDOWN -endif - ATREUS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \ - avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB) -endif - # MCU name -#MCU = at90usb1287 MCU = atmega32u4 # Processor frequency. @@ -48,34 +33,56 @@ ARCH = AVR8 # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. F_USB = $(F_CPU) -# Bootloader -# This definition is optional, and if your keyboard supports multiple bootloaders of -# different sizes, comment this out, and the correct address will be loaded -# automatically (+60). See bootloader.mk for all options. +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# atmega32a bootloadHID ifdef TEENSY2 BOOTLOADER = halfkay + OPT_DEFS += -DATREUS_TEENSY2 else BOOTLOADER = caterina + OPT_DEFS += -DATREUS_ASTAR + ifdef PCBDOWN + OPT_DEFS += -DPCBDOWN + endif endif -# Interrupt driven control endpoint task(+60) -OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + +# If you don't know the bootloader type, then you can specify the +# Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +# OPT_DEFS += -DBOOTLOADER_SIZE=4096 # Build Options -# comment out to disable the options. +# change yes to no to disable # -#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 = yes # Console for debug(+400) -COMMAND_ENABLE = yes # Commands for debug and configuration +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend -NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA -# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -# MIDI_ENABLE = YES # MIDI controls -UNICODE_ENABLE = YES # Unicode -# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID - -USB = /dev/cu.usbmodem1411 +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) +UNICODE_ENABLE = yes # Unicode +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) From c7583d181a2cae24af60efa93caa3d662e5d48f4 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 22 Apr 2019 08:25:21 -0700 Subject: [PATCH 43/61] Update handwired/frenchdev keyboard (#5443) --- keyboards/handwired/frenchdev/config.h | 5 +- keyboards/handwired/frenchdev/frenchdev.c | 54 +++-- keyboards/handwired/frenchdev/frenchdev.h | 8 +- keyboards/handwired/frenchdev/i2cmaster.h | 178 --------------- .../frenchdev/keymaps/default/keymap.c | 152 +++++-------- keyboards/handwired/frenchdev/matrix.c | 29 +-- keyboards/handwired/frenchdev/rules.mk | 6 +- keyboards/handwired/frenchdev/twimaster.c | 208 ------------------ 8 files changed, 115 insertions(+), 525 deletions(-) delete mode 100644 keyboards/handwired/frenchdev/i2cmaster.h delete mode 100644 keyboards/handwired/frenchdev/twimaster.c diff --git a/keyboards/handwired/frenchdev/config.h b/keyboards/handwired/frenchdev/config.h index b01eec7aa0..eca6690905 100644 --- a/keyboards/handwired/frenchdev/config.h +++ b/keyboards/handwired/frenchdev/config.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef FRENCHDEV_V1_CONFIG_H -#define FRENCHDEV_V1_CONFIG_H +#pragma once #include "config_common.h" @@ -81,5 +80,3 @@ along with this program. If not, see . //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION //#define DEBUG_MATRIX_SCAN_RATE - -#endif //FRENCHDEV_V1_CONFIG_H diff --git a/keyboards/handwired/frenchdev/frenchdev.c b/keyboards/handwired/frenchdev/frenchdev.c index 6d5883a3a8..6eed4de5ff 100644 --- a/keyboards/handwired/frenchdev/frenchdev.c +++ b/keyboards/handwired/frenchdev/frenchdev.c @@ -1,5 +1,26 @@ #include "frenchdev.h" -#include "i2cmaster.h" + +extern inline void frenchdev_board_led_on(void); +extern inline void frenchdev_led_1_on(void); +extern inline void frenchdev_led_2_on(void); +extern inline void frenchdev_led_3_on(void); +extern inline void frenchdev_led_on(uint8_t led); + +extern inline void frenchdev_board_led_off(void); +extern inline void frenchdev_led_1_off(void); +extern inline void frenchdev_led_2_off(void); +extern inline void frenchdev_led_3_off(void); +extern inline void frenchdev_led_off(uint8_t led); + +extern inline void frenchdev_led_all_on(void); +extern inline void frenchdev_led_all_off(void); + +extern inline void frenchdev_led_1_set(uint8_t n); +extern inline void frenchdev_led_2_set(uint8_t n); +extern inline void frenchdev_led_3_set(uint8_t n); +extern inline void frenchdev_led_set(uint8_t led, uint8_t n); + +extern inline void frenchdev_led_all_set(uint8_t n); bool i2c_initialized = 0; uint8_t mcp23018_status = 0x20; @@ -31,15 +52,15 @@ void frenchdev_blink_all_leds(void) frenchdev_led_all_off(); frenchdev_led_all_set(LED_BRIGHTNESS_HI); frenchdev_led_1_on(); - _delay_ms(50); + wait_ms(50); frenchdev_led_2_on(); - _delay_ms(50); + wait_ms(50); frenchdev_led_3_on(); - _delay_ms(50); + wait_ms(50); frenchdev_led_1_off(); - _delay_ms(50); + wait_ms(50); frenchdev_led_2_off(); - _delay_ms(50); + wait_ms(50); frenchdev_led_3_off(); frenchdev_led_all_off(); } @@ -54,28 +75,28 @@ uint8_t init_mcp23018(void) { // cli(); if (i2c_initialized == 0) { i2c_init(); // on pins D(1,0) - i2c_initialized++; - _delay_ms(1000); + i2c_initialized = true;; + wait_ms(1000); } // set pin direction // - unused : input : 1 // - input : input : 1 // - driving : output : 0 - mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(IODIRA); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00000000); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00111111); if (mcp23018_status) goto out; + mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(IODIRA, I2C_TIMEOUT); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00000000, I2C_TIMEOUT); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00111111, I2C_TIMEOUT); if (mcp23018_status) goto out; i2c_stop(); // set pull-up // - unused : on : 1 // - input : on : 1 // - driving : off : 0 - mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(GPPUA); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00000000); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00111111); if (mcp23018_status) goto out; + mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(GPPUA, I2C_TIMEOUT); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00000000, I2C_TIMEOUT); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00111111, I2C_TIMEOUT); if (mcp23018_status) goto out; out: i2c_stop(); @@ -84,4 +105,3 @@ out: return mcp23018_status; } - diff --git a/keyboards/handwired/frenchdev/frenchdev.h b/keyboards/handwired/frenchdev/frenchdev.h index 82dbe18b89..1df3990887 100644 --- a/keyboards/handwired/frenchdev/frenchdev.h +++ b/keyboards/handwired/frenchdev/frenchdev.h @@ -1,10 +1,9 @@ -#ifndef FRENCHDEV_V1_H -#define FRENCHDEV_V1_H +#pragma once #include "quantum.h" #include #include -#include "i2cmaster.h" +#include "i2c_master.h" #include #define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n)) @@ -24,6 +23,7 @@ #define OLATB 0x15 extern uint8_t mcp23018_status; +#define I2C_TIMEOUT 100 void init_frenchdev(void); void frenchdev_blink_all_leds(void); @@ -111,5 +111,3 @@ inline void frenchdev_led_all_set(uint8_t n) { k51, k41, k31, k21, k11, k01 }, \ { k50, k40, k30, k20, k10, KC_NO } \ } - -#endif diff --git a/keyboards/handwired/frenchdev/i2cmaster.h b/keyboards/handwired/frenchdev/i2cmaster.h deleted file mode 100644 index 3917b9e6c0..0000000000 --- a/keyboards/handwired/frenchdev/i2cmaster.h +++ /dev/null @@ -1,178 +0,0 @@ -#ifndef _I2CMASTER_H -#define _I2CMASTER_H 1 -/************************************************************************* -* Title: C include file for the I2C master interface -* (i2cmaster.S or twimaster.c) -* Author: Peter Fleury http://jump.to/fleury -* File: $Id: i2cmaster.h,v 1.10 2005/03/06 22:39:57 Peter Exp $ -* Software: AVR-GCC 3.4.3 / avr-libc 1.2.3 -* Target: any AVR device -* Usage: see Doxygen manual -**************************************************************************/ - -#ifdef DOXYGEN -/** - @defgroup pfleury_ic2master I2C Master library - @code #include @endcode - - @brief I2C (TWI) Master Software Library - - Basic routines for communicating with I2C slave devices. This single master - implementation is limited to one bus master on the I2C bus. - - This I2c library is implemented as a compact assembler software implementation of the I2C protocol - which runs on any AVR (i2cmaster.S) and as a TWI hardware interface for all AVR with built-in TWI hardware (twimaster.c). - Since the API for these two implementations is exactly the same, an application can be linked either against the - software I2C implementation or the hardware I2C implementation. - - Use 4.7k pull-up resistor on the SDA and SCL pin. - - Adapt the SCL and SDA port and pin definitions and eventually the delay routine in the module - i2cmaster.S to your target when using the software I2C implementation ! - - Adjust the CPU clock frequence F_CPU in twimaster.c or in the Makfile when using the TWI hardware implementaion. - - @note - The module i2cmaster.S is based on the Atmel Application Note AVR300, corrected and adapted - to GNU assembler and AVR-GCC C call interface. - Replaced the incorrect quarter period delays found in AVR300 with - half period delays. - - @author Peter Fleury pfleury@gmx.ch http://jump.to/fleury - - @par API Usage Example - The following code shows typical usage of this library, see example test_i2cmaster.c - - @code - - #include - - - #define Dev24C02 0xA2 // device address of EEPROM 24C02, see datasheet - - int main(void) - { - unsigned char ret; - - i2c_init(); // initialize I2C library - - // write 0x75 to EEPROM address 5 (Byte Write) - i2c_start_wait(Dev24C02+I2C_WRITE); // set device address and write mode - i2c_write(0x05); // write address = 5 - i2c_write(0x75); // write value 0x75 to EEPROM - i2c_stop(); // set stop conditon = release bus - - - // read previously written value back from EEPROM address 5 - i2c_start_wait(Dev24C02+I2C_WRITE); // set device address and write mode - - i2c_write(0x05); // write address = 5 - i2c_rep_start(Dev24C02+I2C_READ); // set device address and read mode - - ret = i2c_readNak(); // read one byte from EEPROM - i2c_stop(); - - for(;;); - } - @endcode - -*/ -#endif /* DOXYGEN */ - -/**@{*/ - -#if (__GNUC__ * 100 + __GNUC_MINOR__) < 304 -#error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !" -#endif - -#include - -/** defines the data direction (reading from I2C device) in i2c_start(),i2c_rep_start() */ -#define I2C_READ 1 - -/** defines the data direction (writing to I2C device) in i2c_start(),i2c_rep_start() */ -#define I2C_WRITE 0 - - -/** - @brief initialize the I2C master interace. Need to be called only once - @param void - @return none - */ -extern void i2c_init(void); - - -/** - @brief Terminates the data transfer and releases the I2C bus - @param void - @return none - */ -extern void i2c_stop(void); - - -/** - @brief Issues a start condition and sends address and transfer direction - - @param addr address and transfer direction of I2C device - @retval 0 device accessible - @retval 1 failed to access device - */ -extern unsigned char i2c_start(unsigned char addr); - - -/** - @brief Issues a repeated start condition and sends address and transfer direction - - @param addr address and transfer direction of I2C device - @retval 0 device accessible - @retval 1 failed to access device - */ -extern unsigned char i2c_rep_start(unsigned char addr); - - -/** - @brief Issues a start condition and sends address and transfer direction - - If device is busy, use ack polling to wait until device ready - @param addr address and transfer direction of I2C device - @return none - */ -extern void i2c_start_wait(unsigned char addr); - - -/** - @brief Send one byte to I2C device - @param data byte to be transfered - @retval 0 write successful - @retval 1 write failed - */ -extern unsigned char i2c_write(unsigned char data); - - -/** - @brief read one byte from the I2C device, request more data from device - @return byte read from I2C device - */ -extern unsigned char i2c_readAck(void); - -/** - @brief read one byte from the I2C device, read is followed by a stop condition - @return byte read from I2C device - */ -extern unsigned char i2c_readNak(void); - -/** - @brief read one byte from the I2C device - - Implemented as a macro, which calls either i2c_readAck or i2c_readNak - - @param ack 1 send ack, request more data from device
- 0 send nak, read is followed by a stop condition - @return byte read from I2C device - */ -extern unsigned char i2c_read(unsigned char ack); -#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); - - -/**@}*/ -#endif diff --git a/keyboards/handwired/frenchdev/keymaps/default/keymap.c b/keyboards/handwired/frenchdev/keymaps/default/keymap.c index 506383a1bb..7b82f36e36 100644 --- a/keyboards/handwired/frenchdev/keymaps/default/keymap.c +++ b/keyboards/handwired/frenchdev/keymaps/default/keymap.c @@ -1,5 +1,4 @@ #include QMK_KEYBOARD_H -#include "mousekey.h" #include "keymap_bepo.h" @@ -14,7 +13,7 @@ #define KEY_DELAY 130 enum macros { - M_LP, // left pedal + M_LP = SAFE_RANGE, // left pedal M_RP, // right pedal M_SF, // shift M_SFS, // shift and space @@ -63,19 +62,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------| / |------| , | space|------|------|------ .. ------|------|------| L1/sp| LEFT |------| UP |------+------| * * | CTRL | win |------/ \-------------| L1 | alt | .. | CAPS | L1 |-------------/ \------| : | CTRL | * * `-------------/ \-------------/ .. \-------------/ \-------------/ * - *M(M_LP) */ [_BASE] = LAYOUT( 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_ESC, BP_DQOT, BP_LGIL, BP_RGIL, BP_LPRN, BP_RPRN, BP_DTRM, BP_DCRC, BP_AT, BP_PLUS, BP_MINS, BP_SLSH, BP_ASTR, KC_BSPC, \ KC_TAB, BP_B, BP_ECUT, BP_O, BP_P, BP_EGRV, BP_UNDS, BP_EQL, BP_K, BP_V, BP_D, BP_L, BP_J, KC_ENT, \ BP_GRV, BP_A, BP_U, BP_E, BP_I, BP_F, BP_SCLN, BP_EXLM, BP_C, BP_T, BP_S, BP_R, BP_N, BP_APOS, \ - M(M_SF), BP_Z, BP_AGRV, BP_Y, BP_X, KC_RBRACKET, M(M_SFS), BP_CBSP, M(L2INS), M(L2LOC), BP_CDEL, M(M_SFS),BP_M, BP_G, KC_UP, BP_H, BP_Q, M(M_SF), \ - KC_LCTL, KC_LGUI, KC_PSLS, BP_DOT, BP_COMM, KC_SPACE,M(M_L1E), KC_LALT, KC_CAPS, M(M_L1E),KC_SPACE,KC_LEFT, KC_DOWN, KC_RIGHT,BP_COLN, KC_RCTL, \ + M_SF, BP_Z, BP_AGRV, BP_Y, BP_X, KC_RBRC, M_SFS, BP_CBSP, L2INS, L2LOC, BP_CDEL, M_SFS, BP_M, BP_G, KC_UP, BP_H, BP_Q, M_SF, \ + KC_LCTL, KC_LGUI, KC_PSLS, BP_DOT, BP_COMM, KC_SPACE,M_L1E, KC_LALT, KC_CAPS, M_L1E, KC_SPACE, KC_LEFT, KC_DOWN, KC_RIGHT,BP_COLN, KC_RCTL, \ //left pedals - M(M_LP), M(M_RP), KC_TRNS, \ + M_LP, M_RP, KC_TRNS, \ //right pedals - M(M_LP), M(M_RP), KC_TRNS \ + M_LP, M_RP, KC_TRNS \ ), /* Larer 1 for symbols. @@ -102,7 +100,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, BP_DCUR, BP_PARG, BP_SECT, BP_DGRK, KC_TRNS, BP_TILD, BP_DCAR, BP_LEQL, BP_GEQL, BP_PSMS, BP_OBEL, BP_TIMS, KC_TRNS, \ KC_TRNS, BP_BSLS, BP_ASTR, BP_LCBR, BP_RCBR, BP_GRV, KC_TRNS, BP_DIFF, BP_HASH, BP_LBRC, BP_RBRC, BP_PERC, BP_PMIL, KC_TRNS, \ KC_TRNS, BP_EQL, BP_UGRV, BP_LPRN, BP_RPRN, BP_PLUS, BP_COLN, BP_QEST, BP_CCED, BP_LESS, BP_GRTR, BP_AMPR, BP_UNDS, KC_TRNS, \ - KC_TRNS, M(M_UN), M(M_CUT),M(M_CP), M(M_PS), M(M_SE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BP_DLR, BP_EQL, KC_PGUP, BP_PIPE, BP_SLSH, KC_TRNS, \ + KC_TRNS, M_UN, M_CUT, M_CP, M_PS, M_SE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BP_DLR, BP_EQL, KC_PGUP, BP_PIPE, BP_SLSH, KC_TRNS, \ KC_TRNS, KC_TRNS, BP_BSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END, KC_TRNS, KC_TRNS, \ //left pedals KC_TRNS, KC_BTN1, KC_TRNS, \ @@ -134,12 +132,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_MSTP, KC_MPRV, KC_MNXT, KC_MPLY, KC_MPLY, KC_MPRV, KC_MNXT, KC_MSTP, KC_TRNS, KC_PMNS, KC_TRNS, \ KC_TRNS, KC_TRNS, KC_TRNS, KC_WH_U, KC_TRNS, KC_BTN4, KC_BTN5, KC_BTN4, KC_BTN5, KC_KP_7, KC_KP_8, KC_KP_9, KC_PPLS, KC_TRNS, \ KC_TRNS, KC_TRNS, KC_TRNS, KC_WH_D, KC_BTN3, KC_BTN2, KC_BTN1, KC_BTN1, KC_BTN2, KC_KP_4, KC_KP_5, KC_KP_6, KC_PAST, KC_TRNS, \ - KC_TRNS, M(M_UN), M(M_CUT),M(M_CP), M(M_PS), KC_BTN3, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN3, KC_KP_1, KC_KP_2, KC_KP_3, KC_PSLS, KC_TRNS, \ + KC_TRNS, M_UN, M_CUT, M_CP, M_PS, KC_BTN3, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN3, KC_KP_1, KC_KP_2, KC_KP_3, KC_PSLS, KC_TRNS, \ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_KP_0, KC_PDOT, BP_DOT, BP_COMM, KC_TRNS, \ //left pedals - KC_BTN3, M(M_RP), KC_TRNS, \ + KC_BTN3, M_RP, KC_TRNS, \ //right pedals - KC_BTN3, M(M_RP), KC_TRNS \ + KC_BTN3, M_RP, KC_TRNS \ ), /* TRNS - skeleton for laters @@ -169,9 +167,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ //left pedals - KC_BTN3, M(M_RP), KC_TRNS, \ + KC_BTN3, M_RP, KC_TRNS, \ //right pedals - KC_BTN3, M(M_RP), KC_TRNS \ + KC_BTN3, M_RP, KC_TRNS \ ), }; @@ -191,28 +189,52 @@ void release_shift(void) { void press_space(void) { if(shift_count > 0) unregister_code (KC_LSHIFT); - register_code (KC_SPACE); - unregister_code (KC_SPACE); + tap_code(KC_SPACE); if(shift_count > 0) register_code (KC_LSHIFT); } void press_enter(void) { if(shift_count > 0) unregister_code (KC_LSHIFT); - register_code (KC_ENT); - unregister_code (KC_ENT); + tap_code (KC_ENT); if(shift_count > 0) register_code (KC_LSHIFT); } void press_underscore(void) { if(shift_count > 0) unregister_code (KC_LSHIFT); - register_code ((unsigned char) BP_UNDS); - unregister_code ((unsigned char) BP_UNDS); + tap_code ((unsigned char) BP_UNDS); if(shift_count > 0) register_code (KC_LSHIFT); } -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - switch(id) { +void matrix_init_user(void) { +} + +// Bleah globals need to be initialized. +uint8_t old_layer=_BASE; + +void matrix_scan_user(void) { + uint8_t layer = biton32(layer_state); + + frenchdev_led_1_off(); + frenchdev_led_2_off(); + switch (layer) { + case _BASE: + frenchdev_led_2_on(); + break; + case _SYMBOLS: + frenchdev_led_1_on(); + break; + case _MEDIA: + frenchdev_led_1_on(); + frenchdev_led_2_on(); + default: + // none + break; + } +} + + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch(keycode) { case M_LP: //left pedal if (record->event.pressed) { layer_on(1); @@ -220,25 +242,19 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) key_timer_left_pedal = timer_read(); // if the key is being pressed, we start the timer. } else { if (timer_elapsed(key_timer_left_pedal) < KEY_DELAY) { - mousekey_on (KC_BTN2); - mousekey_send(); - mousekey_off (KC_BTN2); - mousekey_send(); + tap_code (KC_BTN2); } unregister_code (KC_SLCK); layer_off(1); } - break; + break; case M_RP: //right pedal if (record->event.pressed) { layer_on(2); key_timer_right_pedal = timer_read(); // if the key is being pressed, we start the timer. } else { if (timer_elapsed(key_timer_right_pedal) < PEDAL_DELAY) { - mousekey_on (KC_BTN1); - mousekey_send(); - mousekey_off (KC_BTN1); - mousekey_send(); + tap_code (KC_BTN1); } layer_off(2); } @@ -289,13 +305,12 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) key_timer_2 = timer_read(); // if the key is being pressed, we start the timer. } else { if (timer_elapsed(key_timer_2) < KEY_DELAY) { - register_code (KC_INS); - unregister_code (KC_INS); + tap_code (KC_INS); } l2_locked = 0; layer_off(2); } - break; + break; case L2LOC: //lock L2 if (record->event.pressed) { key_timer_2 = timer_read(); // if the key is being pressed, we start the timer. @@ -309,80 +324,33 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) layer_off(2); } } - break; + break; case M_UN: // undo if (record->event.pressed) { - register_code(KC_LCTL); - register_code(BP_Z); - unregister_code(BP_Z); - unregister_code(KC_LCTL); + tap_code16(C(BP_Z)); } - break; + break; case M_CUT: // cut if (record->event.pressed) { - register_code(KC_LCTL); - register_code(BP_X); - unregister_code(BP_X); - unregister_code(KC_LCTL); + tap_code16(C(BP_X)); } - break; + break; case M_CP: // copy if (record->event.pressed) { - register_code(KC_LCTL); - register_code(BP_C); - unregister_code(BP_C); - unregister_code(KC_LCTL); + tap_code16(C(BP_C)); } - break; + break; case M_PS: // paste if (record->event.pressed) { - register_code(KC_LCTL); - register_code(BP_V); - unregister_code(BP_V); - unregister_code(KC_LCTL); + tap_code16(C(BP_V)); } - break; + break; case M_SE: // search if (record->event.pressed) { - register_code(KC_LCTL); - register_code(BP_F); - unregister_code(BP_F); - unregister_code(KC_LCTL); + tap_code16(C(BP_F)); } - break; + break; } - return MACRO_NONE; -}; - -void matrix_init_user(void) { -} - -// Bleah globals need to be initialized. -uint8_t old_layer=_BASE; - -void matrix_scan_user(void) { - uint8_t layer = biton32(layer_state); - - frenchdev_led_1_off(); - frenchdev_led_2_off(); - switch (layer) { - case _BASE: - frenchdev_led_2_on(); - break; - case _SYMBOLS: - frenchdev_led_1_on(); - break; - case _MEDIA: - frenchdev_led_1_on(); - frenchdev_led_2_on(); - default: - // none - break; - } -} - - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; } diff --git a/keyboards/handwired/frenchdev/matrix.c b/keyboards/handwired/frenchdev/matrix.c index 7fe3d0bbf2..4263555e95 100644 --- a/keyboards/handwired/frenchdev/matrix.c +++ b/keyboards/handwired/frenchdev/matrix.c @@ -40,7 +40,6 @@ along with this program. If not, see . #include "util.h" #include "matrix.h" #include "frenchdev.h" -#include "i2cmaster.h" #ifdef DEBUG_MATRIX_SCAN_RATE #include "timer.h" #endif @@ -280,11 +279,12 @@ static matrix_row_t read_cols(uint8_t row) return 0; } else { uint8_t data = 0; - mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(GPIOB); if (mcp23018_status) goto out; - mcp23018_status = i2c_start(I2C_ADDR_READ); if (mcp23018_status) goto out; - data = i2c_readNak(); - data = ~data; + mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(GPIOB, I2C_TIMEOUT); if (mcp23018_status) goto out; + mcp23018_status = i2c_start(I2C_ADDR_READ, I2C_TIMEOUT); if (mcp23018_status) goto out; + data = i2c_read_nack(I2C_TIMEOUT); if (mcp23018_status < 0) goto out; + data = ~((uint8_t)mcp23018_status); + mcp23018_status = I2C_STATUS_SUCCESS; out: i2c_stop(); return data; @@ -318,11 +318,9 @@ static void unselect_rows(void) // do nothing } else { // set all rows hi-Z : 1 - mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(GPIOA); if (mcp23018_status) goto out; - mcp23018_status = i2c_write( 0xFF - & ~(0<<8) - ); if (mcp23018_status) goto out; + mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(GPIOA, I2C_TIMEOUT); if (mcp23018_status) goto out; + mcp23018_status = i2c_write( 0xFF & ~(0<<8), I2C_TIMEOUT); if (mcp23018_status) goto out; out: i2c_stop(); } @@ -346,11 +344,9 @@ static void select_row(uint8_t row) } else { // set active row low : 0 // set other rows hi-Z : 1 - mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(GPIOA); if (mcp23018_status) goto out; - mcp23018_status = i2c_write( 0xFF & ~(1< http://jump.to/fleury -* File: $Id: twimaster.c,v 1.3 2005/07/02 11:14:21 Peter Exp $ -* Software: AVR-GCC 3.4.3 / avr-libc 1.2.3 -* Target: any AVR device with hardware TWI -* Usage: API compatible with I2C Software Library i2cmaster.h -**************************************************************************/ -#include -#include - -#include - - -/* define CPU frequency in Mhz here if not defined in Makefile */ -#ifndef F_CPU -#define F_CPU 16000000UL -#endif - -/* I2C clock in Hz */ -#define SCL_CLOCK 400000L - - -/************************************************************************* - Initialization of the I2C bus interface. Need to be called only once -*************************************************************************/ -void i2c_init(void) -{ - /* initialize TWI clock - * minimal values in Bit Rate Register (TWBR) and minimal Prescaler - * bits in the TWI Status Register should give us maximal possible - * I2C bus speed - about 444 kHz - * - * for more details, see 20.5.2 in ATmega16/32 secification - */ - - TWSR = 0; /* no prescaler */ - TWBR = 10; /* must be >= 10 for stable operation */ - -}/* i2c_init */ - - -/************************************************************************* - Issues a start condition and sends address and transfer direction. - return 0 = device accessible, 1= failed to access device -*************************************************************************/ -unsigned char i2c_start(unsigned char address) -{ - uint8_t twst; - - // send START condition - TWCR = (1< Date: Mon, 22 Apr 2019 17:26:41 +0200 Subject: [PATCH 44/61] Define RGB colors (#5300) * Define RGB colors Define RGB colors and pass them to the rgblight functions, instead of defining multiple macros. * Add new color definitions support for RGB Matrix * Add/clarify info about new color definitions in Docs * Add deprecation warning banner to rgblight_list.h --- docs/feature_rgb_matrix.md | 29 +++++ docs/feature_rgblight.md | 35 +++++- quantum/rgb_matrix.h | 1 + quantum/rgblight_list.h | 240 ++++++++++++++++++++++--------------- 4 files changed, 210 insertions(+), 95 deletions(-) diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index acef4717dd..5309e749cb 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -236,6 +236,35 @@ void rgb_matrix_indicators_kb(void) { A similar function works in the keymap as `rgb_matrix_indicators_user`. + +## Colors + +These are shorthands to popular colors. The `RGB` ones can be passed to the `setrgb` functions, while the `HSV` ones to the `sethsv` functions. + +|RGB |HSV | +|-------------------|-------------------| +|`RGB_WHITE` |`HSV_WHITE` | +|`RGB_RED` |`HSV_RED` | +|`RGB_CORAL` |`HSV_CORAL` | +|`RGB_ORANGE` |`HSV_ORANGE` | +|`RGB_GOLDENROD` |`HSV_GOLDENROD` | +|`RGB_GOLD` |`HSV_GOLD` | +|`RGB_YELLOW` |`HSV_YELLOW` | +|`RGB_CHARTREUSE` |`HSV_CHARTREUSE` | +|`RGB_GREEN` |`HSV_GREEN` | +|`RGB_SPRINGGREEN` |`HSV_SPRINGGREEN` | +|`RGB_TURQUOISE` |`HSV_TURQUOISE` | +|`RGB_TEAL` |`HSV_TEAL` | +|`RGB_CYAN` |`HSV_CYAN` | +|`RGB_AZURE` |`HSV_AZURE` | +|`RGB_BLUE` |`HSV_BLUE` | +|`RGB_PURPLE` |`HSV_PURPLE` | +|`RGB_MAGENTA` |`HSV_MAGENTA` | +|`RGB_PINK` |`HSV_PINK` | + +These are defined in [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h). Feel free to add to this list! + + ## Additional `config.h` Options ```C diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md index 97a9959946..48277373a5 100644 --- a/docs/feature_rgblight.md +++ b/docs/feature_rgblight.md @@ -191,7 +191,40 @@ If you need to change your RGB lighting in code, for example in a macro to chang |`rgblight_decrease_val_noeeprom()` |Decrease the value for all LEDs. This wraps around at minimum value (not written to EEPROM) | |`rgblight_set_clipping_range(pos, num)` |Set clipping Range | -Additionally, [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h) defines several predefined shortcuts for various colors. Feel free to add to this list! +## Colors + +These are shorthands to popular colors. The `RGB` ones can be passed to the `setrgb` functions, while the `HSV` ones to the `sethsv` functions. + +|RGB |HSV | +|-------------------|-------------------| +|`RGB_WHITE` |`HSV_WHITE` | +|`RGB_RED` |`HSV_RED` | +|`RGB_CORAL` |`HSV_CORAL` | +|`RGB_ORANGE` |`HSV_ORANGE` | +|`RGB_GOLDENROD` |`HSV_GOLDENROD` | +|`RGB_GOLD` |`HSV_GOLD` | +|`RGB_YELLOW` |`HSV_YELLOW` | +|`RGB_CHARTREUSE` |`HSV_CHARTREUSE` | +|`RGB_GREEN` |`HSV_GREEN` | +|`RGB_SPRINGGREEN` |`HSV_SPRINGGREEN` | +|`RGB_TURQUOISE` |`HSV_TURQUOISE` | +|`RGB_TEAL` |`HSV_TEAL` | +|`RGB_CYAN` |`HSV_CYAN` | +|`RGB_AZURE` |`HSV_AZURE` | +|`RGB_BLUE` |`HSV_BLUE` | +|`RGB_PURPLE` |`HSV_PURPLE` | +|`RGB_MAGENTA` |`HSV_MAGENTA` | +|`RGB_PINK` |`HSV_PINK` | + +```c +rgblight_setrgb(RGB_ORANGE); +rgblight_sethsv_noeeprom(HSV_GREEN); +rgblight_setrgb_at(RGB_GOLD, 3); +rgblight_sethsv_range(HSV_WHITE, 0, 6); +``` + +These are defined in [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h). Feel free to add to this list! + ## Changing the order of the LEDs diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h index 0a11f26920..f5be494354 100644 --- a/quantum/rgb_matrix.h +++ b/quantum/rgb_matrix.h @@ -24,6 +24,7 @@ #include "rgb_matrix_types.h" #include "color.h" #include "quantum.h" +#include "rgblight_list.h" #ifdef IS31FL3731 #include "is31fl3731.h" diff --git a/quantum/rgblight_list.h b/quantum/rgblight_list.h index 407fd8e9d3..7b83133808 100644 --- a/quantum/rgblight_list.h +++ b/quantum/rgblight_list.h @@ -13,111 +13,163 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef RGBLIGHT_LIST_H -#define RGBLIGHT_LIST_H +#pragma once + +/* RGB COLORS */ +#define RGB_WHITE 0xFF, 0xFF, 0xFF +#define RGB_RED 0xFF, 0x00, 0x00 +#define RGB_CORAL 0xFF, 0x7C, 0x4D +#define RGB_ORANGE 0xFF, 0x80, 0x00 +#define RGB_GOLDENROD 0xD9, 0xA5, 0x21 +#define RGB_GOLD 0xFF, 0xD9, 0x00 +#define RGB_YELLOW 0xFF, 0xFF, 0x00 +#define RGB_CHARTREUSE 0x80, 0xFF, 0x00 +#define RGB_GREEN 0x00, 0xFF, 0x00 +#define RGB_SPRINGGREEN 0x00, 0xFF, 0x80 +#define RGB_TURQUOISE 0x47, 0x6E, 0x6A +#define RGB_TEAL 0x00, 0x80, 0x80 +#define RGB_CYAN 0x00, 0xFF, 0xFF +#define RGB_AZURE 0x99, 0xf5, 0xFF +#define RGB_BLUE 0x00, 0x00, 0xFF +#define RGB_PURPLE 0x7A, 0x00, 0xFF +#define RGB_MAGENTA 0xFF, 0x00, 0xFF +#define RGB_PINK 0xFF, 0x80, 0xBF + +/* HSV COLORS */ +#define HSV_WHITE 0, 0, 255 +#define HSV_RED 0, 255, 255 +#define HSV_CORAL 16, 176, 255 +#define HSV_ORANGE 39, 255, 255 +#define HSV_GOLDENROD 43, 218, 218 +#define HSV_GOLD 51, 255, 255 +#define HSV_YELLOW 60, 255, 255 +#define HSV_CHARTREUSE 90, 255, 255 +#define HSV_GREEN 120, 255, 255 +#define HSV_SPRINGGREEN 150, 255, 255 +#define HSV_TURQUOISE 174, 90, 112 +#define HSV_TEAL 180, 255, 128 +#define HSV_CYAN 180, 255, 255 +#define HSV_AZURE 186, 102, 255 +#define HSV_BLUE 240, 255, 255 +#define HSV_PURPLE 270, 255, 255 +#define HSV_MAGENTA 300, 255, 255 +#define HSV_PINK 330, 128, 255 + + +/* +######################################################################################## +## ## +## ## +## ## +## The functions below have been deprecated and may be removed in a future release. ## +## ## +## Please use the values above with the RGB functions. ## +## ## +## ## +## ## +######################################################################################## +*/ /* SET RGB List */ -#define rgblight_setrgb_white() rgblight_setrgb (0xFF, 0xFF, 0xFF) -#define rgblight_setrgb_red() rgblight_setrgb (0xFF, 0x00, 0x00) -#define rgblight_setrgb_coral() rgblight_setrgb (0xFF, 0x7C, 0x4D) -#define rgblight_setrgb_orange() rgblight_setrgb (0xFF, 0x80, 0x00) -#define rgblight_setrgb_goldenrod() rgblight_setrgb (0xD9, 0xA5, 0x21) -#define rgblight_setrgb_gold() rgblight_setrgb (0xFF, 0xD9, 0x00) -#define rgblight_setrgb_yellow() rgblight_setrgb (0xFF, 0xFF, 0x00) -#define rgblight_setrgb_chartreuse() rgblight_setrgb (0x80, 0xFF, 0x00) -#define rgblight_setrgb_green() rgblight_setrgb (0x00, 0xFF, 0x00) -#define rgblight_setrgb_springgreen() rgblight_setrgb (0x00, 0xFF, 0x80) -#define rgblight_setrgb_turquoise() rgblight_setrgb (0x47, 0x6E, 0x6A) -#define rgblight_setrgb_teal() rgblight_setrgb (0x00, 0x80, 0x80) -#define rgblight_setrgb_cyan() rgblight_setrgb (0x00, 0xFF, 0xFF) -#define rgblight_setrgb_azure() rgblight_setrgb (0x99, 0xf5, 0xFF) -#define rgblight_setrgb_blue() rgblight_setrgb (0x00, 0x00, 0xFF) -#define rgblight_setrgb_purple() rgblight_setrgb (0x7A, 0x00, 0xFF) -#define rgblight_setrgb_magenta() rgblight_setrgb (0xFF, 0x00, 0xFF) -#define rgblight_setrgb_pink() rgblight_setrgb (0xFF, 0x80, 0xBF) +#define rgblight_setrgb_white() rgblight_setrgb (RGB_WHITE) +#define rgblight_setrgb_red() rgblight_setrgb (RGB_RED) +#define rgblight_setrgb_coral() rgblight_setrgb (RGB_CORAL) +#define rgblight_setrgb_orange() rgblight_setrgb (RGB_ORANGE) +#define rgblight_setrgb_goldenrod() rgblight_setrgb (RGB_GOLDENROD) +#define rgblight_setrgb_gold() rgblight_setrgb (RGB_GOLD) +#define rgblight_setrgb_yellow() rgblight_setrgb (RGB_YEllOW) +#define rgblight_setrgb_chartreuse() rgblight_setrgb (RGB_CHARTREUSE) +#define rgblight_setrgb_green() rgblight_setrgb (RGB_GREEN) +#define rgblight_setrgb_springgreen() rgblight_setrgb (RGB_SPRINGGREEN) +#define rgblight_setrgb_turquoise() rgblight_setrgb (RGB_TURQUOISE) +#define rgblight_setrgb_teal() rgblight_setrgb (RGB_TEAL) +#define rgblight_setrgb_cyan() rgblight_setrgb (RGB_CYAN) +#define rgblight_setrgb_azure() rgblight_setrgb (RGB_AZURE) +#define rgblight_setrgb_blue() rgblight_setrgb (RGB_BLUE) +#define rgblight_setrgb_purple() rgblight_setrgb (RGB_PURPLE) +#define rgblight_setrgb_magenta() rgblight_setrgb (RGB_MAGENTA) +#define rgblight_setrgb_pink() rgblight_setrgb (RGB_PINK) /* SET RGB List */ -#define rgblight_setrgb_white_at(at) rgblight_setrgb_at (0xFF, 0xFF, 0xFF, at) -#define rgblight_setrgb_red_at(at) rgblight_setrgb_at (0xFF, 0x00, 0x00, at) -#define rgblight_setrgb_coral_at(at) rgblight_setrgb_at (0xFF, 0x7C, 0x4D, at) -#define rgblight_setrgb_orange_at(at) rgblight_setrgb_at (0xFF, 0x80, 0x00, at) -#define rgblight_setrgb_goldenrod_at(at) rgblight_setrgb_at (0xD9, 0xA5, 0x21, at) -#define rgblight_setrgb_gold_at(at) rgblight_setrgb_at (0xFF, 0xD9, 0x00, at) -#define rgblight_setrgb_yellow_at(at) rgblight_setrgb_at (0xFF, 0xFF, 0x00, at) -#define rgblight_setrgb_chartreuse_at(at) rgblight_setrgb_at (0x80, 0xFF, 0x00, at) -#define rgblight_setrgb_green_at(at) rgblight_setrgb_at (0x00, 0xFF, 0x00, at) -#define rgblight_setrgb_springgreen_at(at) rgblight_setrgb_at (0x00, 0xFF, 0x80, at) -#define rgblight_setrgb_turquoise_at(at) rgblight_setrgb_at (0x47, 0x6E, 0x6A, at) -#define rgblight_setrgb_teal_at(at) rgblight_setrgb_at (0x00, 0x80, 0x80, at) -#define rgblight_setrgb_cyan_at(at) rgblight_setrgb_at (0x00, 0xFF, 0xFF, at) -#define rgblight_setrgb_azure_at(at) rgblight_setrgb_at (0x99, 0xf5, 0xFF, at) -#define rgblight_setrgb_blue_at(at) rgblight_setrgb_at (0x00, 0x00, 0xFF, at) -#define rgblight_setrgb_purple_at(at) rgblight_setrgb_at (0x7A, 0x00, 0xFF, at) -#define rgblight_setrgb_magenta_at(at) rgblight_setrgb_at (0xFF, 0x00, 0xFF, at) -#define rgblight_setrgb_pink_at(at) rgblight_setrgb_at (0xFF, 0x80, 0xBF, at) +#define rgblight_setrgb_white_at(at) rgblight_setrgb_at (RGB_WHITE, at) +#define rgblight_setrgb_red_at(at) rgblight_setrgb_at (RGB_RED, at) +#define rgblight_setrgb_coral_at(at) rgblight_setrgb_at (RGB_CORAL, at) +#define rgblight_setrgb_orange_at(at) rgblight_setrgb_at (RGB_ORANGE at) +#define rgblight_setrgb_goldenrod_at(at) rgblight_setrgb_at (RGB_GOLDENROD, at) +#define rgblight_setrgb_gold_at(at) rgblight_setrgb_at (RGB_GOLD, at) +#define rgblight_setrgb_yellow_at(at) rgblight_setrgb_at (RGB_YELLOW, at) +#define rgblight_setrgb_chartreuse_at(at) rgblight_setrgb_at (RGB_CHARTREUSE, at) +#define rgblight_setrgb_green_at(at) rgblight_setrgb_at (RGB_GREEN, at) +#define rgblight_setrgb_springgreen_at(at) rgblight_setrgb_at (RGB_SPRINGGREEN, at) +#define rgblight_setrgb_turquoise_at(at) rgblight_setrgb_at (RGB_TURQUOISE, at) +#define rgblight_setrgb_teal_at(at) rgblight_setrgb_at (RGB_TEAL, at) +#define rgblight_setrgb_cyan_at(at) rgblight_setrgb_at (RGB_CYAN, at) +#define rgblight_setrgb_azure_at(at) rgblight_setrgb_at (RGB_AZURE, at) +#define rgblight_setrgb_blue_at(at) rgblight_setrgb_at (RGB_BLUE, at) +#define rgblight_setrgb_purple_at(at) rgblight_setrgb_at (RGB_PURPLE, at) +#define rgblight_setrgb_magenta_at(at) rgblight_setrgb_at (RGB_MAGENTA, at) +#define rgblight_setrgb_pink_at(at) rgblight_setrgb_at (RGB_PINK, at) /* SET HSV List */ -#define rgblight_sethsv_white() rgblight_sethsv ( 0, 0, 255) -#define rgblight_sethsv_red() rgblight_sethsv ( 0, 255, 255) -#define rgblight_sethsv_coral() rgblight_sethsv ( 16, 176, 255) -#define rgblight_sethsv_orange() rgblight_sethsv ( 39, 255, 255) -#define rgblight_sethsv_goldenrod() rgblight_sethsv ( 43, 218, 218) -#define rgblight_sethsv_gold() rgblight_sethsv ( 51, 255, 255) -#define rgblight_sethsv_yellow() rgblight_sethsv ( 60, 255, 255) -#define rgblight_sethsv_chartreuse() rgblight_sethsv ( 90, 255, 255) -#define rgblight_sethsv_green() rgblight_sethsv (120, 255, 255) -#define rgblight_sethsv_springgreen() rgblight_sethsv (150, 255, 255) -#define rgblight_sethsv_turquoise() rgblight_sethsv (174, 90, 112) -#define rgblight_sethsv_teal() rgblight_sethsv (180, 255, 128) -#define rgblight_sethsv_cyan() rgblight_sethsv (180, 255, 255) -#define rgblight_sethsv_azure() rgblight_sethsv (186, 102, 255) -#define rgblight_sethsv_blue() rgblight_sethsv (240, 255, 255) -#define rgblight_sethsv_purple() rgblight_sethsv (270, 255, 255) -#define rgblight_sethsv_magenta() rgblight_sethsv (300, 255, 255) -#define rgblight_sethsv_pink() rgblight_sethsv (330, 128, 255) +#define rgblight_sethsv_white() rgblight_sethsv (HSV_WHITE) +#define rgblight_sethsv_red() rgblight_sethsv (HSV_RED) +#define rgblight_sethsv_coral() rgblight_sethsv (HSV_CORAL) +#define rgblight_sethsv_orange() rgblight_sethsv (HSV_ORANGE) +#define rgblight_sethsv_goldenrod() rgblight_sethsv (HSV_GOLDENROD) +#define rgblight_sethsv_gold() rgblight_sethsv (HSV_GOLD) +#define rgblight_sethsv_yellow() rgblight_sethsv (HSV_YELLOW) +#define rgblight_sethsv_chartreuse() rgblight_sethsv (HSV_CHARTREUSE) +#define rgblight_sethsv_green() rgblight_sethsv (HSV_GREEN) +#define rgblight_sethsv_springgreen() rgblight_sethsv (HSV_SPRINGGREEN) +#define rgblight_sethsv_turquoise() rgblight_sethsv (HSV_TURQUOISE) +#define rgblight_sethsv_teal() rgblight_sethsv (HSV_TEAL) +#define rgblight_sethsv_cyan() rgblight_sethsv (HSV_CYAN) +#define rgblight_sethsv_azure() rgblight_sethsv (HSV_AZURE) +#define rgblight_sethsv_blue() rgblight_sethsv (HSV_BLUE) +#define rgblight_sethsv_purple() rgblight_sethsv (HSV_PURPLE) +#define rgblight_sethsv_magenta() rgblight_sethsv (HSV_MAGENTA) +#define rgblight_sethsv_pink() rgblight_sethsv (HSV_PINK) /* SET HSV List */ /* If you're doing layer indication, this is best, as it won't */ /* write to the eeprom, since it's limited (very high value). */ /* If you want to use modes with this (since you can), then you */ /* want to use rgblight_mode_noeeprom(x) instead. */ -#define rgblight_sethsv_noeeprom_white() rgblight_sethsv_noeeprom ( 0, 0, 255) -#define rgblight_sethsv_noeeprom_red() rgblight_sethsv_noeeprom ( 0, 255, 255) -#define rgblight_sethsv_noeeprom_coral() rgblight_sethsv_noeeprom ( 16, 176, 255) -#define rgblight_sethsv_noeeprom_orange() rgblight_sethsv_noeeprom ( 39, 255, 255) -#define rgblight_sethsv_noeeprom_goldenrod() rgblight_sethsv_noeeprom ( 43, 218, 218) -#define rgblight_sethsv_noeeprom_gold() rgblight_sethsv_noeeprom ( 51, 255, 255) -#define rgblight_sethsv_noeeprom_yellow() rgblight_sethsv_noeeprom ( 60, 255, 255) -#define rgblight_sethsv_noeeprom_chartreuse() rgblight_sethsv_noeeprom ( 90, 255, 255) -#define rgblight_sethsv_noeeprom_green() rgblight_sethsv_noeeprom (120, 255, 255) -#define rgblight_sethsv_noeeprom_springgreen() rgblight_sethsv_noeeprom (150, 255, 255) -#define rgblight_sethsv_noeeprom_turquoise() rgblight_sethsv_noeeprom (174, 90, 112) -#define rgblight_sethsv_noeeprom_teal() rgblight_sethsv_noeeprom (180, 255, 128) -#define rgblight_sethsv_noeeprom_cyan() rgblight_sethsv_noeeprom (180, 255, 255) -#define rgblight_sethsv_noeeprom_azure() rgblight_sethsv_noeeprom (186, 102, 255) -#define rgblight_sethsv_noeeprom_blue() rgblight_sethsv_noeeprom (240, 255, 255) -#define rgblight_sethsv_noeeprom_purple() rgblight_sethsv_noeeprom (270, 255, 255) -#define rgblight_sethsv_noeeprom_magenta() rgblight_sethsv_noeeprom (300, 255, 255) -#define rgblight_sethsv_noeeprom_pink() rgblight_sethsv_noeeprom (330, 128, 255) +#define rgblight_sethsv_noeeprom_white() rgblight_sethsv_noeeprom (HSV_WHITE) +#define rgblight_sethsv_noeeprom_red() rgblight_sethsv_noeeprom (HSV_RED) +#define rgblight_sethsv_noeeprom_coral() rgblight_sethsv_noeeprom (HSV_CORAL) +#define rgblight_sethsv_noeeprom_orange() rgblight_sethsv_noeeprom (HSV_ORANGE) +#define rgblight_sethsv_noeeprom_goldenrod() rgblight_sethsv_noeeprom (HSV_GOLDENROD) +#define rgblight_sethsv_noeeprom_gold() rgblight_sethsv_noeeprom (HSV_GOLD) +#define rgblight_sethsv_noeeprom_yellow() rgblight_sethsv_noeeprom (HSV_YELLOW) +#define rgblight_sethsv_noeeprom_chartreuse() rgblight_sethsv_noeeprom (HSV_CHARTREUSE) +#define rgblight_sethsv_noeeprom_green() rgblight_sethsv_noeeprom (HSV_GREEN) +#define rgblight_sethsv_noeeprom_springgreen() rgblight_sethsv_noeeprom (HSV_SPRINGGREEN) +#define rgblight_sethsv_noeeprom_turquoise() rgblight_sethsv_noeeprom (HSV_TURQUOISE) +#define rgblight_sethsv_noeeprom_teal() rgblight_sethsv_noeeprom (HSV_TEAL) +#define rgblight_sethsv_noeeprom_cyan() rgblight_sethsv_noeeprom (HSV_CYAN) +#define rgblight_sethsv_noeeprom_azure() rgblight_sethsv_noeeprom (HSV_AZURE) +#define rgblight_sethsv_noeeprom_blue() rgblight_sethsv_noeeprom (HSV_BLUE) +#define rgblight_sethsv_noeeprom_purple() rgblight_sethsv_noeeprom (HSV_PURPLE) +#define rgblight_sethsv_noeeprom_magenta() rgblight_sethsv_noeeprom (HSV_MAGENTA) +#define rgblight_sethsv_noeeprom_pink() rgblight_sethsv_noeeprom (HSV_PINK) /* SET HSV List */ -#define rgblight_sethsv_white_at(at) rgblight_sethsv_at ( 0, 0, 255, at) -#define rgblight_sethsv_red_at(at) rgblight_sethsv_at ( 0, 255, 255, at) -#define rgblight_sethsv_coral_at(at) rgblight_sethsv_at ( 16, 176, 255, at) -#define rgblight_sethsv_orange_at(at) rgblight_sethsv_at ( 39, 255, 255, at) -#define rgblight_sethsv_goldenrod_at(at) rgblight_sethsv_at ( 43, 218, 218, at) -#define rgblight_sethsv_gold_at(at) rgblight_sethsv_at ( 51, 255, 255, at) -#define rgblight_sethsv_yellow_at(at) rgblight_sethsv_at ( 60, 255, 255, at) -#define rgblight_sethsv_chartreuse_at(at) rgblight_sethsv_at ( 90, 255, 255, at) -#define rgblight_sethsv_green_at(at) rgblight_sethsv_at (120, 255, 255, at) -#define rgblight_sethsv_springgreen_at(at) rgblight_sethsv_at (150, 255, 255, at) -#define rgblight_sethsv_turquoise_at(at) rgblight_sethsv_at (174, 90, 112, at) -#define rgblight_sethsv_teal_at(at) rgblight_sethsv_at (180, 255, 128, at) -#define rgblight_sethsv_cyan_at(at) rgblight_sethsv_at (180, 255, 255, at) -#define rgblight_sethsv_azure_at(at) rgblight_sethsv_at (186, 102, 255, at) -#define rgblight_sethsv_blue_at(at) rgblight_sethsv_at (240, 255, 255, at) -#define rgblight_sethsv_purple_at(at) rgblight_sethsv_at (270, 255, 255, at) -#define rgblight_sethsv_magenta_at(at) rgblight_sethsv_at (300, 255, 255, at) -#define rgblight_sethsv_pink_at(at) rgblight_sethsv_at (330, 128, 255, at) - -#endif +#define rgblight_sethsv_white_at(at) rgblight_sethsv_at (HSV_WHITE, at) +#define rgblight_sethsv_red_at(at) rgblight_sethsv_at (HSV_RED, at) +#define rgblight_sethsv_coral_at(at) rgblight_sethsv_at (HSV_CORAL, at) +#define rgblight_sethsv_orange_at(at) rgblight_sethsv_at (HSV_ORANGE, at) +#define rgblight_sethsv_goldenrod_at(at) rgblight_sethsv_at (HSV_GOLDENROD, at) +#define rgblight_sethsv_gold_at(at) rgblight_sethsv_at (HSV_GOLD, at) +#define rgblight_sethsv_yellow_at(at) rgblight_sethsv_at (HSV_YELLOW, at) +#define rgblight_sethsv_chartreuse_at(at) rgblight_sethsv_at (HSV_CHARTREUSE, at) +#define rgblight_sethsv_green_at(at) rgblight_sethsv_at (HSV_GREEN, at) +#define rgblight_sethsv_springgreen_at(at) rgblight_sethsv_at (HSV_SPRINGGREEN, at) +#define rgblight_sethsv_turquoise_at(at) rgblight_sethsv_at (HSV_TURQUOISE, at) +#define rgblight_sethsv_teal_at(at) rgblight_sethsv_at (HSV_TEAL, at) +#define rgblight_sethsv_cyan_at(at) rgblight_sethsv_at (HSV_CYAN, at) +#define rgblight_sethsv_azure_at(at) rgblight_sethsv_at (HSV_AZURE, at) +#define rgblight_sethsv_blue_at(at) rgblight_sethsv_at (HSV_BLUE, at) +#define rgblight_sethsv_purple_at(at) rgblight_sethsv_at (HSV_PURPLE, at) +#define rgblight_sethsv_magenta_at(at) rgblight_sethsv_at (HSV_MAGENTA, at) +#define rgblight_sethsv_pink_at(at) rgblight_sethsv_at (HSV_PINK, at) From c28a4321123131b6ff1e6c6b302fba764255623b Mon Sep 17 00:00:00 2001 From: Harshit Goel Date: Mon, 22 Apr 2019 20:58:17 +0530 Subject: [PATCH 45/61] added info.json for ymd96 (#4982) * added info.json for ymd96 * fix layout for keymap_custom macrom, correct info.json for default layout * add info layout for iso * add info layout for iso * align layout name, added maintainer username * layout case fix * layout case fix * fix overlapping keys * match layouts to keymaps. --- keyboards/ymd96/info.json | 19 +++++++++++++++++++ keyboards/ymd96/keymaps/default/keymap.c | 2 +- keyboards/ymd96/keymaps/epx/keymap.c | 2 +- keyboards/ymd96/keymaps/hgoel89/keymap.c | 6 +++--- keyboards/ymd96/ymd96.h | 10 +++++----- 5 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 keyboards/ymd96/info.json diff --git a/keyboards/ymd96/info.json b/keyboards/ymd96/info.json new file mode 100644 index 0000000000..73edfd894f --- /dev/null +++ b/keyboards/ymd96/info.json @@ -0,0 +1,19 @@ +{ + "keyboard_name": "ymd96", + "url": "", + "maintainer": "sparkyman215", + + "width": 19, + "height": 6, + "layouts": { + "LAYOUT_default": { + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":1, "y":0}, {"label":"F2", "x":2, "y":0}, {"label":"F3", "x":3, "y":0}, {"label":"F4", "x":4, "y":0}, {"label":"F5", "x":5, "y":0}, {"label":"F6", "x":6, "y":0}, {"label":"F7", "x":7, "y":0}, {"label":"F8", "x":8, "y":0}, {"label":"F9", "x":9, "y":0}, {"label":"F10", "x":10, "y":0}, {"label":"F11", "x":11, "y":0}, {"label":"F12", "x":12, "y":0}, {"label":"Print Screen", "x":13, "y":0}, {"label":"Home", "x":14, "y":0}, {"label":"End", "x":15, "y":0}, {"label":"Insert", "x":16, "y":0}, {"label":"Delete", "x":17, "y":0}, {"label":"Page Up", "x":18, "y":0}, {"label":"~", "x":0, "y":1}, {"label":"!", "x":1, "y":1}, {"label":"@", "x":2, "y":1}, {"label":"#", "x":3, "y":1}, {"label":"$", "x":4, "y":1}, {"label":"%", "x":5, "y":1}, {"label":"^", "x":6, "y":1}, {"label":"&", "x":7, "y":1}, {"label":"*", "x":8, "y":1}, {"label":"(", "x":9, "y":1}, {"label":")", "x":10, "y":1}, {"label":"_", "x":11, "y":1}, {"label":"+", "x":12, "y":1}, {"label":"Backspace", "x":13, "y":1, "w":2}, {"label":"Num Lock", "x":15, "y":1}, {"label":"/", "x":16, "y":1}, {"label":"*", "x":17, "y":1}, {"label":"PgDn", "x":18, "y":1}, {"label":"Tab", "x":0, "y":2, "w":1.5}, {"label":"Q", "x":1.5, "y":2}, {"label":"W", "x":2.5, "y":2}, {"label":"E", "x":3.5, "y":2}, {"label":"R", "x":4.5, "y":2}, {"label":"T", "x":5.5, "y":2}, {"label":"Y", "x":6.5, "y":2}, {"label":"U", "x":7.5, "y":2}, {"label":"I", "x":8.5, "y":2}, {"label":"O", "x":9.5, "y":2}, {"label":"P", "x":10.5, "y":2}, {"label":"{", "x":11.5, "y":2}, {"label":"}", "x":12.5, "y":2}, {"label":"|", "x":13.5, "y":2, "w":1.5}, {"label":"7", "x":15, "y":2}, {"label":"8", "x":16, "y":2}, {"label":"9", "x":17, "y":2}, {"label":"+", "x":18, "y":2}, {"label":"Caps Lock", "x":0, "y":3, "w":1.75}, {"label":"A", "x":1.75, "y":3}, {"label":"S", "x":2.75, "y":3}, {"label":"D", "x":3.75, "y":3}, {"label":"F", "x":4.75, "y":3}, {"label":"G", "x":5.75, "y":3}, {"label":"H", "x":6.75, "y":3}, {"label":"J", "x":7.75, "y":3}, {"label":"K", "x":8.75, "y":3}, {"label":"L", "x":9.75, "y":3}, {"label":":", "x":10.75, "y":3}, {"label":"\"", "x":11.75, "y":3}, {"label":"Enter", "x":12.75, "y":3, "w":2.25}, {"label":"4", "x":15, "y":3}, {"label":"5", "x":16, "y":3}, {"label":"6", "x":17, "y":3}, {"label":"+", "x":18, "y":3},{"label":"Shift", "x":0, "y":4, "w":2.25}, {"label":"Z", "x":2.25, "y":4}, {"label":"X", "x":3.25, "y":4}, {"label":"C", "x":4.25, "y":4}, {"label":"V", "x":5.25, "y":4}, {"label":"B", "x":6.25, "y":4}, {"label":"N", "x":7.25, "y":4}, {"label":"M", "x":8.25, "y":4}, {"label":"<", "x":9.25, "y":4}, {"label":">", "x":10.25, "y":4}, {"label":"?", "x":11.25, "y":4}, {"label":"Shift", "x":12.25, "y":4, "w":2.75}, {"label":"1", "x":15, "y":4}, {"label":"2", "x":16, "y":4}, {"label":"3", "x":17, "y":4}, {"label":"Enter", "x":18, "y":4, "h":2}, {"label":"Ctrl", "x":0, "y":5, "w":1.25}, {"label":"Win", "x":1.25, "y":5, "w":1.25}, {"label":"Alt", "x":2.5, "y":5, "w":1.25}, {"x":3.75, "y":5, "w":6.25}, {"label":"Fn", "x":10, "y":5}, {"label":"Win", "x":11, "y":5}, {"label":"\u2190", "x":12, "y":5}, {"label":"\u2193", "x":13, "y":5}, {"label":"\u2191", "x":14, "y":5}, {"label":"\u2192", "x":15, "y":5}, {"label":"0", "x":16, "y":5}, {"label":".", "x":17, "y":5}] + }, + "LAYOUT_custom": { + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":1, "y":0}, {"label":"F2", "x":2, "y":0}, {"label":"F3", "x":3, "y":0}, {"label":"F4", "x":4, "y":0}, {"label":"F5", "x":5, "y":0}, {"label":"F6", "x":6, "y":0}, {"label":"F7", "x":7, "y":0}, {"label":"F8", "x":8, "y":0}, {"label":"F9", "x":9, "y":0}, {"label":"F10", "x":10, "y":0}, {"label":"F11", "x":11, "y":0}, {"label":"F12", "x":12, "y":0}, {"label":"Print Screen", "x":13, "y":0}, {"label":"Home", "x":14, "y":0}, {"label":"End", "x":15, "y":0}, {"label":"Insert", "x":16, "y":0}, {"label":"Delete", "x":17, "y":0}, {"label":"Page Up", "x":18, "y":0}, {"label":"~", "x":0, "y":1}, {"label":"!", "x":1, "y":1}, {"label":"@", "x":2, "y":1}, {"label":"#", "x":3, "y":1}, {"label":"$", "x":4, "y":1}, {"label":"%", "x":5, "y":1}, {"label":"^", "x":6, "y":1}, {"label":"&", "x":7, "y":1}, {"label":"*", "x":8, "y":1}, {"label":"(", "x":9, "y":1}, {"label":")", "x":10, "y":1}, {"label":"_", "x":11, "y":1}, {"label":"+", "x":12, "y":1}, {"label":"Backspace", "x":13, "y":1, "w":2}, {"label":"Num Lock", "x":15, "y":1}, {"label":"/", "x":16, "y":1}, {"label":"*", "x":17, "y":1}, {"label":"PgDn", "x":18, "y":1}, {"label":"Tab", "x":0, "y":2, "w":1.5}, {"label":"Q", "x":1.5, "y":2}, {"label":"W", "x":2.5, "y":2}, {"label":"E", "x":3.5, "y":2}, {"label":"R", "x":4.5, "y":2}, {"label":"T", "x":5.5, "y":2}, {"label":"Y", "x":6.5, "y":2}, {"label":"U", "x":7.5, "y":2}, {"label":"I", "x":8.5, "y":2}, {"label":"O", "x":9.5, "y":2}, {"label":"P", "x":10.5, "y":2}, {"label":"{", "x":11.5, "y":2}, {"label":"}", "x":12.5, "y":2}, {"label":"|", "x":13.5, "y":2, "w":1.5}, {"label":"7", "x":15, "y":2}, {"label":"8", "x":16, "y":2}, {"label":"9", "x":17, "y":2}, {"label":"-", "x":18, "y":2}, {"label":"Caps Lock", "x":0, "y":3, "w":1.75}, {"label":"A", "x":1.75, "y":3}, {"label":"S", "x":2.75, "y":3}, {"label":"D", "x":3.75, "y":3}, {"label":"F", "x":4.75, "y":3}, {"label":"G", "x":5.75, "y":3}, {"label":"H", "x":6.75, "y":3}, {"label":"J", "x":7.75, "y":3}, {"label":"K", "x":8.75, "y":3}, {"label":"L", "x":9.75, "y":3}, {"label":":", "x":10.75, "y":3}, {"label":"\"", "x":11.75, "y":3}, {"label":"Enter", "x":12.75, "y":3, "w":2.25}, {"label":"4", "x":15, "y":3}, {"label":"5", "x":16, "y":3}, {"label":"6", "x":17, "y":3}, {"label":"+", "x":18, "y":3}, {"label":"Shift", "x":0, "y":4, "w":2.25}, {"label":"Z", "x":2.25, "y":4}, {"label":"X", "x":3.25, "y":4}, {"label":"C", "x":4.25, "y":4}, {"label":"V", "x":5.25, "y":4}, {"label":"B", "x":6.25, "y":4}, {"label":"N", "x":7.25, "y":4}, {"label":"M", "x":8.25, "y":4}, {"label":"<", "x":9.25, "y":4}, {"label":">", "x":10.25, "y":4}, {"label":"?", "x":11.25, "y":4}, {"label":"Shift", "x":12.25, "y":4, "w":1.75}, {"label":"Fn", "x":14, "y":4}, {"label":"1", "x":15, "y":4}, {"label":"2", "x":16, "y":4}, {"label":"3", "x":17, "y":4}, {"label":"Enter", "x":18, "y":4, "h":2}, {"label":"Ctrl", "x":0, "y":5, "w":1.25}, {"label":"Win", "x":1.25, "y":5, "w":1.25}, {"label":"Alt", "x":2.5, "y":5, "w":1.25}, {"x":3.75, "y":5, "w":6.25}, {"label":"Alt", "x":10, "y":5}, {"label":"Menu", "x":11, "y":5}, {"label":"Prnt Scr", "x":12, "y":5}, {"label":"Ctrl", "x":13, "y":5}, {"label":"Scroll Lock", "x":14, "y":5}, {"label":"0", "x":15, "y":5, "w":2}, {"label":".", "x":17, "y":5}] + }, + "LAYOUT_iso": { + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":1, "y":0}, {"label":"F2", "x":2, "y":0}, {"label":"F3", "x":3, "y":0}, {"label":"F4", "x":4, "y":0}, {"label":"F5", "x":5, "y":0}, {"label":"F6", "x":6, "y":0}, {"label":"F7", "x":7, "y":0}, {"label":"F8", "x":8, "y":0}, {"label":"F9", "x":9, "y":0}, {"label":"F10", "x":10, "y":0}, {"label":"F11", "x":11, "y":0}, {"label":"F12", "x":12, "y":0}, {"label":"PrtSc", "x":13, "y":0}, {"label":"Home", "x":14, "y":0}, {"label":"End", "x":15, "y":0}, {"label":"Insert", "x":16, "y":0}, {"label":"Delete", "x":17, "y":0}, {"label":"PgUp", "x":18, "y":0}, {"label":"\u00ac", "x":0, "y":1}, {"label":"!", "x":1, "y":1}, {"label":"\"", "x":2, "y":1}, {"label":"\u00a3", "x":3, "y":1}, {"label":"$", "x":4, "y":1}, {"label":"%", "x":5, "y":1}, {"label":"^", "x":6, "y":1}, {"label":"&", "x":7, "y":1}, {"label":"*", "x":8, "y":1}, {"label":"(", "x":9, "y":1}, {"label":")", "x":10, "y":1}, {"label":"_", "x":11, "y":1}, {"label":"+", "x":12, "y":1}, {"label":"Backspace", "x":13, "y":1, "w":2}, {"label":"Num Lock", "x":15, "y":1}, {"label":"/", "x":16, "y":1}, {"label":"*", "x":17, "y":1}, {"label":"PgDn", "x":18, "y":1}, {"label":"Tab", "x":0, "y":2, "w":1.5}, {"label":"Q", "x":1.5, "y":2}, {"label":"W", "x":2.5, "y":2}, {"label":"E", "x":3.5, "y":2}, {"label":"R", "x":4.5, "y":2}, {"label":"T", "x":5.5, "y":2}, {"label":"Y", "x":6.5, "y":2}, {"label":"U", "x":7.5, "y":2}, {"label":"I", "x":8.5, "y":2}, {"label":"O", "x":9.5, "y":2}, {"label":"P", "x":10.5, "y":2}, {"label":"{", "x":11.5, "y":2}, {"label":"}", "x":12.5, "y":2}, {"label":"Enter", "x":13.75, "y":2, "w":1.25, "h":2}, {"label":"7", "x":15, "y":2}, {"label":"8", "x":16, "y":2}, {"label":"9", "x":17, "y":2}, {"label":"-", "x":18, "y":2}, {"label":"Caps Lock", "x":0, "y":3, "w":1.75}, {"label":"A", "x":1.75, "y":3}, {"label":"S", "x":2.75, "y":3}, {"label":"D", "x":3.75, "y":3}, {"label":"F", "x":4.75, "y":3}, {"label":"G", "x":5.75, "y":3}, {"label":"H", "x":6.75, "y":3}, {"label":"J", "x":7.75, "y":3}, {"label":"K", "x":8.75, "y":3}, {"label":"L", "x":9.75, "y":3}, {"label":":", "x":10.75, "y":3}, {"label":"@", "x":11.75, "y":3}, {"label":"~", "x":12.75, "y":3}, {"label":"4", "x":15, "y":3}, {"label":"5", "x":16, "y":3}, {"label":"6", "x":17, "y":3}, {"label":"+", "x":18, "y":3}, {"label":"Shift", "x":0, "y":4, "w":1.25}, {"label":"|", "x":1.25, "y":4}, {"label":"Z", "x":2.25, "y":4}, {"label":"X", "x":3.25, "y":4}, {"label":"C", "x":4.25, "y":4}, {"label":"V", "x":5.25, "y":4}, {"label":"B", "x":6.25, "y":4}, {"label":"N", "x":7.25, "y":4}, {"label":"M", "x":8.25, "y":4}, {"label":"<", "x":9.25, "y":4}, {"label":">", "x":10.25, "y":4}, {"label":"?", "x":11.25, "y":4}, {"label":"Shift", "x":12.25, "y":4, "w":1.75}, {"label":"Up", "x":14, "y":4}, {"label":"1", "x":15, "y":4}, {"label":"2", "x":16, "y":4}, {"label":"3", "x":17, "y":4}, {"label":"Enter", "x":18, "y":4, "h":2}, {"label":"Ctrl", "x":0, "y":5, "w":1.25}, {"label":"Win", "x":1.25, "y":5, "w":1.25}, {"label":"Alt", "x":2.5, "y":5, "w":1.25}, {"x":3.75, "y":5, "w":6.25}, {"label":"AltGr", "x":10, "y":5, "w":1.5}, {"label":"Win", "x":11.5, "y":5, "w":1.5}, {"label":"Left", "x":13, "y":5}, {"label":"Down", "x":14, "y":5}, {"label":"Right", "x":15, "y":5}, {"label":"0", "x":16, "y":5}, {"label":".", "x":17, "y":5}] + } + } +} \ No newline at end of file diff --git a/keyboards/ymd96/keymaps/default/keymap.c b/keyboards/ymd96/keymaps/default/keymap.c index 3d54c7395c..c540972f10 100644 --- a/keyboards/ymd96/keymaps/default/keymap.c +++ b/keyboards/ymd96/keymaps/default/keymap.c @@ -22,7 +22,7 @@ along with this program. If not, see . #define _DEFLT 0 #define _RAISE 1 -#define KEYMAP KEYMAP_DEFAULT +#define KEYMAP LAYOUT_default const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/ymd96/keymaps/epx/keymap.c b/keyboards/ymd96/keymaps/epx/keymap.c index b9d3f6df22..09ec665a3a 100644 --- a/keyboards/ymd96/keymaps/epx/keymap.c +++ b/keyboards/ymd96/keymaps/epx/keymap.c @@ -24,7 +24,7 @@ along with this program. If not, see . #define _AR 1 #define _RAISE 2 -#define KEYMAP KEYMAP_DEFAULT +#define KEYMAP LAYOUT_default const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Layer 0, default layer diff --git a/keyboards/ymd96/keymaps/hgoel89/keymap.c b/keyboards/ymd96/keymaps/hgoel89/keymap.c index 81addf69f4..f612f79baf 100644 --- a/keyboards/ymd96/keymaps/hgoel89/keymap.c +++ b/keyboards/ymd96/keymaps/hgoel89/keymap.c @@ -27,7 +27,7 @@ qk_tap_dance_action_t tap_dance_actions[] = { #define _DEFLT 0 #define _RAISE 1 -#define KEYMAP KEYMAP_CUSTOM +#define KEYMAP LAYOUT_custom const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -45,8 +45,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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_NUMLOCK, KC_KP_SLASH, KC_KP_ASTERISK, KC_PMNS, \ 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_P7, KC_P8, KC_P9, KC_NO, \ 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_P4, KC_P5, KC_P6, KC_PPLS, \ - 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_P1, KC_P2, KC_P3, KC_PENT, \ - KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RGUI , KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, MO(_RAISE), KC_P0, KC_PDOT \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT,MO(_RAISE), KC_P1, KC_P2, KC_P3, KC_PENT, \ + KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RGUI , KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_P0, KC_PDOT \ ), /* Layer 1, raise layer * | | | | | | | | | | | | | | | | | | | | diff --git a/keyboards/ymd96/ymd96.h b/keyboards/ymd96/ymd96.h index 9c25f22192..ebf01b1d61 100644 --- a/keyboards/ymd96/ymd96.h +++ b/keyboards/ymd96/ymd96.h @@ -26,7 +26,7 @@ along with this program. If not, see . void matrix_init_user(void); // TODO port this to other PS2AVRGB boards -#define KEYMAP_DEFAULT( \ +#define LAYOUT_default( \ K500, K502, K503, K504, K505, K600, K610, K710, K700, K511, K512, K513, K514, K113, K214, K013, K706, K709, K708, \ K400, K401, K402, K403, K404, K405, K601, K611, K711, K701, K410, K411, K412, K414, K406, K407, K408, K409, \ K300, K301, K302, K303, K304, K305, K602, K612, K712, K702, K310, K311, K312, K313, K306, K307, K308, K309, \ @@ -44,13 +44,13 @@ void matrix_init_user(void); // TODO port this to other PS2AVRGB boards { K700, K701, K702, K703, K704, K705, K706, KC_NO, K708, K709, K710, K711, K712, K713, K714 } \ } -#define KEYMAP_CUSTOM( \ +#define LAYOUT_custom( \ K500, K502, K503, K504, K505, K600, K610, K710, K700, K511, K512, K513, K514, K113, K214, K013, K706, K709, K708, \ K400, K401, K402, K403, K404, K405, K601, K611, K711, K701, K410, K411, K412, K414, K406, K407, K408, K409, \ K300, K301, K302, K303, K304, K305, K602, K612, K712, K702, K310, K311, K312, K313, K306, K307, K308, K309, \ K200, K201, K202, K203, K204, K205, K603, K613, K713, K703, K210, K211, K213, K206, K207, K208, K209, \ - K100, K101, K102, K103, K104, K105, K604, K614, K714, K704, K110, K111, K106, K107, K108, K009, \ - K000, K001, K002, K605, K705, K010, K011, K606, K607, KC_NO, K006, K008 \ + K100, K101, K102, K103, K104, K105, K604, K614, K714, K704, K110, K111, K608,K106, K107, K108, K009, \ + K000, K001, K002, K605, K705, K010, K011, K606, K607, K006, K008 \ ) { \ { K000, K001, K002, KC_NO, KC_NO, KC_NO, K006, KC_NO, K008, K009, K010, K011, KC_NO, K013, KC_NO, }, \ { K100, K101, K102, K103, K104, K105, K106, K107, K108, KC_NO, K110, K111, KC_NO, K113, KC_NO, }, \ @@ -58,7 +58,7 @@ void matrix_init_user(void); // TODO port this to other PS2AVRGB boards { K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, KC_NO, }, \ { K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, KC_NO, K414, }, \ { K500, KC_NO, K502, K503, K504, K505, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K511, K512, K513, K514, }, \ - { K600, K601, K602, K603, K604, K605, K606, K607, KC_NO, KC_NO, K610, K611, K612, K613, K614, }, \ + { K600, K601, K602, K603, K604, K605, K606, K607, K608, KC_NO, K610, K611, K612, K613, K614, }, \ { K700, K701, K702, K703, K704, K705, K706, KC_NO, K708, K709, K710, K711, K712, K713, K714 } \ } From b61baf4281bde34bfe28aaa1109bd5d5c6471116 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Mon, 22 Apr 2019 11:34:13 -0400 Subject: [PATCH 46/61] Fix #3566 use an hardware timer for software PWM stability (#3615) With my XD60, I noticed that when typing the backlight was flickering. The XD60 doesn't have the backlight wired to a hardware PWM pin. I assumed it was a timing issue in the matrix scan that made the PWM lit the LED a bit too longer. I verified it because the more keys that were pressed, the more lighting I observed. This patch makes the software PWM be called during CPU interruptions. It works almost like the hardware PWM, except instead of using the CPU waveform generation, the CPU will fire interruption when the LEDs need be turned on or off. Using the same timer system as for hardware PWM, when the counter will reach OCRxx (the current backlight level), an Output Compare match interrupt will be fired and we'll turn the LEDs off. When the counter reaches its maximum value, an overflow interrupt will be triggered in which we turn the LEDs on. This way we replicate the hardware backlight PWM duty cycle. This gives a better time stability of the PWM computation than pure software PWM, leading to a flicker free backlight. Since this is reusing the hardware PWM code, software PWM also supports backlight breathing. Note that if timer1 is used for audio, backlight will use timer3, and if timer3 is used for audio backlight will use timer1. If both timers are used for audio, then this feature is disabled and we revert to the matrix scan based PWM computation. Signed-off-by: Brice Figureau --- docs/feature_backlight.md | 52 +++++++- quantum/quantum.c | 256 +++++++++++++++++++++++++++++++------- quantum/quantum.h | 4 + 3 files changed, 267 insertions(+), 45 deletions(-) diff --git a/docs/feature_backlight.md b/docs/feature_backlight.md index c7a1f131ed..048d75390d 100644 --- a/docs/feature_backlight.md +++ b/docs/feature_backlight.md @@ -30,7 +30,31 @@ You should then be able to use the keycodes below to change the backlight level. This feature is distinct from both the [RGB underglow](feature_rgblight.md) and [RGB matrix](feature_rgb_matrix.md) features as it usually allows for only a single colour per switch, though you can obviously use multiple different coloured LEDs on a keyboard. -Hardware PWM is only supported on certain pins of the MCU, so if the backlighting is not connected to one of them, a software implementation will be used, and backlight breathing will not be available. Currently the supported pins are `B5`, `B6`, `B7`, and `C6`. +Hardware PWM is only supported on certain pins of the MCU, so if the backlighting is not connected to one of them, a software PWM implementation triggered by hardware timer interrupts will be used. + +Hardware PWM is supported according to the following table: + +| Backlight Pin | Hardware timer | +|---------------|----------------| +|`B5` | Timer 1 | +|`B6` | Timer 1 | +|`B7` | Timer 1 | +|`C6` | Timer 3 | +| other | Software PWM | + +The [audio feature](feature_audio.md) also uses hardware timers. Please refer to the following table to know what hardware timer the software PWM will use depending on the audio configuration: + +| Audio Pin(s) | Audio Timer | Software PWM Timer | +|--------------|-------------|--------------------| +| `C4` | Timer 3 | Timer 1 | +| `C5` | Timer 3 | Timer 1 | +| `C6` | Timer 3 | Timer 1 | +| `B5` | Timer 1 | Timer 3 | +| `B6` | Timer 1 | Timer 3 | +| `B7` | Timer 1 | Timer 3 | +| `Bx` & `Cx` | Timer 1 & 3 | None | + +When all timers are in use for [audio](feature_audio.md), the backlight software PWM will not use a hardware timer, but instead will be triggered during the matrix scan. In this case the backlight doesn't support breathing and might show lighting artifacts (for instance flickering), because the PWM computation might not be called with enough timing precision. ## Configuration @@ -39,11 +63,26 @@ To change the behaviour of the backlighting, `#define` these in your `config.h`: |Define |Default |Description | |---------------------|-------------|-------------------------------------------------------------------------------------------------------------| |`BACKLIGHT_PIN` |`B7` |The pin that controls the LEDs. Unless you are designing your own keyboard, you shouldn't need to change this| +|`BACKLIGHT_PINS` |*Not defined*|experimental: see below for more information| |`BACKLIGHT_LEVELS` |`3` |The number of brightness levels (maximum 15 excluding off) | |`BACKLIGHT_CAPS_LOCK`|*Not defined*|Enable Caps Lock indicator using backlight (for keyboards without dedicated LED) | -|`BACKLIGHT_BREATHING`|*Not defined*|Enable backlight breathing, if hardware PWM is used | +|`BACKLIGHT_BREATHING`|*Not defined*|Enable backlight breathing, if supported | |`BREATHING_PERIOD` |`6` |The length of one backlight "breath" in seconds | +## Multiple backlight pins + +Most keyboards have only one backlight pin which control all backlight LEDs (especially if the backlight is connected to an hardware PWM pin). +In software PWM, it is possible to define multiple backlight pins. All those pins will be turned on and off at the same time during the PWM duty cycle. +This feature allows to set for instance the Caps Lock LED (or any other controllable LED) brightness at the same level as the other LEDs of the backlight. This is useful if you have mapped LCTRL in place of Caps Lock and you need the Caps Lock LED to be part of the backlight instead of being activated when Caps Lock is on. + +To activate multiple backlight pins, you need to add something like this to your user `config.h`: + +~~~c +#define BACKLIGHT_LED_COUNT 2 +#undef BACKLIGHT_PIN +#define BACKLIGHT_PINS { F5, B2 } +~~~ + ## Hardware PWM Implementation When using the supported pins for backlighting, QMK will use a hardware timer configured to output a PWM signal. This timer will count up to `ICRx` (by default `0xFFFF`) before resetting to 0. @@ -53,6 +92,15 @@ In this way `OCRxx` essentially controls the duty cycle of the LEDs, and thus th The breathing effect is achieved by registering an interrupt handler for `TIMER1_OVF_vect` that is called whenever the counter resets, roughly 244 times per second. In this handler, the value of an incrementing counter is mapped onto a precomputed brightness curve. To turn off breathing, the interrupt handler is simply disabled, and the brightness reset to the level stored in EEPROM. +## Software PWM Implementation + +When `BACKLIGHT_PIN` is not set to a hardware backlight pin, QMK will use a hardware timer configured to trigger software interrupts. This time will count up to `ICRx` (by default `0xFFFF`) before resetting to 0. +When resetting to 0, the CPU will fire an OVF (overflow) interrupt that will turn the LEDs on, starting the duty cycle. +The desired brightness is calculated and stored in the `OCRxx` register. When the counter reaches this value, the CPU will fire a Compare Output match interrupt, which will turn the LEDs off. +In this way `OCRxx` essentially controls the duty cycle of the LEDs, and thus the brightness, where `0x0000` is completely off and `0xFFFF` is completely on. + +The breathing effect is the same as in the hardware PWM implementation. + ## Backlight Functions |Function |Description | diff --git a/quantum/quantum.c b/quantum/quantum.c index 9aa498dadb..0fb798a748 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -1138,30 +1138,38 @@ void matrix_scan_quantum() { matrix_scan_kb(); } -#if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_PIN) +#if defined(BACKLIGHT_ENABLE) && (defined(BACKLIGHT_PIN) || defined(BACKLIGHT_PINS)) -static const uint8_t backlight_pin = BACKLIGHT_PIN; +// The logic is a bit complex, we support 3 setups: +// 1. hardware PWM when backlight is wired to a PWM pin +// depending on this pin, we use a different output compare unit +// 2. software PWM with hardware timers, but the used timer depends +// on the audio setup (audio wins other backlight) +// 3. full software PWM -// depending on the pin, we use a different output compare unit #if BACKLIGHT_PIN == B7 +# define HARDWARE_PWM # define TCCRxA TCCR1A # define TCCRxB TCCR1B # define COMxx1 COM1C1 # define OCRxx OCR1C # define ICRx ICR1 #elif BACKLIGHT_PIN == B6 +# define HARDWARE_PWM # define TCCRxA TCCR1A # define TCCRxB TCCR1B # define COMxx1 COM1B1 # define OCRxx OCR1B # define ICRx ICR1 #elif BACKLIGHT_PIN == B5 +# define HARDWARE_PWM # define TCCRxA TCCR1A # define TCCRxB TCCR1B # define COMxx1 COM1A1 # define OCRxx OCR1A # define ICRx ICR1 #elif BACKLIGHT_PIN == C6 +# define HARDWARE_PWM # define TCCRxA TCCR3A # define TCCRxB TCCR3B # define COMxx1 COM1A1 @@ -1175,28 +1183,115 @@ static const uint8_t backlight_pin = BACKLIGHT_PIN; # define ICRx ICR1 # define TIMSK1 TIMSK #else -# define NO_HARDWARE_PWM +# if !defined(BACKLIGHT_CUSTOM_DRIVER) +# if !defined(B5_AUDIO) && !defined(B6_AUDIO) && !defined(B7_AUDIO) + // timer 1 is not used by audio , backlight can use it +#pragma message "Using hardware timer 1 with software PWM" +# define HARDWARE_PWM +# define BACKLIGHT_PWM_TIMER +# define TCCRxA TCCR1A +# define TCCRxB TCCR1B +# define OCRxx OCR1A +# define OCRxAH OCR1AH +# define OCRxAL OCR1AL +# define TIMERx_COMPA_vect TIMER1_COMPA_vect +# define TIMERx_OVF_vect TIMER1_OVF_vect +# define OCIExA OCIE1A +# define TOIEx TOIE1 +# define ICRx ICR1 +# ifndef TIMSK +# define TIMSK TIMSK1 +# endif +# elif !defined(C6_AUDIO) && !defined(C5_AUDIO) && !defined(C4_AUDIO) +#pragma message "Using hardware timer 3 with software PWM" +// timer 3 is not used by audio, backlight can use it +# define HARDWARE_PWM +# define BACKLIGHT_PWM_TIMER +# define TCCRxA TCCR3A +# define TCCRxB TCCR3B +# define OCRxx OCR3A +# define OCRxAH OCR3AH +# define OCRxAL OCR3AL +# define TIMERx_COMPA_vect TIMER3_COMPA_vect +# define TIMERx_OVF_vect TIMER3_OVF_vect +# define OCIExA OCIE3A +# define TOIEx TOIE3 +# define ICRx ICR1 +# ifndef TIMSK +# define TIMSK TIMSK3 +# endif +# else +#pragma message "Audio in use - using pure software PWM" +#define NO_HARDWARE_PWM +# endif +# else +#pragma message "Custom driver defined - using pure software PWM" +#define NO_HARDWARE_PWM +# endif #endif #ifndef BACKLIGHT_ON_STATE #define BACKLIGHT_ON_STATE 0 #endif -#ifdef NO_HARDWARE_PWM // pwm through software +void backlight_on(uint8_t backlight_pin) { +#if BACKLIGHT_ON_STATE == 0 + writePinLow(backlight_pin); +#else + writePinHigh(backlight_pin); +#endif +} -__attribute__ ((weak)) +void backlight_off(uint8_t backlight_pin) { +#if BACKLIGHT_ON_STATE == 0 + writePinHigh(backlight_pin); +#else + writePinLow(backlight_pin); +#endif +} + + +#if defined(NO_HARDWARE_PWM) || defined(BACKLIGHT_PWM_TIMER) // pwm through software + +// we support multiple backlight pins +#ifndef BACKLIGHT_LED_COUNT +#define BACKLIGHT_LED_COUNT 1 +#endif + +#if BACKLIGHT_LED_COUNT == 1 +#define BACKLIGHT_PIN_INIT { BACKLIGHT_PIN } +#else +#define BACKLIGHT_PIN_INIT BACKLIGHT_PINS +#endif + +#define FOR_EACH_LED(x) \ + for (uint8_t i = 0; i < BACKLIGHT_LED_COUNT; i++) \ + { \ + uint8_t backlight_pin = backlight_pins[i]; \ + { \ + x \ + } \ + } + +static const uint8_t backlight_pins[BACKLIGHT_LED_COUNT] = BACKLIGHT_PIN_INIT; + +#else // full hardware PWM + +// we support only one backlight pin +static const uint8_t backlight_pin = BACKLIGHT_PIN; +#define FOR_EACH_LED(x) x + +#endif + +#ifdef NO_HARDWARE_PWM +__attribute__((weak)) void backlight_init_ports(void) { // Setup backlight pin as output and output to on state. - // DDRx |= n - _SFR_IO8((backlight_pin >> 4) + 1) |= _BV(backlight_pin & 0xF); - #if BACKLIGHT_ON_STATE == 0 - // PORTx &= ~n - _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF); - #else - // PORTx |= n - _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF); - #endif + FOR_EACH_LED( + setPinOutput(backlight_pin); + backlight_on(backlight_pin); + ) } __attribute__ ((weak)) @@ -1207,21 +1302,14 @@ uint8_t backlight_tick = 0; #ifndef BACKLIGHT_CUSTOM_DRIVER void backlight_task(void) { if ((0xFFFF >> ((BACKLIGHT_LEVELS - get_backlight_level()) * ((BACKLIGHT_LEVELS + 1) / 2))) & (1 << backlight_tick)) { - #if BACKLIGHT_ON_STATE == 0 - // PORTx &= ~n - _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF); - #else - // PORTx |= n - _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF); - #endif - } else { - #if BACKLIGHT_ON_STATE == 0 - // PORTx |= n - _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF); - #else - // PORTx &= ~n - _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF); - #endif + FOR_EACH_LED( + backlight_on(backlight_pin); + ) + } + else { + FOR_EACH_LED( + backlight_off(backlight_pin); + ) } backlight_tick = (backlight_tick + 1) % 16; } @@ -1233,7 +1321,52 @@ void backlight_task(void) { #endif #endif -#else // pwm through timer +#else // hardware pwm through timer + +#ifdef BACKLIGHT_PWM_TIMER + +// The idea of software PWM assisted by hardware timers is the following +// we use the hardware timer in fast PWM mode like for hardware PWM, but +// instead of letting the Output Match Comparator control the led pin +// (which is not possible since the backlight is not wired to PWM pins on the +// CPU), we do the LED on/off by oursleves. +// The timer is setup to count up to 0xFFFF, and we set the Output Compare +// register to the current 16bits backlight level (after CIE correction). +// This means the CPU will trigger a compare match interrupt when the counter +// reaches the backlight level, where we turn off the LEDs, +// but also an overflow interrupt when the counter rolls back to 0, +// in which we're going to turn on the LEDs. +// The LED will then be on for OCRxx/0xFFFF time, adjusted every 244Hz. + +// Triggered when the counter reaches the OCRx value +ISR(TIMERx_COMPA_vect) { + FOR_EACH_LED( + backlight_off(backlight_pin); + ) +} + +// Triggered when the counter reaches the TOP value +// this one triggers at F_CPU/65536 =~ 244 Hz +ISR(TIMERx_OVF_vect) { +#ifdef BACKLIGHT_BREATHING + breathing_task(); +#endif + // for very small values of OCRxx (or backlight level) + // we can't guarantee this whole code won't execute + // at the same time as the compare match interrupt + // which means that we might turn on the leds while + // trying to turn them off, leading to flickering + // artifacts (especially while breathing, because breathing_task + // takes many computation cycles). + // so better not turn them on while the counter TOP is very low. + if (OCRxx > 256) { + FOR_EACH_LED( + backlight_on(backlight_pin); + ) + } +} + +#endif #define TIMER_TOP 0xFFFFU @@ -1265,11 +1398,28 @@ void backlight_set(uint8_t level) { level = BACKLIGHT_LEVELS; if (level == 0) { + #ifdef BACKLIGHT_PWM_TIMER + if (OCRxx) { + TIMSK &= ~(_BV(OCIExA)); + TIMSK &= ~(_BV(TOIEx)); + FOR_EACH_LED( + backlight_off(backlight_pin); + ) + } + #else // Turn off PWM control on backlight pin TCCRxA &= ~(_BV(COMxx1)); + #endif } else { + #ifdef BACKLIGHT_PWM_TIMER + if (!OCRxx) { + TIMSK |= _BV(OCIExA); + TIMSK |= _BV(TOIEx); + } + #else // Turn on PWM control of backlight pin TCCRxA |= _BV(COMxx1); + #endif } // Set the brightness set_pwm(cie_lightness(TIMER_TOP * (uint32_t)level / BACKLIGHT_LEVELS)); @@ -1289,12 +1439,25 @@ static uint8_t breathing_period = BREATHING_PERIOD; static uint8_t breathing_halt = BREATHING_NO_HALT; static uint16_t breathing_counter = 0; +#ifdef BACKLIGHT_PWM_TIMER +static bool breathing = false; + +bool is_breathing(void) { + return breathing; +} + +#define breathing_interrupt_enable() do { breathing = true; } while (0) +#define breathing_interrupt_disable() do { breathing = false; } while (0) +#else + bool is_breathing(void) { return !!(TIMSK1 & _BV(TOIE1)); } #define breathing_interrupt_enable() do {TIMSK1 |= _BV(TOIE1);} while (0) #define breathing_interrupt_disable() do {TIMSK1 &= ~_BV(TOIE1);} while (0) +#endif + #define breathing_min() do {breathing_counter = 0;} while (0) #define breathing_max() do {breathing_counter = breathing_period * 244 / 2;} while (0) @@ -1368,10 +1531,14 @@ static inline uint16_t scale_backlight(uint16_t v) { return v / BACKLIGHT_LEVELS * get_backlight_level(); } +#ifdef BACKLIGHT_PWM_TIMER +void breathing_task(void) +#else /* Assuming a 16MHz CPU clock and a timer that resets at 64k (ICR1), the following interrupt handler will run * about 244 times per second. */ ISR(TIMER1_OVF_vect) +#endif { uint16_t interval = (uint16_t) breathing_period * 244 / BREATHING_STEPS; // resetting after one period to prevent ugly reset at overflow. @@ -1393,19 +1560,21 @@ __attribute__ ((weak)) void backlight_init_ports(void) { // Setup backlight pin as output and output to on state. - // DDRx |= n - _SFR_IO8((backlight_pin >> 4) + 1) |= _BV(backlight_pin & 0xF); - #if BACKLIGHT_ON_STATE == 0 - // PORTx &= ~n - _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF); - #else - // PORTx |= n - _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF); - #endif + FOR_EACH_LED( + setPinOutput(backlight_pin); + backlight_on(backlight_pin); + ) + // I could write a wall of text here to explain... but TL;DW // Go read the ATmega32u4 datasheet. // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on +#ifdef BACKLIGHT_PWM_TIMER + // TimerX setup, Fast PWM mode count to TOP set in ICRx + TCCRxA = _BV(WGM11); // = 0b00000010; + // clock select clk/1 + TCCRxB = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; +#else // hardware PWM // Pin PB7 = OCR1C (Timer 1, Channel C) // Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0 // (i.e. start high, go low when counter matches.) @@ -1417,8 +1586,9 @@ void backlight_init_ports(void) "In fast PWM mode, the compare units allow generation of PWM waveforms on the OCnx pins. Setting the COMnx1:0 bits to two will produce a non-inverted PWM [..]." "In fast PWM mode the counter is incremented until the counter value matches either one of the fixed values 0x00FF, 0x01FF, or 0x03FF (WGMn3:0 = 5, 6, or 7), the value in ICRn (WGMn3:0 = 14), or the value in OCRnA (WGMn3:0 = 15)." */ - TCCRxA = _BV(COMxx1) | _BV(WGM11); // = 0b00001010; + TCCRxA = _BV(COMxx1) | _BV(WGM11); // = 0b00001010; TCCRxB = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; +#endif // Use full 16-bit resolution. Counter counts to ICR1 before reset to 0. ICRx = TIMER_TOP; @@ -1428,9 +1598,9 @@ void backlight_init_ports(void) #endif } -#endif // NO_HARDWARE_PWM +#endif // hardware backlight -#else // backlight +#else // no backlight __attribute__ ((weak)) void backlight_init_ports(void) {} diff --git a/quantum/quantum.h b/quantum/quantum.h index 987516dedb..17cb902740 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -260,8 +260,12 @@ void tap_code16(uint16_t code); #ifdef BACKLIGHT_ENABLE void backlight_init_ports(void); void backlight_task(void); +void backlight_task_internal(void); +void backlight_on(uint8_t backlight_pin); +void backlight_off(uint8_t backlight_pin); #ifdef BACKLIGHT_BREATHING +void breathing_task(void); void breathing_enable(void); void breathing_pulse(void); void breathing_disable(void); From bb52119a6dfe9c6f0314d1bcd948efda59626a70 Mon Sep 17 00:00:00 2001 From: M-AS Date: Mon, 22 Apr 2019 11:37:40 -0400 Subject: [PATCH 47/61] RGB Matrix Animations: Three/six new reactive effects (wide, cross, nexus) (#5602) * added 3 new RGB_Matrix effects * made cross effect behavior smoother * removed dead code * added effect descriptions --- docs/feature_rgb_matrix.md | 54 +++++++++++-------- quantum/rgb_matrix.c | 33 ++++++++++++ quantum/rgb_matrix.h | 18 +++++++ .../solid_reactive_cross.h | 50 +++++++++++++++++ .../solid_reactive_nexus.h | 48 +++++++++++++++++ .../solid_reactive_wide.h | 42 +++++++++++++++ 6 files changed, 224 insertions(+), 21 deletions(-) create mode 100644 quantum/rgb_matrix_animations/solid_reactive_cross.h create mode 100644 quantum/rgb_matrix_animations/solid_reactive_nexus.h create mode 100644 quantum/rgb_matrix_animations/solid_reactive_wide.h diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 5309e749cb..f2168ab16e 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -189,6 +189,12 @@ enum rgb_matrix_effects { #if defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES) RGB_MATRIX_SOLID_REACTIVE_SIMPLE, // Pulses keys hit to hue & value then fades value out RGB_MATRIX_SOLID_REACTIVE, // Static single hue, pulses keys hit to shifted hue then fades to current hue + RGB_MATRIX_SOLID_REACTIVE_WIDE // Hue & value pulse near a single key hit then fades value out + RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE // Hue & value pulse near multiple key hits then fades value out + RGB_MATRIX_SOLID_REACTIVE_CROSS // Hue & value pulse the same column and row of a single key hit then fades value out + RGB_MATRIX_SOLID_REACTIVE_MULTICROSS // Hue & value pulse the same column and row of multiple key hits then fades value out + RGB_MATRIX_SOLID_REACTIVE_NEXUS // Hue & value pulse away on the same column and row of a single key hit then fades value out + RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS // Hue & value pulse away on the same column and row of multiple key hits then fades value out RGB_MATRIX_SPLASH, // Full gradient & value pulse away from a single key hit then fades value out RGB_MATRIX_MULTISPLASH, // Full gradient & value pulse away from multiple key hits then fades value out RGB_MATRIX_SOLID_SPLASH, // Hue & value pulse away from a single key hit then fades value out @@ -201,27 +207,33 @@ enum rgb_matrix_effects { You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `config.h`: -|Define |Description | -|---------------------------------------------------|--------------------------------------------| -|`#define DISABLE_RGB_MATRIX_ALPHAS_MODS` |Disables `RGB_MATRIX_ALPHAS_MODS` | -|`#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN` |Disables `RGB_MATRIX_GRADIENT_UP_DOWN` | -|`#define DISABLE_RGB_MATRIX_BREATHING` |Disables `RGB_MATRIX_BREATHING` | -|`#define DISABLE_RGB_MATRIX_CYCLE_ALL` |Disables `RGB_MATRIX_CYCLE_ALL` | -|`#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT` |Disables `RGB_MATRIX_CYCLE_LEFT_RIGHT` | -|`#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN` |Disables `RGB_MATRIX_CYCLE_UP_DOWN` | -|`#define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON`|Disables `RGB_MATRIX_RAINBOW_MOVING_CHEVRON`| -|`#define DISABLE_RGB_MATRIX_DUAL_BEACON` |Disables `RGB_MATRIX_DUAL_BEACON` | -|`#define DISABLE_RGB_MATRIX_RAINBOW_BEACON` |Disables `RGB_MATRIX_RAINBOW_BEACON` | -|`#define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS` |Disables `RGB_MATRIX_RAINBOW_PINWHEELS` | -|`#define DISABLE_RGB_MATRIX_RAINDROPS` |Disables `RGB_MATRIX_RAINDROPS` | -|`#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS` |Disables `RGB_MATRIX_JELLYBEAN_RAINDROPS` | -|`#define DISABLE_RGB_MATRIX_DIGITAL_RAIN` |Disables `RGB_MATRIX_DIGITAL_RAIN` | -|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE` |Disables `RGB_MATRIX_SOLID_REACTIVE` | -|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE` |Disables `RGB_MATRIX_SOLID_REACTIVE_SIMPLEE`| -|`#define DISABLE_RGB_MATRIX_SPLASH` |Disables `RGB_MATRIX_SPLASH` | -|`#define DISABLE_RGB_MATRIX_MULTISPLASH` |Disables `RGB_MATRIX_MULTISPLASH` | -|`#define DISABLE_RGB_MATRIX_SOLID_SPLASH` |Disables `RGB_MATRIX_SOLID_SPLASH` | -|`#define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH` |Disables `RGB_MATRIX_SOLID_MULTISPLASH` | +|Define |Description | +|-------------------------------------------------------|-----------------------------------------------| +|`#define DISABLE_RGB_MATRIX_ALPHAS_MODS` |Disables `RGB_MATRIX_ALPHAS_MODS` | +|`#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN` |Disables `RGB_MATRIX_GRADIENT_UP_DOWN` | +|`#define DISABLE_RGB_MATRIX_BREATHING` |Disables `RGB_MATRIX_BREATHING` | +|`#define DISABLE_RGB_MATRIX_CYCLE_ALL` |Disables `RGB_MATRIX_CYCLE_ALL` | +|`#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT` |Disables `RGB_MATRIX_CYCLE_LEFT_RIGHT` | +|`#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN` |Disables `RGB_MATRIX_CYCLE_UP_DOWN` | +|`#define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON` |Disables `RGB_MATRIX_RAINBOW_MOVING_CHEVRON` | +|`#define DISABLE_RGB_MATRIX_DUAL_BEACON` |Disables `RGB_MATRIX_DUAL_BEACON` | +|`#define DISABLE_RGB_MATRIX_RAINBOW_BEACON` |Disables `RGB_MATRIX_RAINBOW_BEACON` | +|`#define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS` |Disables `RGB_MATRIX_RAINBOW_PINWHEELS` | +|`#define DISABLE_RGB_MATRIX_RAINDROPS` |Disables `RGB_MATRIX_RAINDROPS` | +|`#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS` |Disables `RGB_MATRIX_JELLYBEAN_RAINDROPS` | +|`#define DISABLE_RGB_MATRIX_DIGITAL_RAIN` |Disables `RGB_MATRIX_DIGITAL_RAIN` | +|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE` |Disables `RGB_MATRIX_SOLID_REACTIVE` | +|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE` |Disables `RGB_MATRIX_SOLID_REACTIVE_SIMPLE` | +|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE` |Disables `RGB_MATRIX_SOLID_REACTIVE_WIDE` | +|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE` |Disables `RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE` | +|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS` |Disables `RGB_MATRIX_SOLID_REACTIVE_CROSS` | +|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS` |Disables `RGB_MATRIX_SOLID_REACTIVE_MULTICROSS`| +|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS` |Disables `RGB_MATRIX_SOLID_REACTIVE_NEXUS` | +|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS` |Disables `RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS`| +|`#define DISABLE_RGB_MATRIX_SPLASH` |Disables `RGB_MATRIX_SPLASH` | +|`#define DISABLE_RGB_MATRIX_MULTISPLASH` |Disables `RGB_MATRIX_MULTISPLASH` | +|`#define DISABLE_RGB_MATRIX_SOLID_SPLASH` |Disables `RGB_MATRIX_SOLID_SPLASH` | +|`#define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH` |Disables `RGB_MATRIX_SOLID_MULTISPLASH` | ## Custom layer effects diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index a1193d4c07..41ed8983ef 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix.c @@ -41,6 +41,9 @@ #include "rgb_matrix_animations/digital_rain_anim.h" #include "rgb_matrix_animations/solid_reactive_simple_anim.h" #include "rgb_matrix_animations/solid_reactive_anim.h" +#include "rgb_matrix_animations/solid_reactive_wide.h" +#include "rgb_matrix_animations/solid_reactive_cross.h" +#include "rgb_matrix_animations/solid_reactive_nexus.h" #include "rgb_matrix_animations/splash_anim.h" #include "rgb_matrix_animations/solid_splash_anim.h" #include "rgb_matrix_animations/breathing_anim.h" @@ -380,6 +383,36 @@ static void rgb_task_render(uint8_t effect) { rendering = rgb_matrix_solid_reactive(&rgb_effect_params); // Max 4ms Avg 3ms break; #endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE +#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE + case RGB_MATRIX_SOLID_REACTIVE_WIDE: + rendering = rgb_matrix_solid_reactive_wide(&rgb_effect_params); // Max ?? ms Avg ?? ms + break; +#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE + case RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE: + rendering = rgb_matrix_solid_reactive_multiwide(&rgb_effect_params); // Max ?? ms Avg ?? ms + break; +#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS + case RGB_MATRIX_SOLID_REACTIVE_CROSS: + rendering = rgb_matrix_solid_reactive_cross(&rgb_effect_params); // Max ?? ms Avg ?? ms + break; +#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS + case RGB_MATRIX_SOLID_REACTIVE_MULTICROSS: + rendering = rgb_matrix_solid_reactive_multicross(&rgb_effect_params); // Max ?? ms Avg ?? ms + break; +#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS + case RGB_MATRIX_SOLID_REACTIVE_NEXUS: + rendering = rgb_matrix_solid_reactive_nexus(&rgb_effect_params); // Max ?? ms Avg ?? ms + break; +#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS + case RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS: + rendering = rgb_matrix_solid_reactive_multinexus(&rgb_effect_params); // Max ?? ms Avg ?? ms + break; +#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS #ifndef DISABLE_RGB_MATRIX_SPLASH case RGB_MATRIX_SPLASH: rendering = rgb_matrix_splash(&rgb_effect_params); // Max 5ms Avg 3ms diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h index f5be494354..5fdc854f08 100644 --- a/quantum/rgb_matrix.h +++ b/quantum/rgb_matrix.h @@ -111,6 +111,24 @@ enum rgb_matrix_effects { #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE RGB_MATRIX_SOLID_REACTIVE, #endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE +#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE + RGB_MATRIX_SOLID_REACTIVE_WIDE, +#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE + RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE, +#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS + RGB_MATRIX_SOLID_REACTIVE_CROSS, +#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS + RGB_MATRIX_SOLID_REACTIVE_MULTICROSS, +#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS + RGB_MATRIX_SOLID_REACTIVE_NEXUS, +#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS + RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS, +#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS #ifndef DISABLE_RGB_MATRIX_SPLASH RGB_MATRIX_SPLASH, #endif // DISABLE_RGB_MATRIX_SPLASH diff --git a/quantum/rgb_matrix_animations/solid_reactive_cross.h b/quantum/rgb_matrix_animations/solid_reactive_cross.h new file mode 100644 index 0000000000..af602cba15 --- /dev/null +++ b/quantum/rgb_matrix_animations/solid_reactive_cross.h @@ -0,0 +1,50 @@ +#pragma once +#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED +#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) + +extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern rgb_config_t rgb_matrix_config; +extern last_hit_t g_last_hit_tracker; + +static bool rgb_matrix_solid_reactive_multicross_range(uint8_t start, effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 }; + uint8_t count = g_last_hit_tracker.count; + for (uint8_t i = led_min; i < led_max; i++) { + hsv.v = 0; + point_t point = g_rgb_leds[i].point; + for (uint8_t j = start; j < count; j++) { + int16_t dx = point.x - g_last_hit_tracker.x[j]; + int16_t dy = point.y - g_last_hit_tracker.y[j]; + uint8_t dist = sqrt16(dx * dx + dy * dy); + int16_t dist2 = 16; + uint8_t dist3; + uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) + dist; + dx = dx < 0 ? dx * -1 : dx; + dy = dy < 0 ? dy * -1 : dy; + dx = dx * dist2 > 255 ? 255 : dx * dist2; + dy = dy * dist2 > 255 ? 255 : dy * dist2; + dist3 = dx > dy ? dy : dx; + effect += dist3; + if (effect > 255) + effect = 255; + hsv.v = qadd8(hsv.v, 255 - effect); + } + hsv.v = scale8(hsv.v, rgb_matrix_config.val); + RGB rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < DRIVER_LED_TOTAL; +} + +bool rgb_matrix_solid_reactive_multicross(effect_params_t* params) { + return rgb_matrix_solid_reactive_multicross_range(0, params); +} + +bool rgb_matrix_solid_reactive_cross(effect_params_t* params) { + return rgb_matrix_solid_reactive_multicross_range(qsub8(g_last_hit_tracker.count, 1), params); +} + +#endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix_animations/solid_reactive_nexus.h b/quantum/rgb_matrix_animations/solid_reactive_nexus.h new file mode 100644 index 0000000000..8b4a139dc9 --- /dev/null +++ b/quantum/rgb_matrix_animations/solid_reactive_nexus.h @@ -0,0 +1,48 @@ +#pragma once +#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED +#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) + +extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern rgb_config_t rgb_matrix_config; +extern last_hit_t g_last_hit_tracker; + +static bool rgb_matrix_solid_reactive_multinexus_range(uint8_t start, effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 }; + uint8_t count = g_last_hit_tracker.count; + for (uint8_t i = led_min; i < led_max; i++) { + hsv.v = 0; + point_t point = g_rgb_leds[i].point; + for (uint8_t j = start; j < count; j++) { + int16_t dx = point.x - g_last_hit_tracker.x[j]; + int16_t dy = point.y - g_last_hit_tracker.y[j]; + uint8_t dist = sqrt16(dx * dx + dy * dy); + int16_t dist2 = 8; + uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist; + if (effect > 255) + effect = 255; + if (dist > 72) + effect = 255; + if ((dx > dist2 || dx < -dist2) && (dy > dist2 || dy < -dist2)) + effect = 255; + hsv.v = qadd8(hsv.v, 255 - effect); + hsv.h = rgb_matrix_config.hue + dy / 4; + } + hsv.v = scale8(hsv.v, rgb_matrix_config.val); + RGB rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < DRIVER_LED_TOTAL; +} + +bool rgb_matrix_solid_reactive_multinexus(effect_params_t* params) { + return rgb_matrix_solid_reactive_multinexus_range(0, params); +} + +bool rgb_matrix_solid_reactive_nexus(effect_params_t* params) { + return rgb_matrix_solid_reactive_multinexus_range(qsub8(g_last_hit_tracker.count, 1), params); +} + +#endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix_animations/solid_reactive_wide.h b/quantum/rgb_matrix_animations/solid_reactive_wide.h new file mode 100644 index 0000000000..abb01892ed --- /dev/null +++ b/quantum/rgb_matrix_animations/solid_reactive_wide.h @@ -0,0 +1,42 @@ +#pragma once +#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED +#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) + +extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern rgb_config_t rgb_matrix_config; +extern last_hit_t g_last_hit_tracker; + +static bool rgb_matrix_solid_reactive_multiwide_range(uint8_t start, effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 }; + uint8_t count = g_last_hit_tracker.count; + for (uint8_t i = led_min; i < led_max; i++) { + hsv.v = 0; + point_t point = g_rgb_leds[i].point; + for (uint8_t j = start; j < count; j++) { + int16_t dx = point.x - g_last_hit_tracker.x[j]; + int16_t dy = point.y - g_last_hit_tracker.y[j]; + uint8_t dist = sqrt16(dx * dx + dy * dy); + uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) + dist * 5; + if (effect > 255) + effect = 255; + hsv.v = qadd8(hsv.v, 255 - effect); + } + hsv.v = scale8(hsv.v, rgb_matrix_config.val); + RGB rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < DRIVER_LED_TOTAL; +} + +bool rgb_matrix_solid_reactive_multiwide(effect_params_t* params) { + return rgb_matrix_solid_reactive_multiwide_range(0, params); +} + +bool rgb_matrix_solid_reactive_wide(effect_params_t* params) { + return rgb_matrix_solid_reactive_multiwide_range(qsub8(g_last_hit_tracker.count, 1), params); +} + +#endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED From 6d73fe12779d6e8527d404572810ea95e714dce7 Mon Sep 17 00:00:00 2001 From: Takeshi ISHII <2170248+mtei@users.noreply.github.com> Date: Tue, 23 Apr 2019 03:20:13 +0900 Subject: [PATCH 48/61] fix LIB_SRC and QUANTUM_LIB_SRC for ARM (#5623) * fix LIB_SRC and QUANTUM_LIB_SRC for ARM(chibios) * remove ARFLAGS * tmk_core/arm_atsam.mk:AR: remove 'rcs' --- tmk_core/arm_atsam.mk | 2 +- tmk_core/avr.mk | 2 +- tmk_core/rules.mk | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tmk_core/arm_atsam.mk b/tmk_core/arm_atsam.mk index 06823fb629..25a3411f4f 100644 --- a/tmk_core/arm_atsam.mk +++ b/tmk_core/arm_atsam.mk @@ -6,7 +6,7 @@ CC = arm-none-eabi-gcc OBJCOPY = arm-none-eabi-objcopy OBJDUMP = arm-none-eabi-objdump SIZE = arm-none-eabi-size -AR = arm-none-eabi-ar rcs +AR = arm-none-eabi-ar NM = arm-none-eabi-nm HEX = $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index f6af3f5e29..6bf86d58a8 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -6,7 +6,7 @@ CC = avr-gcc OBJCOPY = avr-objcopy OBJDUMP = avr-objdump SIZE = avr-size -AR = avr-ar rcs +AR = avr-ar NM = avr-nm HEX = $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index 3a322cee4f..6d2bb51f07 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -331,7 +331,7 @@ $1/%.o : %.S $1/asflags.txt $1/compiler.txt | $(BEGIN) $1/%.a : $1/%.o @mkdir -p $$(@D) @$(SILENT) || printf "Archiving: $$<" | $$(AWK_CMD) - $$(eval CMD=$$(AR) $$@ $$<) + $$(eval CMD=$$(AR) rcs $$@ $$<) @$$(BUILD_CMD) $1/force: From a2cec0594b15dc667adf7f1b0e35cb698dc1758d Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 22 Apr 2019 11:55:55 -0700 Subject: [PATCH 49/61] [Keymap] Update to Drashna Keymaps (#5594) * Start to standardize macro timer * Update Fractal layout Specifically, limit the RGB Lighting, since it's too many for the power, and only have the KITT annimation on the front * Update Iris keymap to use I2C for transport * Remove TAP_CODE_DELAY from keyboard in favor of global setting * Remove Woodpad Since it\'s no longer in my possession * Only enable LTO on AVR boards * Run matrix_scans while doing startup light * Run matrix_scan to get split keyboard code synced properly * Fix rgb mode * Remove custom debouncing settings * Make RGB Light Startup Animation optional * Fix opt def * Remove extra tap code delay value * Fix references to keebio boards * Add support for LP Iris keyboard * Add backlight code * Make startup animation optional * Update gitlab ci script * Remove port declaration * Revert avrgcc changes to gitlab ci file * Don't re-set mods * Remove MACRO_TIMER define * Add custom name for crkbd * Add name for Prime M pad * Add names for ortho 4x12 boards * Add some additional handling for rgb init * Change thumb clusters on ergodox * Switch Orthodox to I2C * Fix Space in ergodox keymap * Use OSL for ergodox layout * Ugh, can't find a good layout * Fix typo * Fix up animation startup * Cries in AVR * Fix makefiles for ergodox ez boards * Add support for "secret songs" in my userspace * Reset debounce to 5ms for Ergodox EZ * Fix gitlab CI yaml file * More crying in AVR * Cannot use rgb light and rgb matrix at the same time due to the WS2812 rgb matrix PR until the "Coexistance" PR is merged * Update ODox for split common and i2c * Add split config * Impement Split code * Add support for xscorpion OLED code * Add OLED display config * Fix OLED screen font * Get OLED set up in vertical mode * Remove old OLED code * add per key support for crkbd * Fix split changes * RGB Tweeaks * More OLED tweaks * Fix rotation stuff * Fix more OLED stuff * Remove custom Debounce from Ergodox layout since it's no longer needed --- keyboards/crkbd/keymaps/drashna/config.h | 11 +- keyboards/crkbd/keymaps/drashna/glcdfont.c | 240 ++++++++++++++++++ keyboards/crkbd/keymaps/drashna/keymap.c | 123 +++++++++ keyboards/crkbd/keymaps/drashna/rules.mk | 37 ++- .../woodpad/keymaps/drashna/README.md | 25 -- .../woodpad/keymaps/drashna/config.h | 45 ---- .../woodpad/keymaps/drashna/keymap.c | 95 ------- .../woodpad/keymaps/drashna/rules.mk | 10 - .../keebio/iris/keymaps/drashna/config.h | 8 +- .../keebio/iris/keymaps/drashna/keymap.c | 11 + .../keebio/iris/keymaps/drashna/rules.mk | 5 +- .../keebio/iris/keymaps/drashna_lp/config.h | 48 ++++ .../keebio/iris/keymaps/drashna_lp/keymap.c | 1 + .../keebio/iris/keymaps/drashna_lp/rules.mk | 7 + .../keebio/iris/keymaps/drashna_old/config.h | 4 +- keyboards/orthodox/keymaps/drashna/config.h | 5 +- keyboards/orthodox/keymaps/drashna/keymap.c | 2 +- keyboards/orthodox/keymaps/drashna/rules.mk | 4 +- layouts/community/ergodox/drashna/config.h | 1 - layouts/community/ergodox/drashna/keymap.c | 16 +- layouts/community/ergodox/drashna/rules.mk | 3 + .../community/ergodox/drashna_glow/config.h | 8 +- .../community/ergodox/drashna_glow/rules.mk | 7 +- layouts/community/numpad_5x6/drashna/config.h | 6 +- layouts/community/numpad_5x6/drashna/rules.mk | 1 + layouts/community/ortho_4x12/drashna/config.h | 13 +- layouts/community/ortho_4x12/drashna/keymap.c | 2 - layouts/community/ortho_4x12/drashna/rules.mk | 12 +- layouts/community/ortho_5x12/drashna/config.h | 6 + users/drashna/.gitignore | 3 + users/drashna/.gitlab-ci.yml | 30 +-- users/drashna/config.h | 2 +- users/drashna/drashna.c | 18 +- users/drashna/drashna.h | 6 +- users/drashna/process_records.c | 20 +- users/drashna/process_records.h | 2 + users/drashna/rgb_stuff.c | 25 +- users/drashna/rules.mk | 7 +- 38 files changed, 569 insertions(+), 300 deletions(-) create mode 100644 keyboards/crkbd/keymaps/drashna/glcdfont.c delete mode 100644 keyboards/handwired/woodpad/keymaps/drashna/README.md delete mode 100644 keyboards/handwired/woodpad/keymaps/drashna/config.h delete mode 100644 keyboards/handwired/woodpad/keymaps/drashna/keymap.c delete mode 100644 keyboards/handwired/woodpad/keymaps/drashna/rules.mk create mode 100644 keyboards/keebio/iris/keymaps/drashna_lp/config.h create mode 100644 keyboards/keebio/iris/keymaps/drashna_lp/keymap.c create mode 100644 keyboards/keebio/iris/keymaps/drashna_lp/rules.mk create mode 100644 users/drashna/.gitignore diff --git a/keyboards/crkbd/keymaps/drashna/config.h b/keyboards/crkbd/keymaps/drashna/config.h index cbc3feeb61..6f2665f3ac 100644 --- a/keyboards/crkbd/keymaps/drashna/config.h +++ b/keyboards/crkbd/keymaps/drashna/config.h @@ -27,7 +27,7 @@ along with this program. If not, see . // #define MASTER_RIGHT #define EE_HANDS -#define SSD1306OLED +// #define SSD1306OLED #define USE_SERIAL_PD2 @@ -48,3 +48,12 @@ along with this program. If not, see . #define B6_AUDIO // #define NO_MUSIC_MODE #endif + +#undef PRODUCT +#define PRODUCT Drashna Hacked Corne Keyboard + +#define OLED_FONT_H "keyboards/crkbd/keymaps/drashna/glcdfont.c" +// #define OLED_FONT_WIDTH 5 +// #define OLED_FONT_HEIGHT 7 + +#define TAPPING_TERM_PER_KEY diff --git a/keyboards/crkbd/keymaps/drashna/glcdfont.c b/keyboards/crkbd/keymaps/drashna/glcdfont.c new file mode 100644 index 0000000000..28521b4289 --- /dev/null +++ b/keyboards/crkbd/keymaps/drashna/glcdfont.c @@ -0,0 +1,240 @@ +#pragma once + +#ifdef __AVR__ + #include + #include +#elif defined(ESP8266) + #include +#else + #define PROGMEM +#endif + +// Helidox 8x6 font with QMK Firmware Logo +// Online editor: http://teripom.x0.com/ + +const unsigned char font[] PROGMEM = { +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, +0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, +0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, +0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, +0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, +0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, +0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, +0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, +0x00, 0x18, 0x24, 0x18, 0x00, 0x00, +0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, +0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, +0x26, 0x29, 0x79, 0x29, 0x26, 0x00, +0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, +0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, +0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, +0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, +0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, +0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, +0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, +0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, +0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, +0x60, 0x60, 0x60, 0x60, 0x60, 0x00, +0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, +0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, +0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, +0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, +0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, +0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, +0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, +0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, +0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, +0x00, 0x07, 0x00, 0x07, 0x00, 0x00, +0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, +0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, +0x23, 0x13, 0x08, 0x64, 0x62, 0x00, +0x36, 0x49, 0x56, 0x20, 0x50, 0x00, +0x00, 0x08, 0x07, 0x03, 0x00, 0x00, +0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, +0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, +0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, +0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, +0x00, 0x80, 0x70, 0x30, 0x00, 0x00, +0x08, 0x08, 0x08, 0x08, 0x08, 0x00, +0x00, 0x00, 0x60, 0x60, 0x00, 0x00, +0x20, 0x10, 0x08, 0x04, 0x02, 0x00, +0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, +0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, +0x72, 0x49, 0x49, 0x49, 0x46, 0x00, +0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, +0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, +0x27, 0x45, 0x45, 0x45, 0x39, 0x00, +0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, +0x41, 0x21, 0x11, 0x09, 0x07, 0x00, +0x36, 0x49, 0x49, 0x49, 0x36, 0x00, +0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, +0x00, 0x00, 0x14, 0x00, 0x00, 0x00, +0x00, 0x40, 0x34, 0x00, 0x00, 0x00, +0x00, 0x08, 0x14, 0x22, 0x41, 0x00, +0x14, 0x14, 0x14, 0x14, 0x14, 0x00, +0x00, 0x41, 0x22, 0x14, 0x08, 0x00, +0x02, 0x01, 0x59, 0x09, 0x06, 0x00, +0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, +0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, +0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, +0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, +0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, +0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, +0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, +0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, +0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, +0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, +0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, +0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, +0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, +0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, +0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, +0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, +0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, +0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, +0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, +0x26, 0x49, 0x49, 0x49, 0x32, 0x00, +0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, +0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, +0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, +0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, +0x63, 0x14, 0x08, 0x14, 0x63, 0x00, +0x03, 0x04, 0x78, 0x04, 0x03, 0x00, +0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, +0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, +0x02, 0x04, 0x08, 0x10, 0x20, 0x00, +0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, +0x04, 0x02, 0x01, 0x02, 0x04, 0x00, +0x40, 0x40, 0x40, 0x40, 0x40, 0x00, +0x00, 0x03, 0x07, 0x08, 0x00, 0x00, +0x20, 0x54, 0x54, 0x78, 0x40, 0x00, +0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, +0x38, 0x44, 0x44, 0x44, 0x28, 0x00, +0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, +0x38, 0x54, 0x54, 0x54, 0x18, 0x00, +0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, +0x18, 0x24, 0x24, 0x1C, 0x78, 0x00, +0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, +0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, +0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, +0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, +0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, +0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, +0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, +0x38, 0x44, 0x44, 0x44, 0x38, 0x00, +0x7C, 0x18, 0x24, 0x24, 0x18, 0x00, +0x18, 0x24, 0x24, 0x18, 0x7C, 0x00, +0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, +0x48, 0x54, 0x54, 0x54, 0x24, 0x00, +0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, +0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, +0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, +0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, +0x44, 0x28, 0x10, 0x28, 0x44, 0x00, +0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00, +0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, +0x00, 0x08, 0x36, 0x41, 0x00, 0x00, +0x00, 0x00, 0x77, 0x00, 0x00, 0x00, +0x00, 0x41, 0x36, 0x08, 0x00, 0x00, +0x02, 0x01, 0x02, 0x04, 0x02, 0x00, +0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, +0xF0, 0xF8, 0xF8, 0x18, 0x00, 0xC0, +0xF0, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, +0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0, +0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, +0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, +0x80, 0xC0, 0xE0, 0xE0, 0xE0, 0xE0, +0xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0x80, +0x00, 0x00, 0x00, 0xE0, 0xE0, 0xC0, +0xC0, 0xE0, 0xE0, 0xE0, 0xE0, 0x00, +0x00, 0xE0, 0xE0, 0xC0, 0xC0, 0xE0, +0xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0x80, +0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, +0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, +0xE0, 0xE0, 0xC0, 0x80, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, +0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, +0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, +0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00, +0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B, +0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, +0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE, +0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0xF8, 0xFC, 0xFE, +0xFF, 0xE0, 0x00, 0xFF, 0xFF, 0xFF, +0xFF, 0xFF, 0xFF, 0x80, 0xFF, 0xFF, +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +0xFF, 0x1F, 0x07, 0x01, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0xFF, 0xFF, 0xFF, 0x81, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x81, +0xC3, 0xC3, 0xC3, 0x00, 0x00, 0xFF, +0xFF, 0xFF, 0x81, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x81, 0xFF, 0xFF, +0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, +0x01, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0xFF, 0xFF, 0xFF, 0x01, 0x00, +0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, +0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, +0x9D, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, +0x1C, 0x9D, 0xDF, 0xDF, 0xDF, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, +0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, +0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, +0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00, +0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20, +0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, +0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F, +0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x03, 0x0F, 0x1F, +0x3F, 0x3F, 0x3F, 0x3F, 0x1F, 0x1F, +0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x3F, +0x3F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, +0x7F, 0x7C, 0x78, 0x78, 0x38, 0x1C, +0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x01, 0x03, 0x07, 0x07, +0x07, 0x07, 0x07, 0x07, 0x07, 0x07, +0x03, 0x01, 0x00, 0x00, 0x00, 0x00, +0x01, 0x03, 0x07, 0x07, 0x07, 0x07, +0x07, 0x07, 0x07, 0x07, 0x03, 0x01, +0x00, 0x00, 0x00, 0x07, 0x07, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x07, 0x07, 0x07, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x07, 0x07, +0x07, 0x00, 0x00, 0x00, 0x01, 0x03, +0x07, 0x07, 0x07, 0x07, 0x07, 0x07, +0x07, 0x07, 0x03, 0x01, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; diff --git a/keyboards/crkbd/keymaps/drashna/keymap.c b/keyboards/crkbd/keymaps/drashna/keymap.c index 91f0ebfa27..aaace9483a 100644 --- a/keyboards/crkbd/keymaps/drashna/keymap.c +++ b/keyboards/crkbd/keymaps/drashna/keymap.c @@ -7,6 +7,9 @@ #ifdef SSD1306OLED #include "ssd1306.h" #endif +#ifdef OLED_DRIVER_ENABLE + #include "oled_driver.h" +#endif extern keymap_config_t keymap_config; extern uint8_t is_master; @@ -288,3 +291,123 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { } #endif + + +#ifdef OLED_DRIVER_ENABLE +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + if (is_master) { + return OLED_ROTATION_270; + } else { + return rotation; + } +} + +void render_crkbd_logo(void) { + static const char PROGMEM crkbd_logo[] = { + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, + 0}; + oled_write_P(crkbd_logo, false); +} + + +void render_status(void) { + + oled_write_P(PSTR("Layer"), false); + switch (biton32(layer_state)) { + case 0: + oled_write_P(PSTR("Base "), false); + break; + case _RAISE: + oled_write_P(PSTR("Raise"), false); + break; + case _LOWER: + oled_write_P(PSTR("Lower"), false); + break; + case _ADJUST: + oled_write_P(PSTR("Adjst"), false); + break; + default: + oled_write_P(PSTR("Unkn "), false); + break; + } + oled_write_P(PSTR("Lyout"), false); + switch (biton32(default_layer_state)) { + case _QWERTY: + oled_write_P(PSTR("QWRTY"), false); + break; + case _COLEMAK: + oled_write_P(PSTR("COLMK"), false); + break; + case _DVORAK: + oled_write_P(PSTR("DVRAK"), false); + break; + case _WORKMAN: + oled_write_P(PSTR("WRKMN"), false); + break; + case _NORMAN: + oled_write_P(PSTR("NORMN"), false); + break; + case _MALTRON: + oled_write_P(PSTR("MLTRN"), false); + break; + case _EUCALYN: + oled_write_P(PSTR("ECLYN"), false); + break; + case _CARPLAX: + oled_write_P(PSTR("CRPLX"), false); + break; + } + + uint8_t modifiers = get_mods(); + uint8_t one_shot = get_oneshot_mods(); + + oled_write_P(PSTR("Mods:"), false); + oled_write_P( (modifiers & MOD_MASK_CTRL || one_shot & MOD_MASK_CTRL ) ? PSTR(" CTL ") : PSTR(" "), false); + oled_write_P( (modifiers & MOD_MASK_GUI || one_shot & MOD_MASK_GUI ) ? PSTR(" GUI ") : PSTR(" "), false); + oled_write_P( (modifiers & MOD_MASK_ALT || one_shot & MOD_MASK_ALT ) ? PSTR(" ALT ") : PSTR(" "), false); + oled_write_P( (modifiers & MOD_MASK_SHIFT || one_shot & MOD_MASK_SHIFT) ? PSTR(" SFT ") : PSTR(" "), false); + + + oled_write_P(PSTR("BTMGK"), false); + static const char PROGMEM mode_logo[4][4] = { + {0x95,0x96,0x0a,0}, + {0xb5,0xb6,0x0a,0}, + {0x97,0x98,0x0a,0}, + {0xb7,0xb8,0x0a,0} }; + + if (keymap_config.swap_lalt_lgui != false) { + oled_write_P(mode_logo[0], false); + oled_write_P(mode_logo[1], false); + } else { + oled_write_P(mode_logo[2], false); + oled_write_P(mode_logo[3], false); + } + + uint8_t led_usb_state = host_keyboard_leds(); + oled_write_P(PSTR("Lock:"), false); + oled_write_P(led_usb_state & (1<. - */ - -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include QMK_KEYBOARD_CONFIG_H - -#if (defined(TAP_DANCE_ENABLE) && !defined(TAPPING_TERM)) -#define TAPPING_TERM 200 -#endif // TAP_DANCE_ENABLE - - -#define B5_AUDIO - - -#ifdef RGBLIGHT_ENABLE -#define RGB_DI_PIN D3 -#define RGBLED_NUM 14 // Number of LEDs -#define RGBLIGHT_ANIMATIONS -#define RGBLIGHT_HUE_STEP 12 -#define RGBLIGHT_SAT_STEP 12 -#define RGBLIGHT_VAL_STEP 12 -#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 4 -#define RGBLIGHT_EFFECT_SNAKE_LENGTH 3 -#define RGBLIGHT_EFFECT_BREATHE_CENTER 1 -#define RGBLIGHT_SLEEP -#endif // RGBLIGHT_ENABLE - -#define FORCE_NKRO - -#endif diff --git a/keyboards/handwired/woodpad/keymaps/drashna/keymap.c b/keyboards/handwired/woodpad/keymaps/drashna/keymap.c deleted file mode 100644 index 20b4e064eb..0000000000 --- a/keyboards/handwired/woodpad/keymaps/drashna/keymap.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Copyright 2017 REPLACE_WITH_YOUR_NAME - * - * 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 QMK_KEYBOARD_H -#include "drashna.h" - - // Each layer gets a name for readability, which is then used in the keymap matrix below. - // The underscores don't mean anything - you can have a layer called STUFF or any other name. - // Layer names don't all need to be of the same length, obviously, and you can also skip them - // entirely and just use numbers. - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[_NUMLOCK] = KEYMAP( /* Base */ - TG(_NAV), TG(_DIABLO), TG(_MACROS), KC_PSLS,\ - KC_P7, KC_P8, KC_P9, KC_PAST, \ - KC_P4, KC_P5, KC_P6, KC_PMNS, \ - KC_P1, KC_P2, KC_P3, KC_PPLS, \ - LT(_MEDIA,KC_P0), KC_PDOT, KC_COLN, KC_PENT \ -), -[_NAV] = KEYMAP( /* Base */ - _______, _______, _______, _______,\ - KC_HOME, KC_UP, KC_PGUP, _______, \ - KC_LEFT, XXXXXXX, KC_RIGHT, _______, \ - KC_END, KC_DOWN, KC_PGDN, _______, \ - KC_INS, KC_DEL, _______, _______ \ -), -[_DIABLO] = KEYMAP( /* Base */ - KC_ESC, _______, XXXXXXX, _______,\ - KC_S, KC_I, KC_F, KC_M, \ - KC_1, KC_2, KC_3, KC_4, \ - KC_D3_1, KC_D3_2, KC_D3_3, KC_D3_4, \ - XXXXXXX, KC_DIABLO_CLEAR, KC_Q, SFT_T(KC_SPACE) \ -), - -[_MACROS] = KEYMAP( /* Base */ - KC_OVERWATCH, XXXXXXX, _______, XXXXXXX,\ - KC_JUSTGAME, XXXXXXX, XXXXXXX, KC_C9, \ - XXXXXXX, XXXXXXX, KC_AIM, KC_GGEZ, \ - KC_SYMM, KC_TORB, XXXXXXX, KC_GOODGAME, \ - KC_SALT, KC_MORESALT, KC_SALTHARD, KC_GLHF \ -), -[_MEDIA] = KEYMAP( /* Base */ - KC_RESET, KC_MUTE, KC_VOLD, KC_VOLU,\ - KC_MAKE, _______, RGB_HUI, RGB_HUD, \ - KC_MPLY, KC_MSTP, KC_MPRV, KC_MNXT, \ - RGB_TOG, RGB_MOD, RGB_SAI, RGB_VAI, \ - _______, KC_RGB_T, RGB_SAD, RGB_VAD \ -), - -}; - - -void numlock_led_on(void) { - PORTF |= (1 << 7); -} - -void numlock_led_off(void) { - PORTF &= ~(1 << 7); -} - - - -void matrix_init_keymap(void) { - // set Numlock LED to output and low - DDRF |= (1 << 7); - PORTF &= ~(1 << 7); -} - -void matrix_scan_keymap(void) { - numlock_led_off(); - if ((is_overwatch && biton32(layer_state) == _MACROS) || (biton32(layer_state) == _NUMLOCK)) { - numlock_led_on(); - } - - // Run Diablo 3 macro checking code. -} - -void led_set_keymap(uint8_t usb_led) { - if (!(usb_led & (1<. /* Use I2C or Serial, not both */ -#define USE_SERIAL -#undef USE_I2C +// #define USE_SERIAL +#define USE_I2C /* Select hand configuration */ @@ -31,7 +31,7 @@ along with this program. If not, see . #ifdef RGBLIGHT_ENABLE #undef RGBLED_NUM #define RGBLED_NUM 18 // Number of LEDs - +#define RGBLED_SPLIT { 9, 9 } #define RGBLIGHT_HUE_STEP 12 #define RGBLIGHT_SAT_STEP 12 #define RGBLIGHT_VAL_STEP 12 @@ -55,7 +55,7 @@ along with this program. If not, see . #define QMK_SPEAKER C6 #undef PRODUCT -#ifdef KEYBOARD_iris_rev2 +#ifdef KEYBOARD_keebio_iris_rev2 #define PRODUCT Drashna Hacked Iris Rev.2 #endif diff --git a/keyboards/keebio/iris/keymaps/drashna/keymap.c b/keyboards/keebio/iris/keymaps/drashna/keymap.c index 0c3b0d6d44..b306b6928a 100644 --- a/keyboards/keebio/iris/keymaps/drashna/keymap.c +++ b/keyboards/keebio/iris/keymaps/drashna/keymap.c @@ -121,3 +121,14 @@ void matrix_init_keymap(void) { writePinHigh(B0); #endif } + + +void keyboard_post_init_keymap(void) { +#if BACKLIGHT_ENABLE + backlight_enable(); + backlight_level(5); + #ifdef BACKLIGHT_BREATHING + breathing_enable(); + #endif +#endif +} diff --git a/keyboards/keebio/iris/keymaps/drashna/rules.mk b/keyboards/keebio/iris/keymaps/drashna/rules.mk index e8035176ef..bac5f95f3a 100644 --- a/keyboards/keebio/iris/keymaps/drashna/rules.mk +++ b/keyboards/keebio/iris/keymaps/drashna/rules.mk @@ -5,13 +5,14 @@ CONSOLE_ENABLE = no # Console for debug(+400) COMMAND_ENABLE = no # Commands for debug and configuration TAP_DANCE_ENABLE = no RGBLIGHT_ENABLE = yes -AUDIO_ENABLE = yes +AUDIO_ENABLE = no NKRO_ENABLE = yes BACKLIGHT_ENABLE = no SWAP_HANDS_ENABLE = no -INDICATOR_LIGHTS = yes +INDICATOR_LIGHTS = no MACROS_ENABLED = no RGBLIGHT_TWINKLE = no +RGBLIGHT_STARTUP_ANIMATION = yes BOOTLOADER = qmk-dfu diff --git a/keyboards/keebio/iris/keymaps/drashna_lp/config.h b/keyboards/keebio/iris/keymaps/drashna_lp/config.h new file mode 100644 index 0000000000..4e2bf729f2 --- /dev/null +++ b/keyboards/keebio/iris/keymaps/drashna_lp/config.h @@ -0,0 +1,48 @@ +/* +Copyright 2017 Danny Nguyen + +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 . +*/ + +#pragma once + +/* Use I2C or Serial, not both */ +#include "../drashna/config.h" + +#ifdef RGBLIGHT_ENABLE +#undef RGBLED_NUM +#define RGBLED_NUM 16 // Number of LEDs +#undef RGBLED_SPLIT +#define RGBLED_SPLIT { 8, 8 } +#endif + +#undef PRODUCT +#ifdef KEYBOARD_keebio_iris_rev2 +#define PRODUCT Drashna Hacked Iris LP Rev.2 (Backlit) +#endif + +#undef SHFT_LED1 +#define SHFT_LED1 5 +#undef SHFT_LED2 +#define SHFT_LED2 10 + +#undef CTRL_LED1 +#define CTRL_LED1 6 +#undef CTRL_LED2 +#define CTRL_LED2 9 + +#undef ALT_LED1 +#define ALT_LED1 7 +#undef GUI_LED1 +#define GUI_LED1 8 diff --git a/keyboards/keebio/iris/keymaps/drashna_lp/keymap.c b/keyboards/keebio/iris/keymaps/drashna_lp/keymap.c new file mode 100644 index 0000000000..ff7bd09c0c --- /dev/null +++ b/keyboards/keebio/iris/keymaps/drashna_lp/keymap.c @@ -0,0 +1 @@ +// placeholder diff --git a/keyboards/keebio/iris/keymaps/drashna_lp/rules.mk b/keyboards/keebio/iris/keymaps/drashna_lp/rules.mk new file mode 100644 index 0000000000..d3f6f5550f --- /dev/null +++ b/keyboards/keebio/iris/keymaps/drashna_lp/rules.mk @@ -0,0 +1,7 @@ +USER_NAME := drashna +SRC += ../drashna/keymap.c + +include $(KEYBOARD_PATH_2)/keymaps/drashna/rules.mk + +AUDIO_ENABLE = no +BACKLIGHT_ENABLE = yes diff --git a/keyboards/keebio/iris/keymaps/drashna_old/config.h b/keyboards/keebio/iris/keymaps/drashna_old/config.h index b985c4dfc1..1b462d8cad 100644 --- a/keyboards/keebio/iris/keymaps/drashna_old/config.h +++ b/keyboards/keebio/iris/keymaps/drashna_old/config.h @@ -23,10 +23,12 @@ along with this program. If not, see . #ifdef RGBLIGHT_ENABLE #undef RGBLED_NUM #define RGBLED_NUM 16 // Number of LEDs +#undef RGBLED_SPLIT +#define RGBLED_SPLIT { 8, 8 } #endif #undef PRODUCT -#ifdef KEYBOARD_iris_rev2 +#ifdef KEYBOARD_keebio_iris_rev2 #define PRODUCT Drashna Hacked Iris Rev.2 (16 LED) #endif diff --git a/keyboards/orthodox/keymaps/drashna/config.h b/keyboards/orthodox/keymaps/drashna/config.h index a2eaf63c30..1f04d5298c 100644 --- a/keyboards/orthodox/keymaps/drashna/config.h +++ b/keyboards/orthodox/keymaps/drashna/config.h @@ -23,8 +23,8 @@ along with this program. If not, see . /* Use I2C or Serial, not both */ -#define USE_SERIAL -#undef USE_I2C +// #define USE_SERIAL +#define USE_I2C /* Select hand configuration */ @@ -41,6 +41,7 @@ along with this program. If not, see . #ifdef RGBLIGHT_ENABLE #define RGB_DI_PIN D3 #define RGBLED_NUM 16 // Number of LEDs +#define RGBLED_SPLIT { 8, 8 } #define RGBLIGHT_HUE_STEP 12 #define RGBLIGHT_SAT_STEP 12 diff --git a/keyboards/orthodox/keymaps/drashna/keymap.c b/keyboards/orthodox/keymaps/drashna/keymap.c index 0f23bd9aa0..b1d4069055 100644 --- a/keyboards/orthodox/keymaps/drashna/keymap.c +++ b/keyboards/orthodox/keymaps/drashna/keymap.c @@ -38,7 +38,7 @@ uint8_t last_osm; ) \ LAYOUT_wrapper( \ KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_BSPC, \ - KC_TAB, K11, K12, K13, K14, K15, OS_LALT, OS_LGUI, OS_RALT, OS_RGUI, K16, K17, K18, K19, K1A, KC_QUOT, \ + KC_TAB, K11, K12, K13, K14, K15, OS_LALT, OS_LGUI, OS_RALT, RAISE, K16, K17, K18, K19, K1A, KC_QUOT, \ KC_MLSF, CTL_T(K21), K22, K23, K24, K25, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, K26, K27, K28, K29, CTL_T(K2A), KC_MRSF \ ) #define LAYOUT_orthodox_base_wrapper(...) LAYOUT_orthodox_base(__VA_ARGS__) diff --git a/keyboards/orthodox/keymaps/drashna/rules.mk b/keyboards/orthodox/keymaps/drashna/rules.mk index a826c664a7..fdbfc94c9b 100644 --- a/keyboards/orthodox/keymaps/drashna/rules.mk +++ b/keyboards/orthodox/keymaps/drashna/rules.mk @@ -5,11 +5,13 @@ CONSOLE_ENABLE = no # Console for debug(+400) COMMAND_ENABLE = no # Commands for debug and configuration TAP_DANCE_ENABLE = no RGBLIGHT_ENABLE = yes -AUDIO_ENABLE = yes +AUDIO_ENABLE = no NKRO_ENABLE = yes INDICATOR_LIGHTS = yes MACROS_ENABLED = no RGBLIGHT_TWINKLE = no +RGBLIGHT_STARTUP_ANIMATION = yes + BOOTLOADER = qmk-dfu diff --git a/layouts/community/ergodox/drashna/config.h b/layouts/community/ergodox/drashna/config.h index 089441e52c..7b2ad4fa1c 100644 --- a/layouts/community/ergodox/drashna/config.h +++ b/layouts/community/ergodox/drashna/config.h @@ -14,4 +14,3 @@ #define PRODUCT DrashnaDox - Hacked ErgoDox EZ Shine #undef DEBOUNCE -#define DEBOUNCE 5 diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c index 428706e2d5..e7f43ad669 100644 --- a/layouts/community/ergodox/drashna/keymap.c +++ b/layouts/community/ergodox/drashna/keymap.c @@ -44,10 +44,10 @@ bool skip_leds = false; KC_TAB, K01, K02, K03, K04, K05, TG(_DIABLO), TG(_DIABLO), K06, K07, K08, K09, K0A, KC_BSLS, \ KC_C1R3, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, KC_QUOT, \ KC_MLSF, CTL_T(K21), K22, K23, K24, K25, TG(_GAMEPAD), TG(_GAMEPAD), K26, K27, K28, K29, CTL_T(K2A), KC_MRSF, \ - KC_GRV, OS_MEH, OS_HYPR, KC_LBRC, KC_RBRC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, UC(0x2E2E), \ - OS_LALT, OS_LGUI, OS_RGUI, CTL_T(KC_ESCAPE), \ - KC_HOME, KC_PGUP, \ - LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER) \ + KC_GRV, OS_MEH, OS_HYPR, KC_LBRC, KC_RBRC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, UC(0x2E2E), \ + OS_LALT, OS_LGUI, OS_RGUI, CTL_T(KC_ESCAPE), \ + KC_APP, KC_MENU, \ + KC_SPC, LT(_LOWER, KC_BSPC), OS_LWR, OS_RSE, LT(_RAISE, KC_DEL), KC_ENT \ ) #define LAYOUT_ergodox_pretty_base_wrapper(...) LAYOUT_ergodox_pretty_base(__VA_ARGS__) @@ -270,8 +270,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_LOWER] = LAYOUT_ergodox_pretty_wrapper( KC_F12, _________________FUNC_LEFT_________________, _______, _______, _________________FUNC_RIGHT________________, KC_F11, - KC_TILD, _________________LOWER_L1__________________, _______, _______, _________________LOWER_R1__________________, _______, - _______, ___________________BLANK___________________, _________________LOWER_R2__________________, KC_PIPE, + KC_TILD, _________________LOWER_L1__________________, _______, _______, _________________LOWER_R1__________________, KC_PIPE, + _______, ___________________BLANK___________________, _________________LOWER_R2__________________, KC_DQUO, _______, ___________________BLANK___________________, _______, _______, _________________LOWER_R3__________________, KC_PSCR, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PAUS, _______, _______, _______, _______, @@ -281,8 +281,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_RAISE] = LAYOUT_ergodox_pretty_wrapper( KC_F12, _________________FUNC_LEFT_________________, _______, _______, _________________FUNC_RIGHT________________, KC_F11, - KC_GRV, _________________RAISE_L1__________________, _______, _______, _________________RAISE_R1__________________, _______, - _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, + KC_GRV, _________________RAISE_L1__________________, _______, _______, _________________RAISE_R1__________________, KC_BSLS, + _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_QUOT, _______, _________________RAISE_L3__________________, _______, _______, _________________RAISE_R3__________________, KC_PSCR, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_SLCK, _______, _______, _______, _______, diff --git a/layouts/community/ergodox/drashna/rules.mk b/layouts/community/ergodox/drashna/rules.mk index 31488108b9..ee231321e3 100644 --- a/layouts/community/ergodox/drashna/rules.mk +++ b/layouts/community/ergodox/drashna/rules.mk @@ -14,3 +14,6 @@ UNICDOEMAP_ENABLE = no MACROS_ENABLED = no RGBLIGHT_TWINKLE = no INDICATOR_LIGHTS = no +RGBLIGHT_STARTUP_ANIMATION = yes + +DEBOUNCE_TYPE = eager_pk diff --git a/layouts/community/ergodox/drashna_glow/config.h b/layouts/community/ergodox/drashna_glow/config.h index a10c4bb297..e2d9594267 100644 --- a/layouts/community/ergodox/drashna_glow/config.h +++ b/layouts/community/ergodox/drashna_glow/config.h @@ -5,17 +5,11 @@ #undef PRODUCT #define PRODUCT DrashnaDox - Hacked ErgoDox EZ Glow -#undef DEBOUNCE -#define DEBOUNCE 5 - #ifdef RGB_MATRIX_ENABLE -// #define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot) +#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 true// turn off effects when suspended // #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 EECONFIG_RGB_MATRIX (uint32_t *)16 #endif - -#undef DEBOUNCE -#define DEBOUNCE 1 diff --git a/layouts/community/ergodox/drashna_glow/rules.mk b/layouts/community/ergodox/drashna_glow/rules.mk index 5cb47dae4e..ae9a2fb16c 100644 --- a/layouts/community/ergodox/drashna_glow/rules.mk +++ b/layouts/community/ergodox/drashna_glow/rules.mk @@ -1,7 +1,10 @@ USER_NAME := drashna -SRC += ../drashna/keymap.c --include $(LAYOUT_KEYMAP_PATH)/../drashna/rules.mk +CORRECTED_LAYOUT := $(LAYOUTS_REPO)/$(LAYOUT)/drashna + +SRC += $(CORRECTED_LAYOUT)/keymap.c + +-include $(CORRECTED_LAYOUT)/rules.mk ifneq (,$(findstring ergodox_ez,$(KEYBOARD))) RGBLIGHT_ENABLE = no diff --git a/layouts/community/numpad_5x6/drashna/config.h b/layouts/community/numpad_5x6/drashna/config.h index ec66940e02..e3a70694a7 100644 --- a/layouts/community/numpad_5x6/drashna/config.h +++ b/layouts/community/numpad_5x6/drashna/config.h @@ -14,5 +14,7 @@ #define RGBLIGHT_EFFECT_BREATHE_CENTER 1 #endif // RGBLIGHT_ENABLE - -#define TAP_CODE_DELAY 10 +#if defined(KEYBOARD_primekb_prime_m) +#undef PRODUCT +#define PRODUCT Drashna Hacked Prime_M Macro Pad +#endif diff --git a/layouts/community/numpad_5x6/drashna/rules.mk b/layouts/community/numpad_5x6/drashna/rules.mk index ed6fa8c791..62bbc365d1 100644 --- a/layouts/community/numpad_5x6/drashna/rules.mk +++ b/layouts/community/numpad_5x6/drashna/rules.mk @@ -7,3 +7,4 @@ INDICATOR_LIGHTS = no RGBLIGHT_TWINKLE = yes MACROS_ENABLED = no MAKE_BOOTLOADER = yes +RGBLIGHT_STARTUP_ANIMATION = yes diff --git a/layouts/community/ortho_4x12/drashna/config.h b/layouts/community/ortho_4x12/drashna/config.h index 1858ee3a4f..f8e12f33d7 100644 --- a/layouts/community/ortho_4x12/drashna/config.h +++ b/layouts/community/ortho_4x12/drashna/config.h @@ -36,6 +36,17 @@ #endif // KEYBOARD_planck_light +#if defined(KEYBOARD_planck) +#undef PRODUCT +#if defined(KEYBOARD_planck_light) +#define PRODUCT Drashna Hacked RGB Beacon (Planck Light) +#elif defined(KEYBOARD_planck_rev6) +#define PRODUCT Drashna Hacked Planck Rev6 +#elif defined(KEYBOARD_planck_EZ) +#define PRODUCT Drashna Hacked Planck EZ +#endif +#endif + /* * MIDI options */ @@ -59,5 +70,3 @@ /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ //#define MIDI_TONE_KEYCODE_OCTAVES 2 - -#define TAP_CODE_DELAY 10 diff --git a/layouts/community/ortho_4x12/drashna/keymap.c b/layouts/community/ortho_4x12/drashna/keymap.c index 28da1b2042..16defede96 100644 --- a/layouts/community/ortho_4x12/drashna/keymap.c +++ b/layouts/community/ortho_4x12/drashna/keymap.c @@ -139,10 +139,8 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { #ifdef BACKLIGHT_ENABLE backlight_step(); #endif - PORTE &= ~(1<<6); } else { unregister_code(KC_RSFT); - PORTE |= (1<<6); } return false; break; diff --git a/layouts/community/ortho_4x12/drashna/rules.mk b/layouts/community/ortho_4x12/drashna/rules.mk index f880432674..89acba9eb8 100644 --- a/layouts/community/ortho_4x12/drashna/rules.mk +++ b/layouts/community/ortho_4x12/drashna/rules.mk @@ -6,13 +6,15 @@ COMMAND_ENABLE = no # Commands for debug and configuration TAP_DANCE_ENABLE = no AUDIO_ENABLE = yes ifeq (,$(findstring planck/rev6,$(KEYBOARD))) # Make sure it's NOT the Planck Rev6 - RGBLIGHT_ENABLE = yes - INDICATOR_LIGHTS = yes - RGBLIGHT_TWINKLE = yes + RGBLIGHT_ENABLE = yes + INDICATOR_LIGHTS = yes + RGBLIGHT_TWINKLE = yes + RGBLIGHT_STARTUP_ANIMATION = yes endif ifneq (,$(findstring planck/light,$(KEYBOARD))) # Make sure it IS the Planck Light - RGB_MATRIX_ENABLE = yes - RGBLIGHT_ENABLE = yes + RGB_MATRIX_ENABLE = yes + RGBLIGHT_ENABLE = no + RGBLIGHT_STARTUP_ANIMATION = no endif ifeq ($(strip $(PROTOCOL)), VUSB) diff --git a/layouts/community/ortho_5x12/drashna/config.h b/layouts/community/ortho_5x12/drashna/config.h index e41dadc601..480bf658c3 100644 --- a/layouts/community/ortho_5x12/drashna/config.h +++ b/layouts/community/ortho_5x12/drashna/config.h @@ -13,4 +13,10 @@ #define RGBLIGHT_SAT_STEP 8 #undef RGBLIGHT_VAL_STEP #define RGBLIGHT_VAL_STEP 8 + #define RGBLIGHT_LIMIT_VAL 175 + #define RGBLIGHT_SLEEP + + #define RGBLIGHT_EFFECT_KNIGHT_OFFSET 3 + #define RGBLIGHT_EFFECT_KNIGHT_LED_NUM 14 + #endif diff --git a/users/drashna/.gitignore b/users/drashna/.gitignore new file mode 100644 index 0000000000..f84d34d907 --- /dev/null +++ b/users/drashna/.gitignore @@ -0,0 +1,3 @@ +secrets.c +secrets.h +drashna_song_list.h \ No newline at end of file diff --git a/users/drashna/.gitlab-ci.yml b/users/drashna/.gitlab-ci.yml index 9b18d44fb3..92813a27d3 100644 --- a/users/drashna/.gitlab-ci.yml +++ b/users/drashna/.gitlab-ci.yml @@ -3,7 +3,7 @@ stages: - build - deploy -Tests: +Preliminary Test: stage: test variables: GIT_SUBMODULE_STRATEGY: recursive @@ -12,12 +12,12 @@ Tests: image: ubuntu:18.10 before_script: - apt-get update -qy - - apt-get install -y build-essential avr-libc binutils-arm-none-eabi binutils-avr dfu-programmer dfu-util gcc gcc-arm-none-eabi gcc-avr git libnewlib-arm-none-eabi unzip wget zip + - apt-get install -y build-essential avr-libc binutils-arm-none-eabi binutils-avr dfu-programmer dfu-util gcc gcc-arm-none-eabi git libnewlib-arm-none-eabi gcc-avr unzip wget zip - avr-gcc --version - uname -a script: - make test:all - - make planck/rev6:default + - make planck/rev6:default planck/rev5:default QMK Firmware Defaults: stage: deploy @@ -47,29 +47,7 @@ Drashna Firmware: - apt-get install -y build-essential avr-libc binutils-arm-none-eabi binutils-avr dfu-programmer dfu-util gcc gcc-arm-none-eabi gcc-avr git libnewlib-arm-none-eabi unzip wget zip - avr-gcc --version script: - - make iris/rev2:drashna iris/rev2:drashna_old ergodox_ez:drashna ergodox_ez:drashna_glow viterbi/rev1:drashna orthodox/rev1:drashna orthodox/rev3:drashna crkbd:drashna planck/light:drashna planck/rev6:drashna fractal:drashna - artifacts: - name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" - paths: - - ./*.hex - - ./*.bin - expire_in: 1 month - -Firmware Deploy: - stage: deploy - dependencies: - - Drashna Firmware - variables: - GIT_SUBMODULE_STRATEGY: recursive - tags: - - linux - image: ubuntu:18.10 - before_script: - - apt-get update -qy - - apt-get install -y build-essential avr-libc binutils-arm-none-eabi binutils-avr dfu-programmer dfu-util gcc gcc-arm-none-eabi gcc-avr git libnewlib-arm-none-eabi unzip wget zip - - avr-gcc --version - script: - - make iris/rev2:drashna:production iris/rev2:drashna_old:production ergodox_ez:drashna ergodox_ez:drashna_glow viterbi/rev1:drashna:production orthodox/rev1:drashna:production orthodox/rev3:drashna:production crkbd:drashna:production planck/light:drashna planck/rev6:drashna fractal:drashna:production + - make keebio/iris/rev2:drashna keebio/iris/rev2:drashna_old ergodox_ez:drashna ergodox_ez:drashna_glow keebio/viterbi/rev1:drashna orthodox/rev1:drashna orthodox/rev3:drashna crkbd:drashna planck/light:drashna planck/rev6:drashna fractal:drashna primekb/prime_m:drashna -j16 --output-sync artifacts: name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" paths: diff --git a/users/drashna/config.h b/users/drashna/config.h index 2abd326dac..1680eb4cb1 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -82,4 +82,4 @@ #define NO_ACTION_MACRO #define NO_ACTION_FUNCTION -#define MACRO_TIMER 5 +#define TAP_CODE_DELAY 5 diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 6968a4b928..ec249dd224 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -38,9 +38,9 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) { } clear_keyboard(); tap_code(keycode); - wait_ms(50); - send_string_with_delay(str, MACRO_TIMER); - wait_ms(50); + wait_ms(TAP_CODE_DELAY); + send_string_with_delay(str, TAP_CODE_DELAY); + wait_ms(TAP_CODE_DELAY); tap_code(KC_ENTER); } if (override) wait_ms(3000); @@ -53,12 +53,10 @@ bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed) { this_timer= timer_read(); } else { if (timer_elapsed(this_timer) < TAPPING_TERM){ - register_code(code); - unregister_code(code); + tap_code(code); } else { register_code(mod_code); - register_code(code); - unregister_code(code); + tap_code(code); unregister_code(mod_code); } } @@ -70,12 +68,10 @@ bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t thi this_timer= timer_read(); } else { if (timer_elapsed(this_timer) < TAPPING_TERM){ - register_code(code); - unregister_code(code); + tap_code(code); } else { register_code(mod_code); - register_code(code); - unregister_code(code); + tap_code(code); unregister_code(mod_code); } } diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index c19b189434..6645626d98 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -27,7 +27,11 @@ along with this program. If not, see . #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) #include "rgb_stuff.h" #endif - +#if defined(AUDIO_ENABLE) && __GNUC__ > 7 + #if __has_include("drashna_song_list.h") + #include "drashna_song_list.h" + #endif +#endif /* Define layer names */ enum userspace_layers { diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c index 2d9025b375..2b6ccf510c 100644 --- a/users/drashna/process_records.c +++ b/users/drashna/process_records.c @@ -18,7 +18,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // If console is enabled, it will print the matrix position and status of each key pressed #ifdef KEYLOGGER_ENABLE - #if defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_iris_rev2) + #if defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_keebio_iris_rev2) xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.row, record->event.key.col, record->event.pressed); #else xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed); @@ -37,31 +37,29 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { uint8_t temp_mod = get_mods(); uint8_t temp_osm = get_oneshot_mods(); clear_mods(); clear_oneshot_mods(); - send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), MACRO_TIMER); + send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), TAP_CODE_DELAY); #ifndef MAKE_BOOTLOADER if ( ( temp_mod | temp_osm ) & MOD_MASK_SHIFT ) #endif { #if defined(__arm__) - send_string_with_delay_P(PSTR(":dfu-util"), MACRO_TIMER); + send_string_with_delay_P(PSTR(":dfu-util"), TAP_CODE_DELAY); #elif defined(BOOTLOADER_DFU) - send_string_with_delay_P(PSTR(":dfu"), MACRO_TIMER); + send_string_with_delay_P(PSTR(":dfu"), TAP_CODE_DELAY); #elif defined(BOOTLOADER_HALFKAY) - send_string_with_delay_P(PSTR(":teensy"), MACRO_TIMER); + send_string_with_delay_P(PSTR(":teensy"), TAP_CODE_DELAY); #elif defined(BOOTLOADER_CATERINA) - send_string_with_delay_P(PSTR(":avrdude"), MACRO_TIMER); + send_string_with_delay_P(PSTR(":avrdude"), TAP_CODE_DELAY); #endif // bootloader options } - if ( ( temp_mod | temp_osm ) & MOD_MASK_CTRL) { send_string_with_delay_P(PSTR(" -j8 --output-sync"), MACRO_TIMER); } - send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), MACRO_TIMER); - set_mods(temp_mod); - set_oneshot_mods(temp_osm); + if ( ( temp_mod | temp_osm ) & MOD_MASK_CTRL) { send_string_with_delay_P(PSTR(" -j8 --output-sync"), TAP_CODE_DELAY); } + send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), TAP_CODE_DELAY); } break; case VRSN: // Prints firmware version if (record->event.pressed) { - send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), MACRO_TIMER); + send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY); } break; diff --git a/users/drashna/process_records.h b/users/drashna/process_records.h index f7f2193ec6..5e3374d3f2 100644 --- a/users/drashna/process_records.h +++ b/users/drashna/process_records.h @@ -56,6 +56,8 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record); #define ADJUST MO(_ADJUST) #define TG_MODS TG(_MODS) #define TG_GAME TG(_GAMEPAD) +#define OS_LWR OSL(_LOWER) +#define OS_RSE OSL(_RAISE) #define KC_SEC1 KC_SECRET_1 #define KC_SEC2 KC_SECRET_2 diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index a98ad590cc..b5e145842f 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c @@ -247,17 +247,20 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { void keyboard_post_init_rgb(void) { -#ifdef RGBLIGHT_ENABLE - rgblight_enable_noeeprom(); - layer_state_set_user(layer_state); - uint16_t old_hue = rgblight_config.hue; - rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); - for (uint16_t i = 360; i > 0; i--) { - rgblight_sethsv_noeeprom( ( i + old_hue) % 360, 255, 255); - wait_ms(10); - } - layer_state_set_user(layer_state); +#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_STARTUP_ANIMATION) + if (userspace_config.rgb_layer_change) { rgblight_enable_noeeprom(); } + if (rgblight_config.enable) { + layer_state_set_user(layer_state); + uint16_t old_hue = rgblight_config.hue; + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + for (uint16_t i = 360; i > 0; i--) { + rgblight_sethsv_noeeprom( ( i + old_hue) % 360, 255, 255); + matrix_scan(); + wait_ms(10); + } + } #endif + layer_state_set_user(layer_state); } void matrix_scan_rgb(void) { @@ -278,7 +281,7 @@ uint32_t layer_state_set_rgb(uint32_t state) { switch (biton32(state)) { case _MACROS: rgblight_sethsv_noeeprom_orange(); - userspace_config.is_overwatch ? rgblight_effect_snake(RGBLIGHT_MODE_SNAKE + 2) : rgblight_effect_snake(RGBLIGHT_MODE_SNAKE + 3); + userspace_config.is_overwatch ? rgblight_mode_noeeprom(RGBLIGHT_MODE_SNAKE + 2) : rgblight_mode_noeeprom(RGBLIGHT_MODE_SNAKE + 3); break; case _MEDIA: rgblight_sethsv_noeeprom_chartreuse(); diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index 5050704a53..bef25e2594 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk @@ -9,7 +9,9 @@ ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) SRC += tap_dances.c endif -EXTRAFLAGS += -flto +ifeq ($(PLATFORM),AVR) + EXTRAFLAGS += -flto +endif ifeq ($(strip $(NO_SECRETS)), yes) OPT_DEFS += -DNO_SECRETS @@ -26,6 +28,9 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes) OPT_DEFS += -DRGBLIGHT_NOEEPROM endif + ifeq ($(strip $(RGBLIGHT_STARTUP_ANIMATION)), yes) + OPT_DEFS += -DRGBLIGHT_STARTUP_ANIMATION + endif endif ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) From ce8fb1eab923a8ce37022a898597048e5893b078 Mon Sep 17 00:00:00 2001 From: ishtob Date: Mon, 22 Apr 2019 23:26:51 -0400 Subject: [PATCH 50/61] Boston meetup 2019 (#5611) * Add boston_meetup folder for community meetup macropads * Modify OLED indicators to match macropad * PR cleanup * Spelling fix Co-Authored-By: ishtob * convert custom matrix to standard matrix defines * refactor layer define with enum * Remove un-used files * remove "\" in keymap --- keyboards/boston_meetup/2019/2019.c | 217 ++++++++++++++++++ keyboards/boston_meetup/2019/2019.h | 19 ++ keyboards/boston_meetup/2019/config.h | 196 ++++++++++++++++ keyboards/boston_meetup/2019/info.json | 12 + .../2019/keymaps/default/keymap.c | 166 ++++++++++++++ .../2019/keymaps/default/readme.md | 51 ++++ .../boston_meetup/2019/keymaps/readme.md | 22 ++ keyboards/boston_meetup/2019/readme.md | 13 ++ keyboards/boston_meetup/2019/rules.mk | 24 ++ keyboards/boston_meetup/boston_meetup.c | 2 + keyboards/boston_meetup/boston_meetup.h | 19 ++ keyboards/boston_meetup/config.h | 60 +++++ keyboards/boston_meetup/readme.md | 14 ++ keyboards/boston_meetup/rules.mk | 2 + 14 files changed, 817 insertions(+) create mode 100644 keyboards/boston_meetup/2019/2019.c create mode 100644 keyboards/boston_meetup/2019/2019.h create mode 100644 keyboards/boston_meetup/2019/config.h create mode 100644 keyboards/boston_meetup/2019/info.json create mode 100644 keyboards/boston_meetup/2019/keymaps/default/keymap.c create mode 100644 keyboards/boston_meetup/2019/keymaps/default/readme.md create mode 100644 keyboards/boston_meetup/2019/keymaps/readme.md create mode 100644 keyboards/boston_meetup/2019/readme.md create mode 100644 keyboards/boston_meetup/2019/rules.mk create mode 100644 keyboards/boston_meetup/boston_meetup.c create mode 100644 keyboards/boston_meetup/boston_meetup.h create mode 100644 keyboards/boston_meetup/config.h create mode 100644 keyboards/boston_meetup/readme.md create mode 100644 keyboards/boston_meetup/rules.mk diff --git a/keyboards/boston_meetup/2019/2019.c b/keyboards/boston_meetup/2019/2019.c new file mode 100644 index 0000000000..9baed223bc --- /dev/null +++ b/keyboards/boston_meetup/2019/2019.c @@ -0,0 +1,217 @@ +/* Copyright 2019 ishtob + * + * 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 "2019.h" +#include "qwiic.h" +#include "action_layer.h" +#include "haptic.h" + +#ifdef RGB_MATRIX_ENABLE +#include "rgblight.h" + +const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { + /*{row | col << 4} + | {x=0..224, y=0..64} + | | modifier + | | | */ + {{1|(3<<4)}, {188, 16}, 0}, + {{3|(3<<4)}, {187, 48}, 0}, + {{4|(2<<4)}, {149, 64}, 0}, + {{4|(1<<4)}, {112, 64}, 0}, + {{3|(0<<4)}, {37, 48}, 0}, + {{1|(0<<4)}, {38, 16}, 0} +}; +#endif + +uint8_t *o_fb; + +uint16_t counterst = 0; + + + +#ifdef QWIIC_MICRO_OLED_ENABLE + +/* screen off after this many milliseconds */ +#include "timer.h" +#define ScreenOffInterval 60000 /* milliseconds */ +static uint16_t last_flush; + +volatile uint8_t led_numlock = false; +volatile uint8_t led_capslock = false; +volatile uint8_t led_scrolllock = false; + +static uint8_t layer; +static bool queue_for_send = false; +static uint8_t encoder_value = 32; + +__attribute__ ((weak)) +void draw_ui(void) { + clear_buffer(); + last_flush = timer_read(); + send_command(DISPLAYON); + +/* Boston MK title is 55 x 10 pixels */ +#define NAME_X 0 +#define NAME_Y 0 + + draw_string(NAME_X + 1, NAME_Y + 2, "BOSTON MK", PIXEL_ON, NORM, 0); + +/* Layer indicator is 41 x 10 pixels */ +#define LAYER_INDICATOR_X 60 +#define LAYER_INDICATOR_Y 0 + + draw_string(LAYER_INDICATOR_X + 1, LAYER_INDICATOR_Y + 2, "LAYER", PIXEL_ON, NORM, 0); + draw_rect_filled_soft(LAYER_INDICATOR_X + 32, LAYER_INDICATOR_Y + 1, 9, 9, PIXEL_ON, NORM); + draw_char(LAYER_INDICATOR_X + 34, LAYER_INDICATOR_Y + 2, layer + 0x30, PIXEL_ON, XOR, 0); + +/* Matrix display is 12 x 12 pixels */ +#define MATRIX_DISPLAY_X 8 +#define MATRIX_DISPLAY_Y 16 + + for (uint8_t x = 0; x < MATRIX_ROWS; x++) { + for (uint8_t y = 0; y < MATRIX_COLS; y++) { + draw_pixel(MATRIX_DISPLAY_X + y + y + 2, MATRIX_DISPLAY_Y + x + x + 2,(matrix_get_row(x) & (1 << y)) > 0, NORM); + draw_pixel(MATRIX_DISPLAY_X + y + y + 3, MATRIX_DISPLAY_Y + x + x + 2,(matrix_get_row(x) & (1 << y)) > 0, NORM); + draw_pixel(MATRIX_DISPLAY_X + y + y + 2, MATRIX_DISPLAY_Y + x + x + 3,(matrix_get_row(x) & (1 << y)) > 0, NORM); + draw_pixel(MATRIX_DISPLAY_X + y + y + 3, MATRIX_DISPLAY_Y + x + x + 3,(matrix_get_row(x) & (1 << y)) > 0, NORM); + + } + } + draw_rect_soft(MATRIX_DISPLAY_X, MATRIX_DISPLAY_Y, 12, 12, PIXEL_ON, NORM); + /* hadron oled location on thumbnail */ + draw_rect_filled_soft(MATRIX_DISPLAY_X + 5, MATRIX_DISPLAY_Y + 2, 6, 2, PIXEL_ON, NORM); +/* + draw_rect_soft(0, 13, 64, 6, PIXEL_ON, NORM); + draw_line_vert(encoder_value, 13, 6, PIXEL_ON, NORM); + +*/ + +/* Mod display is 41 x 16 pixels */ +#define MOD_DISPLAY_X 60 +#define MOD_DISPLAY_Y 20 + + uint8_t mods = get_mods(); + if (mods & MOD_LSFT) { + draw_rect_filled_soft(MOD_DISPLAY_X + 0, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM); + draw_string(MOD_DISPLAY_X + 3, MOD_DISPLAY_Y + 2, "S", PIXEL_OFF, NORM, 0); + } else { + draw_string(MOD_DISPLAY_X + 3, MOD_DISPLAY_Y + 2, "S", PIXEL_ON, NORM, 0); + } + if (mods & MOD_LCTL) { + draw_rect_filled_soft(MOD_DISPLAY_X + 10, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM); + draw_string(MOD_DISPLAY_X + 13, MOD_DISPLAY_Y + 2, "C", PIXEL_OFF, NORM, 0); + } else { + draw_string(MOD_DISPLAY_X + 13, MOD_DISPLAY_Y + 2, "C", PIXEL_ON, NORM, 0); + } + if (mods & MOD_LALT) { + draw_rect_filled_soft(MOD_DISPLAY_X + 20, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM); + draw_string(MOD_DISPLAY_X + 23, MOD_DISPLAY_Y + 2, "A", PIXEL_OFF, NORM, 0); + } else { + draw_string(MOD_DISPLAY_X + 23, MOD_DISPLAY_Y + 2, "A", PIXEL_ON, NORM, 0); + } + if (mods & MOD_LGUI) { + draw_rect_filled_soft(MOD_DISPLAY_X + 30, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM); + draw_string(MOD_DISPLAY_X + 33, MOD_DISPLAY_Y + 2, "G", PIXEL_OFF, NORM, 0); + } else { + draw_string(MOD_DISPLAY_X + 33, MOD_DISPLAY_Y + 2, "G", PIXEL_ON, NORM, 0); + } + +/* Lock display is 23 x 32 */ +#define LOCK_DISPLAY_X 104 +#define LOCK_DISPLAY_Y 0 + + if (led_numlock == true) { + draw_rect_filled_soft(LOCK_DISPLAY_X, LOCK_DISPLAY_Y, 5 + (3 * 6), 9, PIXEL_ON, NORM); + draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 1, "NUM", PIXEL_OFF, NORM, 0); + } else if (led_numlock == false) { + draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 1, "NUM", PIXEL_ON, NORM, 0); + } + if (led_capslock == true) { + draw_rect_filled_soft(LOCK_DISPLAY_X + 0, LOCK_DISPLAY_Y + 11, 5 + (3 * 6), 9, PIXEL_ON, NORM); + draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 11 +1, "CAP", PIXEL_OFF, NORM, 0); + } else if (led_capslock == false) { + draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 11 +1, "CAP", PIXEL_ON, NORM, 0); + } + + if (led_scrolllock == true) { + draw_rect_filled_soft(LOCK_DISPLAY_X + 0, LOCK_DISPLAY_Y + 22, 5 + (3 * 6), 9, PIXEL_ON, NORM); + draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 22 +1, "SCR", PIXEL_OFF, NORM, 0); + } else if (led_scrolllock == false) { + draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 22 +1, "SCR", PIXEL_ON, NORM, 0); + } + send_buffer(); +} + +void led_set_user(uint8_t usb_led) { + if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) { + if (led_numlock == false){led_numlock = true;} + } else { + if (led_numlock == true){led_numlock = false;} + } + if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { + if (led_capslock == false){led_capslock = true;} + } else { + if (led_capslock == true){led_capslock = false;} + } + if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) { + if (led_scrolllock == false){led_scrolllock = true;} + } else { + if (led_scrolllock == true){led_scrolllock = false;} + } +} + +uint32_t layer_state_set_kb(uint32_t state) { + state = layer_state_set_user(state); + layer = biton32(state); + queue_for_send = true; + return state; +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + queue_for_send = true; + return process_record_user(keycode, record); +} + +void encoder_update_kb(uint8_t index, bool clockwise) { + encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64; + queue_for_send = true; +} + +#endif + +void matrix_init_kb(void) { + queue_for_send = true; + matrix_init_user(); +} + +void matrix_scan_kb(void) { +if (queue_for_send) { +#ifdef QWIIC_MICRO_OLED_ENABLE + draw_ui(); +#endif + queue_for_send = false; + } +#ifdef QWIIC_MICRO_OLED_ENABLE + if (timer_elapsed(last_flush) > ScreenOffInterval) { + send_command(DISPLAYOFF); /* 0xAE */ + } +#endif + if (counterst == 0) { + //testPatternFB(o_fb); + } + counterst = (counterst + 1) % 1024; + //rgblight_task(); + matrix_scan_user(); +} diff --git a/keyboards/boston_meetup/2019/2019.h b/keyboards/boston_meetup/2019/2019.h new file mode 100644 index 0000000000..fbba5c3154 --- /dev/null +++ b/keyboards/boston_meetup/2019/2019.h @@ -0,0 +1,19 @@ +/* Copyright 2019 ishtob + * + * 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 . + */ +#pragma once + +#include "boston_meetup.h" + diff --git a/keyboards/boston_meetup/2019/config.h b/keyboards/boston_meetup/2019/config.h new file mode 100644 index 0000000000..5652816446 --- /dev/null +++ b/keyboards/boston_meetup/2019/config.h @@ -0,0 +1,196 @@ +#pragma once + +/* USB Device descriptor parameter */ +#define DEVICE_VER 0x07E3 + +#undef MATRIX_ROWS +#undef MATRIX_COLS +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 4 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ + +#undef MATRIX_ROW_PINS +#undef MATRIX_COL_PINS + +#define MATRIX_ROW_PINS { A3, B8, B9, B1 } +#define MATRIX_COL_PINS { A7, A8, B2, B10 } + +#define NUMBER_OF_ENCODERS 1 +#define ENCODERS_PAD_A { B13 } +#define ENCODERS_PAD_B { B14 } + +//Audio +#undef AUDIO_VOICES +#undef C6_AUDIO + +#ifdef AUDIO_ENABLE + #define STARTUP_SONG SONG(ONE_UP_SOUND) + // #define STARTUP_SONG SONG(NO_SOUND) + +#define AUDIO_CLICKY + /* to enable clicky on startup */ + //#define AUDIO_CLICKY_ON +#define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f +#endif + +//configure qwiic micro_oled driver for the 128x32 oled +#ifdef QWIIC_MICRO_OLED_ENABLE + +#undef I2C_ADDRESS_SA0_1 +#define I2C_ADDRESS_SA0_1 0b0111100 +#define LCDWIDTH 128 +#define LCDHEIGHT 32 +#define micro_oled_rotate_180 + +#endif +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 6 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +//#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +//#define LOCKING_RESYNC_ENABLE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ + +#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 + +/* Haptic Driver initialization settings + * Feedback Control Settings */ +#define FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/ +#define FB_BRAKEFACTOR 6 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */ +#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */ + +/* default 3V ERM vibration motor voltage and library*/ +#if FB_ERM_LRA == 0 +#define RATED_VOLTAGE 3 +#define V_RMS 2.3 +#define V_PEAK 3.30 +/* Library Selection */ +#define LIB_SELECTION 4 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ + +/* default 2V LRA voltage and library */ +#elif FB_ERM_LRA == 1 +#define RATED_VOLTAGE 2 +#define V_RMS 2.0 +#define V_PEAK 2.85 +#define F_LRA 200 +/* Library Selection */ +#define LIB_SELECTION 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ + +#endif + +/* Control 1 register settings */ +#define DRIVE_TIME 25 +#define AC_COUPLE 0 +#define STARTUP_BOOST 1 + +/* Control 2 Settings */ +#define BIDIR_INPUT 1 +#define BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */ +#define SAMPLE_TIME 3 +#define BLANKING_TIME 1 +#define IDISS_TIME 1 + +/* Control 3 settings */ +#define NG_THRESH 2 +#define ERM_OPEN_LOOP 1 +#define SUPPLY_COMP_DIS 0 +#define DATA_FORMAT_RTO 0 +#define LRA_DRIVE_MODE 0 +#define N_PWM_ANALOG 0 +#define LRA_OPEN_LOOP 0 +/* Control 4 settings */ +#define ZC_DET_TIME 0 +#define AUTO_CAL_TIME 3 + +#define RGBLIGHT_ANIMATIONS + +#define RGBLED_NUM 10 +#define RGB_DI_PIN B5 +#define DRIVER_LED_TOTAL RGBLED_NUM + +#define RGB_MATRIX_KEYPRESSES + +#define SOLENOID_PIN A14 + diff --git a/keyboards/boston_meetup/2019/info.json b/keyboards/boston_meetup/2019/info.json new file mode 100644 index 0000000000..15ab72935c --- /dev/null +++ b/keyboards/boston_meetup/2019/info.json @@ -0,0 +1,12 @@ +{ + "keyboard_name": "Boston Meetup 2019", + "url": "", + "maintainer": "qmk", + "width": 4, + "height": 4, + "layouts": { + "LAYOUT": { + "key_count": 13, + "layout": [{"label":"K00", "x":0, "y":0}, {"label":"K10", "x":0, "y":1}, {"label":"K11", "x":1, "y":1}, {"label":"K12", "x":2, "y":1}, {"label":"K13", "x":3, "y":1}, {"label":"K20", "x":0, "y":2}, {"label":"K21", "x":1, "y":2}, {"label":"K22", "x":2, "y":2}, {"label":"K23", "x":3, "y":2}, {"label":"K30", "x":0, "y":3}, {"label":"K31", "x":1, "y":3}, {"label":"K32", "x":2, "y":3}, {"label":"K33", "x":3, "y":3}] } + } +} diff --git a/keyboards/boston_meetup/2019/keymaps/default/keymap.c b/keyboards/boston_meetup/2019/keymaps/default/keymap.c new file mode 100644 index 0000000000..52d67273e3 --- /dev/null +++ b/keyboards/boston_meetup/2019/keymaps/default/keymap.c @@ -0,0 +1,166 @@ +#include QMK_KEYBOARD_H + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +enum custom_layers { + _BASE, + _LOWER, + _RAISE, + _ADJUST +}; + +enum custom_keycodes { + BASE = SAFE_RANGE, + LOWER, + RAISE, + KC_DEMOMACRO +}; + +// Custom macros +#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl +#define CTL_TTAB CTL_T(KC_TAB) // Tap for Esc, hold for Ctrl +#define CTL_ENT CTL_T(KC_ENT) // Tap for Enter, hold for Ctrl +#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift +// Requires KC_TRNS/_______ for the trigger key in the destination layer +#define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor +#define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise +#define DEMOMACRO KC_DEMOMACRO // Sample for macros + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Base + * ,------. + * | Esc | + * |------+------+-------------. + * | : | 7 | 8 | 9 | + * |------+------+------+------| + * | RAISE| 4 | 5 | 6 | + * |------+------+------+------| + * | LOWER| 1 | 2 | 3 | + * `---------------------------' + */ +[_BASE] = LAYOUT( + KC_ESC, + KC_COLN, KC_P7, KC_P8, KC_P9, + RAISE, KC_P4, KC_P5, KC_P6, + LOWER, KC_P1, KC_P2, KC_P3 +), + +/* Lower + * ,------. + * | Nmlk | + * |------+------+-------------. + * | : | / | * | - | + * |------+------+------+------| + * | | | = | + | + * |------+------+------+------| + * | | 0 | . | ENT | + * `---------------------------' + */ +[_LOWER] = LAYOUT( + KC_NLCK, + KC_COLN, KC_PSLS, KC_PAST, KC_PMNS, + _______, XXXXXXX, KC_EQL, KC_PPLS, + _______, KC_P0, KC_PDOT, KC_PENT +), + +/* Raise + * ,------. + * | Esc | + * |------+------+-------------. + * |RGB TG|RGB M+|RGB M-| | + * |------+------+------+------| + * | |RGB H+|RGB S+|RGB V+| + * |------+------+------+------| + * | ` |RGB H-|RGB S-|RGB V-| + * `---------------------------' + */ +[_RAISE] = LAYOUT( + KC_NLCK, + RGB_TOG, RGB_MOD, RGB_RMOD, XXXXXXX, + _______, RGB_HUI, RGB_SAI, RGB_VAI, + _______, RGB_HUD, RGB_SAD, RGB_VAD + +), + +/* Adjust + * ,------. + * | DFU | + * |------+------+-------------. + * |HPT TG|HPT FB|HPT RS| BKSP | + * |------+------+------+------| + * | |HPT M+| | | + * |------+------+------+------| + * | |HPT M-|Clk TG| Del | + * `---------------------------' + */ +[_ADJUST] = LAYOUT( + RESET, + HPT_TOG, HPT_FBK, HPT_RST, KC_BSPC, + _______, HPT_MODI, XXXXXXX, XXXXXXX, + _______, HPT_MODD, CK_TOGG, KC_DEL +), + + +}; + +uint32_t layer_state_set_user(uint32_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} + + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_DEMOMACRO: + if (record->event.pressed) { + // when keycode KC_DEMOMACRO is pressed + SEND_STRING("QMK is the best thing ever!"); + } else { + // when keycode KC_DEMOMACRO is released + } + break; + case LOWER: + if (record->event.pressed) { + //not sure how to have keyboard check mode and set it to a variable, so my work around + //uses another variable that would be set to true after the first time a reactive key is pressed. + layer_on(_LOWER); + } else { + layer_off(_LOWER); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + //not sure how to have keyboard check mode and set it to a variable, so my work around + //uses another variable that would be set to true after the first time a reactive key is pressed. + layer_on(_RAISE); + } else { + layer_off(_RAISE); + } + return false; + break; + } + return true; +} + +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case RAISE: + case LOWER: + return false; + default: + return true; + } +} + +void matrix_init_user(void) { +} + + +void matrix_scan_user(void) { +} + diff --git a/keyboards/boston_meetup/2019/keymaps/default/readme.md b/keyboards/boston_meetup/2019/keymaps/default/readme.md new file mode 100644 index 0000000000..75f80b5191 --- /dev/null +++ b/keyboards/boston_meetup/2019/keymaps/default/readme.md @@ -0,0 +1,51 @@ +# The Default Boston Meetup 2019 board Layout + +Keymap: +``` +Base +,------. +| Esc | +|------+------+-------------. +| : | 7 | 8 | 9 | +|------+------+------+------| +| RAISE| 4 | 5 | 6 | +|------+------+------+------| +| LOWER| 1 | 2 | 3 | +`---------------------------' + +Lower +,------. +| Nmlk | +|------+------+-------------. +| : | / | * | - | +|------+------+------+------| +| | | = | + | +|------+------+------+------| +| | 0 | . | ENT | +`---------------------------' + +Raise +,------. +| Esc | +|------+------+-------------. +|RGB TG|RGB M+|RGB M-| | +|------+------+------+------| +| |RGB H+|RGB S+|RGB V+| +|------+------+------+------| +| |RGB H-|RGB S-|RGB V-| +`---------------------------' + +Adjust: +,------. +| DFU | +|------+------+-------------. +|HPT TG|HPT FB|HPT RS| BKSP | +|------+------+------+------| +| |HPT M+| | | +|------+------+------+------| +| |HPT M-|Clk TG| Del | +`---------------------------' + +``` + +RGB still work in progress \ No newline at end of file diff --git a/keyboards/boston_meetup/2019/keymaps/readme.md b/keyboards/boston_meetup/2019/keymaps/readme.md new file mode 100644 index 0000000000..c10a49f7d0 --- /dev/null +++ b/keyboards/boston_meetup/2019/keymaps/readme.md @@ -0,0 +1,22 @@ +# How to add your own keymap + +Folders can be named however you'd like (will be approved upon merging), or should follow the format with a preceding `_`: + + _[ISO 3166-1 alpha-2 code*]_[layout variant]_[layout name/author] + +\* See full list: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements + +and contain the following files: + +* `keymap.c` +* `readme.md` *recommended* +* `config.h` *optional*, found automatically when compiling +* `Makefile` *optional*, found automatically when compling + +When adding your keymap to this list, keep it organised alphabetically (select list, edit->sort lines), and use this format: + + * **folder_name** description + +# List of 2019 keymaps + +* **default** default 2019 macropad layout \ No newline at end of file diff --git a/keyboards/boston_meetup/2019/readme.md b/keyboards/boston_meetup/2019/readme.md new file mode 100644 index 0000000000..2bdac9dcde --- /dev/null +++ b/keyboards/boston_meetup/2019/readme.md @@ -0,0 +1,13 @@ +# Boston Meetup 2019 Macropad + +![Boston Meetup 2019](https://i.imgur.com/6LgBc4g.jpg) + +Limited-run board designed for Boston MK community meetup 2019. + +Keyboard Maintainer: [ishtob](https://github.com/ishtob), [QMK](https://github.com/qmk) + +Make example for this keyboard (after setting up your build environment): + + make boston_meetup/2019:default + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). \ No newline at end of file diff --git a/keyboards/boston_meetup/2019/rules.mk b/keyboards/boston_meetup/2019/rules.mk new file mode 100644 index 0000000000..7c03a025ee --- /dev/null +++ b/keyboards/boston_meetup/2019/rules.mk @@ -0,0 +1,24 @@ +# project specific files + +# Cortex version +MCU = STM32F303 + +# Build Options +# comment out to disable the options. +# +BACKLIGHT_ENABLE = no +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover +CUSTOM_MATRIX = no # Custom matrix file +AUDIO_ENABLE = yes +RGBLIGHT_ENABLE = no +RGB_MATRIX_ENABLE = no #WS2812 +HAPTIC_ENABLE += DRV2605L +QWIIC_ENABLE += MICRO_OLED +# SERIAL_LINK_ENABLE = yes diff --git a/keyboards/boston_meetup/boston_meetup.c b/keyboards/boston_meetup/boston_meetup.c new file mode 100644 index 0000000000..a9201ac852 --- /dev/null +++ b/keyboards/boston_meetup/boston_meetup.c @@ -0,0 +1,2 @@ +#include "boston_meetup.h" + diff --git a/keyboards/boston_meetup/boston_meetup.h b/keyboards/boston_meetup/boston_meetup.h new file mode 100644 index 0000000000..e1d9d92060 --- /dev/null +++ b/keyboards/boston_meetup/boston_meetup.h @@ -0,0 +1,19 @@ +#pragma once + +#ifdef KEYBOARD_boston_meetup_2019 + #include "2019.h" +#define LAYOUT( \ + K00, \ + K10, K11, K12, K13, \ + K20, K21, K22, K23, \ + K30, K31, K32, K33 \ + ) \ +{ \ + { K00, KC_NO, KC_NO, KC_NO }, \ + { K10, K11, K12, K13 }, \ + { K20, K21, K22, K23 }, \ + { K30, K31, K32, K33 } \ +} +#endif + +#include "quantum.h" \ No newline at end of file diff --git a/keyboards/boston_meetup/config.h b/keyboards/boston_meetup/config.h new file mode 100644 index 0000000000..b025e18df5 --- /dev/null +++ b/keyboards/boston_meetup/config.h @@ -0,0 +1,60 @@ +/* +Copyright 2012 Jun Wako + +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 . +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFB30 +#define PRODUCT_ID 0x26BE +#define MANUFACTURER ishtob +#define PRODUCT Boston Meetup Board +#define DESCRIPTION A limited-run community meetup board + +//#define AUDIO_VOICES + +//#define BACKLIGHT_PIN B7 + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +//#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +//#define LOCKING_RESYNC_ENABLE + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION diff --git a/keyboards/boston_meetup/readme.md b/keyboards/boston_meetup/readme.md new file mode 100644 index 0000000000..2fa1ec9583 --- /dev/null +++ b/keyboards/boston_meetup/readme.md @@ -0,0 +1,14 @@ +# Boston Meetup Macropads + +![Boston Meetup Macropads](https://i.imgur.com/yQcBF8g.jpg) + +Limited-run boards designed for Boston MK community meetups. + +Keyboard Maintainer: [ishtob](https://github.com/ishtob), [QMK](https://github.com/qmk) +Hardware Supported: Boston Meetup PCB 2018, 2019 + +Make example for this keyboard (after setting up your build environment): + + make boston_meetup/YYYY:default + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). \ No newline at end of file diff --git a/keyboards/boston_meetup/rules.mk b/keyboards/boston_meetup/rules.mk new file mode 100644 index 0000000000..6dd899edc8 --- /dev/null +++ b/keyboards/boston_meetup/rules.mk @@ -0,0 +1,2 @@ + +DEFAULT_FOLDER = boston_meetup/2019 From d48a5b29d764ee6ac925daf2500bb6101e8b23ca Mon Sep 17 00:00:00 2001 From: MechMerlin <30334081+mechmerlin@users.noreply.github.com> Date: Mon, 22 Apr 2019 21:52:05 -0700 Subject: [PATCH 51/61] [Keymap] Fix my userspace RGB bug (#5686) * fix bug that enabled RGBLIGHT_ENABLE on all my boards regardless if it was supported or not * update changelog with new changes for 0.2.2 --- users/mechmerlin/changelog.md | 4 ++++ users/mechmerlin/config.h | 6 ------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/users/mechmerlin/changelog.md b/users/mechmerlin/changelog.md index ec4b20108f..f1116b2d2b 100644 --- a/users/mechmerlin/changelog.md +++ b/users/mechmerlin/changelog.md @@ -1,6 +1,10 @@ # Changelog All notable changes to my userspace will be documented in this file. +## [0.2.2] - 2019-04-22 +### Fixed +- `config.h` usage of turning on `RGBLIGHT_ENABLE` when it is not enabled on boards other than my two clueboards were causing issues with boards that didn't have RGB underglow on it. + ## [0.2.1] - 2019-03-01 ### Fixed - `config.h` usage of `#ifdef RGBLIGHT_ENABLE` caused problems for other of my boards that had `RGBLIGHT_ENABLE`. diff --git a/users/mechmerlin/config.h b/users/mechmerlin/config.h index 9ca39a12ac..fe8f9c9ffb 100644 --- a/users/mechmerlin/config.h +++ b/users/mechmerlin/config.h @@ -21,17 +21,11 @@ #ifndef RGBLIGHT_ENABLE #define RGBLIGHT_ENABLE #endif - #ifndef AUDIO_CLICKY #define AUDIO_CLICKY #endif - #elif defined(KEYBOARD_clueboard_66_hotswap_gen1) #ifndef AUDIO_CLICKY #define AUDIO_CLICKY #endif -#else - #ifndef RGBLIGHT_ENABLE - #define RGBLIGHT_ENABLE - #endif #endif From 7ae2ded5901bedf2014e254db2b5292cdb72ffe4 Mon Sep 17 00:00:00 2001 From: ymzcdg <49898694+ymzcdg@users.noreply.github.com> Date: Wed, 24 Apr 2019 03:37:20 +0800 Subject: [PATCH 52/61] Translate docs into Chinese (#5693) * Docs translate Translate some docs to Standard Chinese for Chinese Developers. * fix translate fix translate --- docs/zh-cn/README.md | 32 +++++++++++++ docs/zh-cn/_summary.md | 106 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 docs/zh-cn/README.md create mode 100644 docs/zh-cn/_summary.md diff --git a/docs/zh-cn/README.md b/docs/zh-cn/README.md new file mode 100644 index 0000000000..9eb4ea777a --- /dev/null +++ b/docs/zh-cn/README.md @@ -0,0 +1,32 @@ +# QMK机械键盘固件 + +[![当前版本](https://img.shields.io/github/tag/qmk/qmk_firmware.svg)](https://github.com/qmk/qmk_firmware/tags) +[![开发状态](https://travis-ci.org/qmk/qmk_firmware.svg?branch=master)](https://travis-ci.org/qmk/qmk_firmware) +[![异议](https://img.shields.io/discord/440868230475677696.svg)](https://discord.gg/Uq7gcHh) +[![文档状态](https://img.shields.io/badge/docs-ready-orange.svg)](https://docs.qmk.fm) +[![GitHub贡献者](https://img.shields.io/github/contributors/qmk/qmk_firmware.svg)](https://github.com/qmk/qmk_firmware/pulse/monthly) +[![GitHub分支](https://img.shields.io/github/forks/qmk/qmk_firmware.svg?style=social&label=Fork)](https://github.com/qmk/qmk_firmware/) + +## 什么是 QMK 固件? + +QMK (*Quantum Mechanical Keyboard*) 是一个社区维护的开源软件,包括 QMK 固件, QMK 工具箱, qmk.fm网站, 和这些文档。QMK 固件是一个基于[tmk\_keyboard](http://github.com/tmk/tmk_keyboard)的键盘固件,它在爱特梅尔AVR微控制器实现一些有用的功能,确切地说, 是在 [OLKB product line](http://olkb.com), 在 [ErgoDox EZ](http://www.ergodox-ez.com) 键盘, 和 [Clueboard product line](http://clueboard.co/). 上。它被移植到使用ChibiOS的ARM芯片上. 它可以在飞线键盘或定制PCB键盘中发挥功能. + +## 如何得到它 + +如果你打算贡献布局, 键盘, 或者其他QMK特性, 一下是最简单的方法:[从Github获得repo分支](https://github.com/qmk/qmk_firmware#fork-destination-box), 并克隆你的repo到本地进行编辑,推送,然后从你的分支打开 [Pull Request](https://github.com/qmk/qmk_firmware/pulls). + +此外, 你也可以直接下载 ([zip](https://github.com/qmk/qmk_firmware/zipball/master), [tar](https://github.com/qmk/qmk_firmware/tarball/master)), 或者从git克隆 (`git@github.com:qmk/qmk_firmware.git`), 或 https (`https://github.com/qmk/qmk_firmware.git`). + +## 如何编译 + +在你能编译之前, 你需要[部署环境](getting_started_build_tools.md) 用于 AVR or/and ARM 开发。完成后, 你可以使用 `make` 命令来编译一个键盘和布局使用以下命令: + + make planck/rev4:default + +这将建立 `planck`的`rev4` 修订版本并使用 `default`布局。并非所有键盘都有修订版本 (也叫做子项目或文件夹),在此情况下,修订版本可以省略,如下: + + make preonic:default + +## 如何定制 + +QMK 有许多 [特性](features.md)来探索,也有很多 [参考文档](http://docs.qmk.fm) 供您发掘。你可以通过修改 [布局](keymap.md)和[键码](keycodes.md)来利用许多特性。 diff --git a/docs/zh-cn/_summary.md b/docs/zh-cn/_summary.md new file mode 100644 index 0000000000..df25a3ccd1 --- /dev/null +++ b/docs/zh-cn/_summary.md @@ -0,0 +1,106 @@ +* [完全菜鸟指南](newbs.md) + * [入门](newbs_getting_started.md) + * [构建你的第一个固件](newbs_building_firmware.md) + * [刷新固件](newbs_flashing.md) + * [测试和调试](newbs_testing_debugging.md) + * [Git最佳实践](newbs_best_practices.md) + * [学习资源](newbs_learn_more_resources.md) + +* [QMK基础](README.md) + * [QMK 简介](getting_started_introduction.md) + * [贡献 QMK](contributing.md) + * [如何使用Github](getting_started_github.md) + * [获得帮助](getting_started_getting_help.md) + +* [问题解答](faq.md) + * [一般问题](faq_general.md) + * [构建/编译QMK](faq_build.md) + * [调试/故障排除 QMK](faq_debug.md) + * [键盘布局](faq_keymap.md) + +* 详细指南 + * [安装构建工具](getting_started_build_tools.md) + * [流浪者指南](getting_started_vagrant.md) + * [构建/编译指令](getting_started_make_guide.md) + * [刷新固件](flashing.md) + * [定制功能](custom_quantum_functions.md) + * [布局概述](keymap.md) + +* [硬件](hardware.md) + * [AVR 处理器](hardware_avr.md) + * [驱动](hardware_drivers.md) + +* 参考 + * [键盘指南](hardware_keyboard_guidelines.md) + * [配置选项](config_options.md) + * [键码](keycodes.md) + * [记录最佳实践](documentation_best_practices.md) + * [文档指南](documentation_templates.md) + * [词汇表](reference_glossary.md) + * [单元测试](unit_testing.md) + * [有用的功能](ref_functions.md) + * [配置器支持](reference_configurator_support.md) + * [info.json 格式](reference_info_json.md) + +* [特性](features.md) + * [基本键码](keycodes_basic.md) + * [US ANSI 控制键](keycodes_us_ansi_shifted.md) + * [量子键码](quantum_keycodes.md) + * [高级键码](feature_advanced_keycodes.md) + * [音频](feature_audio.md) + * [自动控制](feature_auto_shift.md) + * [背光](feature_backlight.md) + * [蓝牙](feature_bluetooth.md) + * [Bootmagic](feature_bootmagic.md) + * [组合](feature_combo) + * [命令](feature_command.md) + * [动态宏指令](feature_dynamic_macros.md) + * [编码器](feature_encoders.md) + * [Grave Escape](feature_grave_esc.md) + * [键锁](feature_key_lock.md) + * [层](feature_layouts.md) + * [引导键](feature_leader_key.md) + * [LED 阵列](feature_led_matrix.md) + * [宏指令](feature_macros.md) + * [鼠标键](feature_mouse_keys.md) + * [一键功能](feature_advanced_keycodes.md#one-shot-keys) + * [指针设备](feature_pointing_device.md) + * [PS/2 鼠标](feature_ps2_mouse.md) + * [RGB 光](feature_rgblight.md) + * [RGB 矩阵](feature_rgb_matrix.md) + * [空格候补换挡](feature_space_cadet_shift.md) + * [空格候补换挡回车](feature_space_cadet_shift_enter.md) + * [速录机](feature_stenography.md) + * [换手](feature_swap_hands.md) + * [踢踏舞](feature_tap_dance.md) + * [终端](feature_terminal.md) + * [热敏打印机](feature_thermal_printer.md) + * [Unicode](feature_unicode.md) + * [用户空间](feature_userspace.md) + * [速度键](feature_velocikey.md) + +* 针对制造者和定制者 + * [飞线指南](hand_wire.md) + * [ISP 刷新指南](isp_flashing_guide.md) + * [ARM 调试指南](arm_debugging.md) + * [I2C 驱动](i2c_driver.md) + * [GPIO 控制器](internals_gpio_control.md) + * [Proton C 转换](proton_c_conversion.md) + +* 深入了解 + * [键盘如何工作](how_keyboards_work.md) + * [理解 QMK](understanding_qmk.md) + +* 其他话题 + * [使用Eclipse开发QMK](other_eclipse.md) + * [使用VSCode开发QMK](other_vscode.md) + * [支持](support.md) + +* QMK 内构 (正在编写) + * [定义](internals_defines.md) + * [输入回调寄存器](internals_input_callback_reg.md) + * [Midi 设备](internals_midi_device.md) + * [Midi 设备设置过程](internals_midi_device_setup_process.md) + * [Midi 工具库](internals_midi_util.md) + * [发送函数](internals_send_functions.md) + * [Sysex 工具](internals_sysex_tools.md) From d4a5402aeb856bba25943e954585d56cf7230910 Mon Sep 17 00:00:00 2001 From: Florian Didron Date: Wed, 24 Apr 2019 11:10:28 +0900 Subject: [PATCH 53/61] [Keyboard] Fix red an green leds location (#5698) --- keyboards/planck/ez/ez.c | 108 +++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/keyboards/planck/ez/ez.c b/keyboards/planck/ez/ez.c index b859af6c15..c3b7e26170 100644 --- a/keyboards/planck/ez/ez.c +++ b/keyboards/planck/ez/ez.c @@ -22,60 +22,60 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { * | | G location * | | | B location * | | | | */ - {0, A_12, B_12, C_12}, - {0, A_11, B_11, C_11}, - {0, A_10, B_10, C_10}, - {0, A_9, B_9, C_9}, - {0, A_8, B_8, C_8}, - {0, A_7, B_7, C_7}, - - {0, G_12, H_12, I_12}, - {0, G_11, H_11, I_11}, - {0, G_10, H_10, I_10}, - {0, G_9, H_9, I_9}, - {0, G_8, H_8, I_8}, - {0, G_7, H_7, I_7}, - - {0, A_6, B_6, C_6}, - {0, A_5, B_5, C_5}, - {0, A_4, B_4, C_4}, - {0, A_3, B_3, C_3}, - {0, A_2, B_2, C_2}, - {0, A_1, B_1, C_1}, - - {0, G_6, H_6, I_6}, - {0, G_5, H_5, I_5}, - {0, G_4, H_4, I_4}, - {0, G_3, H_3, I_3}, - {0, G_2, H_2, I_2}, - {0, G_1, H_1, I_1}, - - {0, D_12, E_12, F_12}, - {0, D_11, E_11, F_11}, - {0, D_10, E_10, F_10}, - {0, D_9, E_9, F_9}, - {0, D_8, E_8, F_8}, - {0, D_7, E_7, F_7}, - - {0, J_12, K_12, L_12}, - {0, J_11, K_11, L_11}, - {0, J_10, K_10, L_10}, - {0, J_9, K_9, L_9}, - {0, J_8, K_8, L_8}, - {0, J_7, K_7, L_7}, - - {0, D_6, E_6, F_6}, - {0, D_5, E_5, F_5}, - {0, D_4, E_4, F_4}, - {0, D_3, E_3, F_3}, - {0, D_2, E_2, F_2}, - {0, D_1, E_1, F_1}, - - {0, J_6, K_6, L_6}, - {0, J_5, K_5, L_5}, - {0, J_4, K_4, L_4}, - {0, J_3, K_3, L_3}, - {0, J_2, K_2, L_2}, + {0, B_12, A_12, C_12}, + {0, B_11, A_11, C_11}, + {0, B_10, A_10, C_10}, + {0, B_9, A_9, C_9}, + {0, B_8, A_8, C_8}, + {0, B_7, A_7, C_7}, + + {0, H_12, G_12, I_12}, + {0, H_11, G_11, I_11}, + {0, H_10, G_10, I_10}, + {0, H_9, G_9, I_9}, + {0, H_8, G_8, I_8}, + {0, H_7, G_7, I_7}, + + {0, B_6, A_6, C_6}, + {0, B_5, A_5, C_5}, + {0, B_4, A_4, C_4}, + {0, B_3, A_3, C_3}, + {0, B_2, A_2, C_2}, + {0, B_1, A_1, C_1}, + + {0, H_6, G_6, I_6}, + {0, H_5, G_5, I_5}, + {0, H_4, G_4, I_4}, + {0, H_3, G_3, I_3}, + {0, H_2, G_2, I_2}, + {0, H_1, G_1, I_1}, + + {0, E_12, D_12, F_12}, + {0, E_11, D_11, F_11}, + {0, E_10, D_10, F_10}, + {0, E_9, D_9, F_9}, + {0, E_8, D_8, F_8}, + {0, E_7, D_7, F_7}, + + {0, K_12, J_12, L_12}, + {0, K_11, J_11, L_11}, + {0, K_10, J_10, L_10}, + {0, K_9, J_9, L_9}, + {0, K_8, J_8, L_8}, + {0, K_7, J_7, L_7}, + + {0, E_6, D_6, F_6}, + {0, E_5, D_5, F_5}, + {0, E_4, D_4, F_4}, + {0, E_3, D_3, F_3}, + {0, E_2, D_2, F_2}, + {0, E_1, D_1, F_1}, + + {0, K_6, J_6, L_6}, + {0, K_5, J_5, L_5}, + {0, K_4, J_4, L_4}, + {0, K_3, J_3, L_3}, + {0, K_2, J_2, L_2}, }; From 703699b81fa499072c17fd63795444e6ef1bfe40 Mon Sep 17 00:00:00 2001 From: MechMerlin <30334081+mechmerlin@users.noreply.github.com> Date: Tue, 23 Apr 2019 19:11:18 -0700 Subject: [PATCH 54/61] [Keyboard] forgot to omit k05 from the electrical matrix in hhkb layout (#5684) --- keyboards/exclusive/e6v2/bmc/bmc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/exclusive/e6v2/bmc/bmc.h b/keyboards/exclusive/e6v2/bmc/bmc.h index 06d23fbe69..44c02c8600 100644 --- a/keyboards/exclusive/e6v2/bmc/bmc.h +++ b/keyboards/exclusive/e6v2/bmc/bmc.h @@ -72,7 +72,7 @@ k01, k02, k75, k08, k09 \ ) \ { \ - { KC_NO, k01, k02, KC_NO, KC_NO, k05, KC_NO, KC_NO, k08, k09, KC_NO }, \ + { KC_NO, k01, k02, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, k08, k09, KC_NO }, \ { k10, k11, k12, k13, k14, k15, KC_NO, KC_NO, k18, k19, KC_NO }, \ { k20, k21, k22, k23, k24, k25, k26, KC_NO, k28, k29, KC_NO }, \ { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, KC_NO }, \ From 978074e4170c254a6f2cd684c9f695024a5a3e0b Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Wed, 24 Apr 2019 04:26:49 +0200 Subject: [PATCH 55/61] [Keymap] Fix broken Shift-Insert binding (#5689) --- keyboards/signum/3_0/elitec/keymaps/default/keymap.c | 2 +- keyboards/signum/3_0/elitec/keymaps/default/layout.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/signum/3_0/elitec/keymaps/default/keymap.c b/keyboards/signum/3_0/elitec/keymaps/default/keymap.c index 22d60085f4..4b3a9439d4 100644 --- a/keyboards/signum/3_0/elitec/keymaps/default/keymap.c +++ b/keyboards/signum/3_0/elitec/keymaps/default/keymap.c @@ -707,7 +707,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ------------------------------------------------- */ LAYOUT_ortho_4x12( - KC_ESC, KC_ESC, LCTL(KC_W), LCTL(KC_T), CTL_T(KC_PGDN), CTL_T(KC_PGDN), KC_PGDN, KC_HOME, KC_UP, KC_INS, SFT_T(KC_INS), KC_ESC, + KC_ESC, KC_ESC, LCTL(KC_W), LCTL(KC_T), CTL_T(KC_PGDN), CTL_T(KC_PGDN), KC_PGDN, KC_HOME, KC_UP, KC_INS, LSFT(KC_INS), KC_ESC, KC_TRNS, KC_CAPS, LGUI_T(KC_LEFT), LGUI_T(KC_TAB), LGUI_T(KC_RIGHT), LGUI_T(KC_RIGHT), KC_LEFT, KC_LEFT, KC_DOWN, KC_RIGHT, KC_END, KC_PSCR, KC_TRNS, XXXXXXX, XXXXXXX, XXXXXXX, CTL_T(KC_PGUP), CTL_T(KC_PGUP), KC_PGUP, XXXXXXX, KC_DOWN, XXXXXXX, KC_APP, KC_TRNS, TG(4), KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_TRNS, KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS diff --git a/keyboards/signum/3_0/elitec/keymaps/default/layout.py b/keyboards/signum/3_0/elitec/keymaps/default/layout.py index 323a583212..bc744593b6 100644 --- a/keyboards/signum/3_0/elitec/keymaps/default/layout.py +++ b/keyboards/signum/3_0/elitec/keymaps/default/layout.py @@ -348,7 +348,7 @@ qmk_dict = { ":": "S(KC_SCLN)", "'": "KC_QUOT", "\"": "S(KC_QUOT)", "`": "KC_GRV", "~": "S(KC_GRV)", ",": "KC_COMM", "<": "S(KC_COMM)", ".": "KC_DOT", ">": "S(KC_DOT)", "/": "KC_SLSH", "?": "S(KC_SLSH)", "Caps": "KC_CAPS", - "Pr Scr": "KC_PSCR", "Scr Lck": "KC_SLCK", "Pause": "KC_BRK", "Insert": "KC_INS", "SInsert": "SFT_T(KC_INS)", + "Pr Scr": "KC_PSCR", "Scr Lck": "KC_SLCK", "Pause": "KC_BRK", "Insert": "KC_INS", "SInsert": "LSFT(KC_INS)", "Home": "KC_HOME", "Pg Up": "KC_PGUP", "Del": "KC_DEL", "End": "KC_END", "Pg Down": "KC_PGDN", "> Arrow": "KC_RIGHT", "< Arrow": "KC_LEFT", "v Arrow": "KC_DOWN", "^ Arrow": "KC_UP", From 479baf98e093b83339c9c1a628d9d25d3d0ab034 Mon Sep 17 00:00:00 2001 From: Rockman18 Date: Wed, 24 Apr 2019 04:27:29 +0200 Subject: [PATCH 56/61] [FIX] Misspelled RGB_YELLOW (#5692) --- quantum/rgblight_list.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantum/rgblight_list.h b/quantum/rgblight_list.h index 7b83133808..e024364f05 100644 --- a/quantum/rgblight_list.h +++ b/quantum/rgblight_list.h @@ -77,7 +77,7 @@ #define rgblight_setrgb_orange() rgblight_setrgb (RGB_ORANGE) #define rgblight_setrgb_goldenrod() rgblight_setrgb (RGB_GOLDENROD) #define rgblight_setrgb_gold() rgblight_setrgb (RGB_GOLD) -#define rgblight_setrgb_yellow() rgblight_setrgb (RGB_YEllOW) +#define rgblight_setrgb_yellow() rgblight_setrgb (RGB_YELLOW) #define rgblight_setrgb_chartreuse() rgblight_setrgb (RGB_CHARTREUSE) #define rgblight_setrgb_green() rgblight_setrgb (RGB_GREEN) #define rgblight_setrgb_springgreen() rgblight_setrgb (RGB_SPRINGGREEN) From dafdb5f9aee5444691c09388575b23b76bb49cb0 Mon Sep 17 00:00:00 2001 From: Bob Date: Tue, 23 Apr 2019 22:29:54 -0400 Subject: [PATCH 57/61] [Keyboard] fix project zen rev1 bootloader declaration (#5695) --- keyboards/zen/rev1/rules.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/keyboards/zen/rev1/rules.mk b/keyboards/zen/rev1/rules.mk index e69de29bb2..58e9a76b23 100644 --- a/keyboards/zen/rev1/rules.mk +++ b/keyboards/zen/rev1/rules.mk @@ -0,0 +1 @@ +BOOTLOADER = caterina From eda924d7dc71bd5bc229cc64dcd89a8703ed8582 Mon Sep 17 00:00:00 2001 From: Callum Oakley Date: Wed, 24 Apr 2019 03:31:42 +0100 Subject: [PATCH 58/61] [Keymap] update (mouse emulation, rev 6 compatibility) (#5696) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * mess with mouse emulation some more * reverse scrolling * mouse speed 20 * ndash and £ on symbol layer * rev6 compatibility --- keyboards/planck/keymaps/callum/config.h | 8 +- keyboards/planck/keymaps/callum/keymap.c | 262 ++++++++++------------- keyboards/planck/keymaps/callum/rules.mk | 1 - 3 files changed, 120 insertions(+), 151 deletions(-) diff --git a/keyboards/planck/keymaps/callum/config.h b/keyboards/planck/keymaps/callum/config.h index 49f61dee55..e66db1d7e8 100644 --- a/keyboards/planck/keymaps/callum/config.h +++ b/keyboards/planck/keymaps/callum/config.h @@ -1,7 +1,7 @@ #define MOUSEKEY_DELAY 0 #define MOUSEKEY_INTERVAL 16 -#define MOUSEKEY_MAX_SPEED 10 -#define MOUSEKEY_TIME_TO_MAX 60 +#define MOUSEKEY_MAX_SPEED 20 +#define MOUSEKEY_TIME_TO_MAX 100 #define MOUSEKEY_WHEEL_DELAY 0 -#define MOUSEKEY_WHEEL_MAX_SPEED 8 -#define MOUSEKEY_WHEEL_TIME_TO_MAX 60 +#define MOUSEKEY_WHEEL_MAX_SPEED 1 +#define MOUSEKEY_WHEEL_TIME_TO_MAX 100 diff --git a/keyboards/planck/keymaps/callum/keymap.c b/keyboards/planck/keymaps/callum/keymap.c index 02456aa7d8..08d0c69b88 100644 --- a/keyboards/planck/keymaps/callum/keymap.c +++ b/keyboards/planck/keymaps/callum/keymap.c @@ -1,4 +1,3 @@ -#pragma message "You may need to add LAYOUT_planck_grid to your keymap layers - see default for an example" #include "planck.h" #include "action_layer.h" @@ -38,28 +37,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Func |Ctrl | Alt |Super|Symb |Enter|Space|Move |Super| Alt |Ctrl |Func | * `-----------------------------------------------------------------------' */ - [_COLEMAK] = { - { - KC_TAB, KC_Q, KC_W, KC_F, - KC_P, KC_G, KC_J, KC_L, - KC_U, KC_Y, KC_SCLN, KC_MINS - }, - { - KC_BSPC, KC_A, KC_R, KC_S, - KC_T, KC_D, KC_H, KC_N, - KC_E, KC_I, KC_O, KC_QUOT - }, - { - KC_LSFT, KC_Z, KC_X, KC_C, - KC_V, KC_B, KC_K, KC_M, - KC_COMM, KC_DOT, KC_SLSH, KC_RSFT - }, - { - FUNC, KC_LCTL, KC_LALT, KC_LGUI, - SYMB, KC_ENT, KC_SPC, MOVE, - KC_RGUI, KC_RALT, KC_RCTL, FUNC - } - }, + [_COLEMAK] = LAYOUT_planck_grid( + KC_TAB, KC_Q, KC_W, KC_F, + KC_P, KC_G, KC_J, KC_L, + KC_U, KC_Y, KC_SCLN, KC_MINS, + + KC_BSPC, KC_A, KC_R, KC_S, + KC_T, KC_D, KC_H, KC_N, + KC_E, KC_I, KC_O, KC_QUOT, + + KC_LSFT, KC_Z, KC_X, KC_C, + KC_V, KC_B, KC_K, KC_M, + KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + + FUNC, KC_LCTL, KC_LALT, KC_LGUI, + SYMB, KC_ENT, KC_SPC, MOVE, + KC_RGUI, KC_RALT, KC_RCTL, FUNC + ), /* QWERTY * ,-----------------------------------------------------------------------. @@ -72,96 +66,81 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Func |Ctrl | Alt |Super|Symb |Enter|Space|Move |Super| Alt |Ctrl |Func | * `-----------------------------------------------------------------------' */ - [_QWERTY] = { - { - KC_TAB, KC_Q, KC_W, KC_E, - KC_R, KC_T, KC_Y, KC_U, - KC_I, KC_O, KC_P, KC_MINS - }, - { - KC_BSPC, 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_RSFT - }, - { - FUNC, KC_LCTL, KC_LALT, KC_LGUI, - SYMB, KC_ENT, KC_SPC, MOVE, - KC_RGUI, KC_RALT, KC_RCTL, FUNC - } - }, + [_QWERTY] = LAYOUT_planck_grid( + KC_TAB, KC_Q, KC_W, KC_E, + KC_R, KC_T, KC_Y, KC_U, + KC_I, KC_O, KC_P, KC_MINS, + + KC_BSPC, 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_RSFT, + + FUNC, KC_LCTL, KC_LALT, KC_LGUI, + SYMB, KC_ENT, KC_SPC, MOVE, + KC_RGUI, KC_RALT, KC_RCTL, FUNC + ), /* SYMB * ,-----------------------------------------------------------------------. - * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | | + * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 |ndash| * |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - * | Del | ! | @ | # | $ | % | ^ | & | * | ( | ) | | + * | Del | ! | @ | # | $ | % | ^ | & | * | ( | ) | £ | * |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| * | | ~ | ` | + | = | | | \ | [ | ] | { | } | | * |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - * | | | | | | | |Mouse| | | | | + * | | | | | | | | | | | | | * `-----------------------------------------------------------------------' */ - [_SYMB] = { - { - KC_ESC, KC_1, KC_2, KC_3, - KC_4, KC_5, KC_6, KC_7, - KC_8, KC_9, KC_0, _______ - }, - { - KC_DEL, KC_EXLM, KC_AT, KC_HASH, - KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, - KC_ASTR, KC_LPRN, KC_RPRN, _______ - }, - { - _______, KC_TILD, KC_GRV, KC_PLUS, - KC_EQL, KC_PIPE, KC_BSLS, KC_LBRC, - KC_RBRC, KC_LCBR, KC_RCBR, _______ - }, - { - _______, _______, _______, _______, - _______, _______, _______, MOUSE, - _______, _______, _______, _______ - } - }, + [_SYMB] = LAYOUT_planck_grid( + KC_ESC, KC_1, KC_2, KC_3, + KC_4, KC_5, KC_6, KC_7, + KC_8, KC_9, KC_0, A(KC_MINS), + + KC_DEL, KC_EXLM, KC_AT, KC_HASH, + KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, + KC_ASTR, KC_LPRN, KC_RPRN, A(KC_3), + + _______, KC_TILD, KC_GRV, KC_PLUS, + KC_EQL, KC_PIPE, KC_BSLS, KC_LBRC, + KC_RBRC, KC_LCBR, KC_RCBR, _______, + + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______ + ), /* MOVE * ,-----------------------------------------------------------------------. - * | | | | | | |CtrUp|Home | Up | End |Caps | Esc | + * | | | | | | |CtrUp|Home | Up | End |Caps |Mouse| * |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - * | | | | | | |SpaL |Left |Down |Right|SpaR | Del | + * | | | | | | |CtrL |Left |Down |Right|CtrR | | * |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| * | | | | | | |CtrDn|PgDn |PgUp |TabL |TabR | | * |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - * | | | | |Mouse| | | | | | | | + * | | | | | | | | | | | | | * `-----------------------------------------------------------------------' */ - [_MOVE] = { - { - AC(KC_A), AC(KC_B), AC(KC_C), AC(KC_D), - AC(KC_E), AC(KC_F), C(KC_UP), KC_HOME, - KC_UP, KC_END, KC_CAPS, KC_ESC - }, - { - AC(KC_G), AC(KC_H), AC(KC_I), AC(KC_J), - AC(KC_K), AC(KC_L), C(KC_LEFT), KC_LEFT, - KC_DOWN, KC_RGHT, C(KC_RIGHT), KC_DEL - }, - { - _______, AC(KC_M), AC(KC_N), AC(KC_O), - AC(KC_P), AC(KC_Q), C(KC_DOWN), KC_PGDN, - KC_PGUP, SC(KC_TAB), C(KC_TAB), _______ - }, - { - _______, _______, _______, _______, - MOUSE, _______, _______, _______, - _______, _______, _______, _______ - } - }, + [_MOVE] = LAYOUT_planck_grid( + AC(KC_A), AC(KC_B), AC(KC_C), AC(KC_D), + AC(KC_E), AC(KC_F), C(KC_UP), KC_HOME, + KC_UP, KC_END, KC_CAPS, MOUSE, + + AC(KC_G), AC(KC_H), AC(KC_I), AC(KC_J), + AC(KC_K), AC(KC_L), C(KC_LEFT), KC_LEFT, + KC_DOWN, KC_RGHT, C(KC_RIGHT), XXXXXXX, + + _______, AC(KC_M), AC(KC_N), AC(KC_O), + AC(KC_P), AC(KC_Q), C(KC_DOWN), KC_PGDN, + KC_PGUP, SC(KC_TAB), C(KC_TAB), _______, + + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______ + ), /* FUNC * ,-----------------------------------------------------------------------. @@ -169,67 +148,57 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| * |Power| F11 | F12 | F13 | F14 | F15 | F16 | F17 | F18 | F19 | F20 |VolDn| * |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - * | | |Home |TabL |TabR |End | | | |Clmak|Qwrty| | + * | | | | | | | | | |Clmak|Qwrty| | * |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| * | | | | |Prev |Mute |Play |Next | | | | | * `-----------------------------------------------------------------------' */ - [_FUNC] = { - { - RESET, KC_F1, KC_F2, KC_F3, - KC_F4, KC_F5, KC_F6, KC_F7, - KC_F8, KC_F9, KC_F10, KC_VOLU - }, - { - KC_POWER, KC_F11, KC_F12, KC_F13, - KC_F14, KC_F15, KC_F16, KC_F17, - KC_F18, KC_F19, KC_F20, KC_VOLD - }, - { - _______, XXXXXXX, KC_HOME, SC(KC_TAB), - C(KC_TAB), KC_END, XXXXXXX, XXXXXXX, - XXXXXXX, COLEMAK, QWERTY, _______ - }, - { - _______, _______, _______, _______, - KC_MPRV, KC_MUTE, KC_MPLY, KC_MNXT, - _______, _______, _______, _______ - } - }, + [_FUNC] = LAYOUT_planck_grid( + RESET, KC_F1, KC_F2, KC_F3, + KC_F4, KC_F5, KC_F6, KC_F7, + KC_F8, KC_F9, KC_F10, KC_VOLU, + + KC_POWER, KC_F11, KC_F12, KC_F13, + KC_F14, KC_F15, KC_F16, KC_F17, + KC_F18, KC_F19, KC_F20, KC_VOLD, + + _______, XXXXXXX, KC_HOME, SC(KC_TAB), + C(KC_TAB), KC_END, XXXXXXX, XXXXXXX, + XXXXXXX, COLEMAK, QWERTY, _______, + + _______, _______, _______, _______, + KC_MPRV, KC_MUTE, KC_MPLY, KC_MNXT, + _______, _______, _______, _______ + ), /* MOUSE * ,-----------------------------------------------------------------------. - * | | | | | | | | ScL |Up | ScR | | | + * | | |CtrL |CtrU |CtrR | B5 |CtrU | ScL |Up | ScR | | | * |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - * | | B4 | B3 | B2 | B1 | | |Left |Down |Right| | | + * | | | Ac0 | Ac1 | Ac2 | B4 |CtrL |Left |Down |Right|CtrR | | * |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - * | | | Ac0 | Ac1 | Ac2 | | | ScD | ScU | | | | + * | | | |Home | End | B3 |CtrD | ScD | ScU |TabL |TabR | | * |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - * | | | | | | | | | | | | | + * | | | | | | B2 | B1 | | | | | | * `-----------------------------------------------------------------------' */ - [_MOUSE] = { - { - _______, _______, C(KC_LEFT), C(KC_UP), - C(KC_RIGHT), _______, _______, KC_WH_L, - KC_MS_U, KC_WH_R, _______, _______ - }, - { - _______, KC_BTN4, KC_BTN3, KC_BTN2, - KC_BTN1, _______, _______, KC_MS_L, - KC_MS_D, KC_MS_R, _______, _______ - }, - { - _______, _______, KC_ACL0, KC_ACL1, - KC_ACL2, _______, _______, KC_WH_D, - KC_WH_U, _______, _______, _______ - }, - { - _______, _______, _______, _______, - _______, _______, _______, _______, - _______, _______, _______, _______ - } - } + [_MOUSE] = LAYOUT_planck_grid( + _______, XXXXXXX, C(KC_LEFT), C(KC_UP), + C(KC_RIGHT), KC_BTN5, C(KC_UP), KC_WH_R, + KC_MS_U, KC_WH_L, XXXXXXX, XXXXXXX, + + _______, XXXXXXX, KC_ACL0, KC_ACL1, + KC_ACL2, KC_BTN4, C(KC_LEFT), KC_MS_L, + KC_MS_D, KC_MS_R, C(KC_RIGHT), XXXXXXX, + + _______, XXXXXXX, XXXXXXX, KC_HOME, + KC_END, KC_BTN3, C(KC_DOWN), KC_WH_U, + KC_WH_D, SC(KC_TAB), C(KC_TAB), _______, + + _______, _______, _______, _______, + _______, KC_BTN2, KC_BTN1, _______, + _______, _______, _______, _______ + ) }; #ifdef AUDIO_ENABLE @@ -267,6 +236,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; case SYMB: if (record->event.pressed) { + layer_off(_MOUSE); layer_on(_SYMB); } else { layer_off(_SYMB); @@ -274,6 +244,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; case MOVE: if (record->event.pressed) { + layer_off(_MOUSE); layer_on(_MOVE); } else { layer_off(_MOVE); @@ -281,6 +252,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; case FUNC: if (record->event.pressed) { + layer_off(_MOUSE); layer_on(_FUNC); } else { layer_off(_FUNC); @@ -289,8 +261,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case MOUSE: if (record->event.pressed) { layer_on(_MOUSE); - } else { - layer_off(_MOUSE); } return false; diff --git a/keyboards/planck/keymaps/callum/rules.mk b/keyboards/planck/keymaps/callum/rules.mk index 4774c2c417..182322ae23 100644 --- a/keyboards/planck/keymaps/callum/rules.mk +++ b/keyboards/planck/keymaps/callum/rules.mk @@ -17,4 +17,3 @@ RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend - From e6f4173aecaedabe3b2550340321520f45227c7f Mon Sep 17 00:00:00 2001 From: zvecr Date: Wed, 24 Apr 2019 19:13:07 +0100 Subject: [PATCH 59/61] Refactor cospad to current standards and enable support for backlight keycodes (#5582) --- keyboards/cospad/config.h | 50 ++++----- keyboards/cospad/cospad.c | 56 +++++----- keyboards/cospad/cospad.h | 126 ++++++++++++---------- keyboards/cospad/info.json | 76 ++++++++----- keyboards/cospad/keymaps/default/keymap.c | 120 +++++++++------------ keyboards/cospad/rules.mk | 43 +++++--- 6 files changed, 250 insertions(+), 221 deletions(-) diff --git a/keyboards/cospad/config.h b/keyboards/cospad/config.h index 1f7c174e6e..b7e7ec384c 100644 --- a/keyboards/cospad/config.h +++ b/keyboards/cospad/config.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef CONFIG_H -#define CONFIG_H +#pragma once #include "config_common.h" @@ -32,42 +31,43 @@ along with this program. If not, see . #define MATRIX_ROWS 6 #define MATRIX_COLS 4 -// ROWS: Top to bottom, COLS: Left to right - +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ #define MATRIX_ROW_PINS { D0, D1, D2, D3, D4, D5 } #define MATRIX_COL_PINS { F0, F1, E6, C7 } #define UNUSED_PINS -#define BACKLIGHT_PIN F7 - /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW -/* define if matrix has ghost */ -//#define MATRIX_HAS_GHOST +/* Backlight configuration */ +#define BACKLIGHT_PIN F7 +#define BACKLIGHT_LEVELS 1 + +/* Underlight configuration */ +#define RGB_DI_PIN F6 +#define RGBLED_NUM 4 +#define RGBLIGHT_ANIMATIONS -/* Set 0 if debouncing isn't needed */ +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCING_DELAY 5 +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ //#define LOCKING_SUPPORT_ENABLE /* Locking resynchronize hack */ #define LOCKING_RESYNC_ENABLE -/* Backlight configuration - */ -#define BACKLIGHT_LEVELS 4 - -/* Underlight configuration - */ - -#define RGB_DI_PIN F6 -#define RGBLIGHT_ANIMATIONS -#define RGBLED_NUM 4 // Number of LEDs -#define RGBLIGHT_HUE_STEP 10 -#define RGBLIGHT_SAT_STEP 17 -#define RGBLIGHT_VAL_STEP 17 - /* * Feature disable options * These options are also useful to firmware size reduction. @@ -86,4 +86,6 @@ along with this program. If not, see . //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION -#endif +/* Bootmagic Lite key configuration */ +// #define BOOTMAGIC_LITE_ROW 0 +// #define BOOTMAGIC_LITE_COLUMN 0 diff --git a/keyboards/cospad/cospad.c b/keyboards/cospad/cospad.c index 48d752a84b..e7ef71f874 100644 --- a/keyboards/cospad/cospad.c +++ b/keyboards/cospad/cospad.c @@ -1,37 +1,33 @@ + +/* Copyright 2019 + * + * 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 "cospad.h" -#include "led.h" -extern inline void cospad_bl_led_on(void); -extern inline void cospad_bl_led_off(void); -extern inline void cospad_bl_led_togg(void); +#ifdef BACKLIGHT_ENABLE -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - matrix_init_user(); - led_init_ports(); -}; - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - matrix_scan_user(); -}; +void backlight_init_ports(void) { + setPinOutput(F7); +} -void led_init_ports(void) { - // * Set our LED pins as output - DDRB |= (1<<2); - DDRF |= (1<<7); - // * Setting BL LEDs to init as off - PORTF |= (1<<7); +void backlight_set(uint8_t level) { + writePin(F7, !!level); } -void led_set_kb(uint8_t usb_led) { - if (usb_led & (1<. + */ +#pragma once #include "quantum.h" +#define ___ KC_NO -// readability -#define XXX KC_NO +/* This a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ /* COSPAD ortho matrix layout * ,-------------------. @@ -21,40 +43,6 @@ * | 50 | 51 | 52 | 53 | * `-------------------' */ - -/* COSPAD gamepad matrix layout - * ,-------------------. - * | 00 | 01 | 02 | 03 | - * |----|----|----|----| - * | 10 | 11 | 12 | 13 | - * |----|----|----|----| - * | 20 | 21 | 22 | | - * |----|----|----| 23 | - * | 30 | 31 | 32 | | - * |----|----|----|----| - * | 40 | 41 | 42 | 43 | - * |----|----|----|----| - * | 50 | 51 | 52 | 53 | - * `-------------------' - */ - -/* COSPAD numpad matrix layout - * ,-------------------. - * | 00 | 01 | 02 | 03 | - * |----|----|----|----| - * | 10 | 11 | 12 | 13 | - * |----|----|----|----| - * | 20 | 21 | 22 | | - * |----|----|----| 23 | - * | 30 | 31 | 32 | | - * |----|----|----|----| - * | 40 | 41 | 42 | | - * |----|----|----| 43 | - * | 50 | 52 | | - * `-------------------' - */ -// The first section contains all of the arguments -// The second converts the arguments into a two-dimensional array #define LAYOUT_ortho_6x4( \ k00, k01, k02, k03, \ k10, k11, k12, k13, \ @@ -72,6 +60,21 @@ {k50, k51, k52, k53} \ } +/* COSPAD gamepad matrix layout + * ,-------------------. + * | 00 | 01 | 02 | 03 | + * |----|----|----|----| + * | 10 | 11 | 12 | 13 | + * |----|----|----|----| + * | 20 | 21 | 22 | | + * |----|----|----| 23 | + * | 30 | 31 | 32 | | + * |----|----|----|----| + * | 40 | 41 | 42 | 43 | + * |----|----|----|----| + * | 50 | 51 | 52 | 53 | + * `-------------------' + */ #define LAYOUT_gamepad_6x4( \ k00, k01, k02, k03, \ k10, k11, k12, k13, \ @@ -84,11 +87,26 @@ {k00, k01, k02, k03}, \ {k10, k11, k12, k13}, \ {k20, k21, k22, k23}, \ - {k30, k31, k32, KC_NO}, \ + {k30, k31, k32, ___}, \ {k40, k41, k42, k43}, \ {k50, k51, k52, k53} \ } +/* COSPAD numpad matrix layout + * ,-------------------. + * | 00 | 01 | 02 | 03 | + * |----|----|----|----| + * | 10 | 11 | 12 | 13 | + * |----|----|----|----| + * | 20 | 21 | 22 | | + * |----|----|----| 23 | + * | 30 | 31 | 32 | | + * |----|----|----|----| + * | 40 | 41 | 42 | | + * |----|----|----| 43 | + * | 50 | 52 | | + * `-------------------' + */ #define LAYOUT_numpad_6x4( \ k00, k01, k02, k03, \ k10, k11, k12, k13, \ @@ -98,25 +116,15 @@ k50, k52, k43 \ ) \ { \ - {k00, k01, k02, k03}, \ - {k10, k11, k12, k13}, \ - {k20, k21, k22, k23}, \ - {k30, k31, k32, KC_NO}, \ - {k40, k41, k42, k43}, \ - {k50, KC_NO, k52, KC_NO} \ + {k00, k01, k02, k03}, \ + {k10, k11, k12, k13}, \ + {k20, k21, k22, k23}, \ + {k30, k31, k32, ___}, \ + {k40, k41, k42, k43}, \ + {k50, ___, k52, ___} \ } -void matrix_init_user(void); -void matrix_scan_user(void); -inline void cospad_bl_led_on(void) { PORTF &= ~(1<<7); } -inline void cospad_bl_led_off(void) { PORTF |= (1<<7); } - -inline void cospad_bl_led_togg(void) { - uint8_t bl_mask = PORTF&(1<<7); - if (bl_mask) { - PORTF &= ~(1<<7); - } else { - PORTF |= (1<<7); - } -} -#endif +// Add backwards compatibility for existing keymaps +#define cospad_bl_led_on backlight_enable +#define cospad_bl_led_off backlight_disable +#define cospad_bl_led_togg backlight_toggle diff --git a/keyboards/cospad/info.json b/keyboards/cospad/info.json index b34013a47a..c17f44f525 100644 --- a/keyboards/cospad/info.json +++ b/keyboards/cospad/info.json @@ -7,6 +7,7 @@ "height": 6, "layouts": { "LAYOUT_numpad_6x4": { + "key_count": 21, "layout": [ {"label":"Esc", "x":0, "y":0}, {"label":"Tab", "x":1, "y":0}, @@ -33,35 +34,62 @@ }, "LAYOUT_gamepad_6x4": { + "key_count": 23, "layout": [ - {"label":"k00", "x":5, "y":0}, - {"label":"k01", "x":5, "y":1}, - {"label":"k02", "x":5, "y":2}, - {"label":"k03", "x":5, "y":3}, - {"label":"k10", "x":4, "y":0}, - {"label":"k11", "x":4, "y":1}, - {"label":"k12", "x":4, "y":2}, - {"label":"k13", "x":4, "y":3}, - {"label":"k20", "x":3, "y":0}, - {"label":"k21", "x":3, "y":1}, - {"label":"k22", "x":3, "y":2}, - {"label":"k30", "x":2, "y":0}, - {"label":"k31", "x":2, "y":1}, - {"label":"k32", "x":2, "y":2}, - {"label":"k23", "x":2, "y":3, "w":2}, - {"label":"k40", "x":1, "y":0}, - {"label":"k41", "x":1, "y":1}, - {"label":"k42", "x":1, "y":2}, - {"label":"k43", "x":1, "y":3}, - {"label":"k50", "x":0, "y":0}, - {"label":"k51", "x":0, "y":1}, - {"label":"k52", "x":0, "y":2}, - {"label":"k53", "x":0, "y":3} + {"label":"k00", "x":0, "y":0}, + {"label":"k01", "x":1, "y":0}, + {"label":"k02", "x":2, "y":0}, + {"label":"k03", "x":3, "y":0}, + {"label":"k10", "x":0, "y":1}, + {"label":"k11", "x":1, "y":1}, + {"label":"k12", "x":2, "y":1}, + {"label":"k13", "x":3, "y":1}, + {"label":"k20", "x":0, "y":2}, + {"label":"k21", "x":1, "y":2}, + {"label":"k22", "x":2, "y":2}, + {"label":"k30", "x":0, "y":3}, + {"label":"k31", "x":1, "y":3}, + {"label":"k32", "x":2, "y":3}, + {"label":"k23", "x":3, "y":2, "h":2}, + {"label":"k40", "x":0, "y":4}, + {"label":"k41", "x":1, "y":4}, + {"label":"k42", "x":2, "y":4}, + {"label":"k43", "x":3, "y":4}, + {"label":"k50", "x":0, "y":5}, + {"label":"k51", "x":1, "y":5}, + {"label":"k52", "x":2, "y":5}, + {"label":"k53", "x":3, "y":5} ] }, "LAYOUT_ortho_6x4": { - "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"Tab", "x":1, "y":0}, {"label":"Fn", "x":2, "y":0}, {"label":"Back", "x":3, "y":0}, {"label":"Num Lock", "x":0, "y":1}, {"label":"/", "x":1, "y":1}, {"label":"*", "x":2, "y":1}, {"label":"-", "x":3, "y":1}, {"label":"7", "x":0, "y":2}, {"label":"8", "x":1, "y":2}, {"label":"9", "x":2, "y":2}, {"label":"+", "x":3, "y":2}, {"label":"4", "x":0, "y":3}, {"label":"5", "x":1, "y":3}, {"label":"6", "x":2, "y":3}, {"x":3, "y":3}, {"label":"1", "x":0, "y":4}, {"label":"2", "x":1, "y":4}, {"label":"3", "x":2, "y":4}, {"label":"Enter", "x":3, "y":4}, {"label":"0", "x":0, "y":5}, {"x":1, "y":5}, {"label":".", "x":2, "y":5}, {"x":3, "y":5}] + "key_count": 24, + "layout": [ + {"label":"k00", "x":0, "y":0}, + {"label":"k01", "x":1, "y":0}, + {"label":"k02", "x":2, "y":0}, + {"label":"k03", "x":3, "y":0}, + {"label":"k10", "x":0, "y":1}, + {"label":"k11", "x":1, "y":1}, + {"label":"k12", "x":2, "y":1}, + {"label":"k13", "x":3, "y":1}, + {"label":"k20", "x":0, "y":2}, + {"label":"k21", "x":1, "y":2}, + {"label":"k22", "x":2, "y":2}, + {"label":"k23", "x":3, "y":2}, + {"label":"k30", "x":0, "y":3}, + {"label":"k31", "x":1, "y":3}, + {"label":"k32", "x":2, "y":3}, + {"label":"k33", "x":3, "y":3}, + {"label":"k40", "x":0, "y":4}, + {"label":"k41", "x":1, "y":4}, + {"label":"k42", "x":2, "y":4}, + {"label":"k43", "x":3, "y":4}, + {"label":"k50", "x":0, "y":5}, + {"label":"k51", "x":1, "y":5}, + {"label":"k52", "x":2, "y":5}, + {"label":"k53", "x":3, "y":5} + ] } } } diff --git a/keyboards/cospad/keymaps/default/keymap.c b/keyboards/cospad/keymaps/default/keymap.c index 345e969962..adcca112d2 100644 --- a/keyboards/cospad/keymaps/default/keymap.c +++ b/keyboards/cospad/keymaps/default/keymap.c @@ -1,80 +1,60 @@ #include QMK_KEYBOARD_H -#include "led.h" // Each layer gets a name for readability, which is then used in the keymap matrix below. // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _BL 0 -#define _FL 1 +enum layers { + _BL = 0, + _FL +}; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* Keymap _BL: (Base Layer) Default Layer - * ,-------------------. - * |Esc |TAB | FN | BS | - * |----|----|----|----| - * | NL | / | * | - | - * |----|----|----|----| - * | 7 | 8 | 9 | | - * |----|----|----| + | - * | 4 | 5 | 6 | | - * |----|----|----|----| - * | 1 | 2 | 3 | | - * |----|----|----| En | - * | 0 | . | | - * `-------------------' - */ - -[_BL] = LAYOUT_numpad_6x4( - KC_ESC, KC_TAB, MO(_FL), KC_BSPC, \ - KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ - KC_P7, KC_P8, KC_P9, \ - KC_P4, KC_P5, KC_P6, KC_PPLS, \ - KC_P1, KC_P2, KC_P3, \ - KC_P0, KC_PDOT, KC_PENT), +/* Keymap _BL: (Base Layer) Default Layer + * ,-------------------. + * |Esc |TAB | FN | BS | + * |----|----|----|----| + * | NL | / | * | - | + * |----|----|----|----| + * | 7 | 8 | 9 | | + * |----|----|----| + | + * | 4 | 5 | 6 | | + * |----|----|----|----| + * | 1 | 2 | 3 | | + * |----|----|----| En | + * | 0 | . | | + * `-------------------' + */ + [_BL] = LAYOUT_numpad_6x4( + KC_ESC, KC_TAB, MO(_FL), KC_BSPC, \ + KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ + KC_P7, KC_P8, KC_P9, \ + KC_P4, KC_P5, KC_P6, KC_PPLS, \ + KC_P1, KC_P2, KC_P3, \ + KC_P0, KC_PDOT, KC_PENT + ), - /* Keymap _FL: Function Layer - * ,-------------------. - * |RGBT|TAB | FN | BS | - * |----|----|----|----| - * |RGBM|RGBP|BTOG| - | - * |----|----|----|----| - * |HUD |HUI |BON | | - * |----|----|----| + | - * |SAD |SAI |BOFF| | - * |----|----|----|----| - * |VAD |VAS | 3 | | - * |----|----|----| En | - * | 0 |RST | | - * `-------------------' - */ -[_FL] = LAYOUT_numpad_6x4( - RGB_TOG, KC_TAB, KC_TRNS, KC_BSPC, \ - RGB_MOD, RGB_M_P, BL_TOGG, KC_PMNS, \ - RGB_HUD, RGB_HUI, BL_ON, \ - RGB_SAD, RGB_SAI, BL_OFF, KC_PPLS, \ - RGB_VAD, RGB_VAI, KC_P3, \ - KC_P0, RESET, KC_PENT), +/* Keymap _FL: Function Layer + * ,-------------------. + * |RGBT| | | | + * |----|----|----|----| + * |RGBM|RGBP|BTOG| | + * |----|----|----|----| + * |HUD |HUI |BON | | + * |----|----|----| | + * |SAD |SAI |BOFF| | + * |----|----|----|----| + * |VAD |VAS |BSTP| | + * |----|----|----| | + * | |RST | | + * `-------------------' + */ + [_FL] = LAYOUT_numpad_6x4( + RGB_TOG, _______, _______, _______, \ + RGB_MOD, RGB_M_P, BL_TOGG, _______, \ + RGB_HUD, RGB_HUI, BL_ON, \ + RGB_SAD, RGB_SAI, BL_OFF, _______, \ + RGB_VAD, RGB_VAI, BL_STEP, \ + _______, RESET, _______ + ), }; - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case BL_TOGG: - if (record->event.pressed) { - cospad_bl_led_togg(); - } - return false; - case BL_ON: - if (record->event.pressed) { - cospad_bl_led_on(); - } - return false; - case BL_OFF: - if(record->event.pressed) { - cospad_bl_led_off(); - } - return false; - default: - return true; - } -} diff --git a/keyboards/cospad/rules.mk b/keyboards/cospad/rules.mk index 3c5913d0d9..61c7a5182c 100644 --- a/keyboards/cospad/rules.mk +++ b/keyboards/cospad/rules.mk @@ -1,6 +1,5 @@ # MCU name -#MCU = at90usb1287 MCU = atmega32u4 # Processor frequency. @@ -40,27 +39,43 @@ F_USB = $(F_CPU) OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# atmega32a bootloadHID +BOOTLOADER = atmel-dfu + + # Boot Section Size in *bytes* # Teensy halfKay 512 # Teensy++ halfKay 1024 # Atmel DFU loader 4096 # LUFA bootloader 4096 # USBaspLoader 2048 -OPT_DEFS += -DBOOTLOADER_SIZE=4096 +# OPT_DEFS += -DBOOTLOADER_SIZE=4096 # 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 -NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -RGBLIGHT_ENABLE = yes # Enable keyboard underlight functionality (+4870) -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality (+1150) -MIDI_ENABLE = no # MIDI controls -AUDIO_ENABLE = no -UNICODE_ENABLE = no # Unicode -BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +BOOTMAGIC_ENABLE = lite # 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 +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 = yes # Enable keyboard backlight functionality +BACKLIGHT_CUSTOM_DRIVER = yes +RGBLIGHT_ENABLE = yes # Enable keyboard underlight functionality (+4870) +MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) +UNICODE_ENABLE = no # Unicode +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) + + +LAYOUTS = numpad_6x4 ortho_6x4 From 5312131d35ee389231bfc596625ac5915264cc16 Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Wed, 24 Apr 2019 02:38:54 +0900 Subject: [PATCH 60/61] add RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; to eeconfig_update_rgblight_default() --- quantum/rgblight.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 5ec11bc077..0b90b79eaf 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -38,11 +38,13 @@ /* for split keyboard */ #define RGBLIGHT_SPLIT_SET_CHANGE_MODE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_MODE #define RGBLIGHT_SPLIT_SET_CHANGE_HSVS rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_HSVS + #define RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS rgblight_status.change_flags |= (RGBLIGHT_STATUS_CHANGE_MODE|RGBLIGHT_STATUS_CHANGE_HSVS) #define RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_TIMER #define RGBLIGHT_SPLIT_ANIMATION_TICK rgblight_status.change_flags |= RGBLIGHT_STATUS_ANIMATION_TICK #else #define RGBLIGHT_SPLIT_SET_CHANGE_MODE #define RGBLIGHT_SPLIT_SET_CHANGE_HSVS + #define RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS #define RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE #define RGBLIGHT_SPLIT_ANIMATION_TICK #endif @@ -221,6 +223,7 @@ void eeconfig_update_rgblight_default(void) { rgblight_config.sat = 255; rgblight_config.val = RGBLIGHT_LIMIT_VAL; rgblight_config.speed = 0; + RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; eeconfig_update_rgblight(rgblight_config.raw); } @@ -249,7 +252,7 @@ void rgblight_init(void) { eeconfig_update_rgblight_default(); } rgblight_config.raw = eeconfig_read_rgblight(); - RGBLIGHT_SPLIT_SET_CHANGE_HSVS; + RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; if (!rgblight_config.mode) { dprintf("rgblight_init rgblight_config.mode = 0. Write default values to EEPROM.\n"); eeconfig_update_rgblight_default(); From 9f8c8c53a51ec6bb8acd55683b1d024558b071ab Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Wed, 24 Apr 2019 02:43:44 +0900 Subject: [PATCH 61/61] add RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; to rgblight_update_dword() --- quantum/rgblight.c | 1 + 1 file changed, 1 insertion(+) diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 0b90b79eaf..2f23768ed7 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -279,6 +279,7 @@ uint32_t rgblight_read_dword(void) { } void rgblight_update_dword(uint32_t dword) { + RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; rgblight_config.raw = dword; if (rgblight_config.enable) rgblight_mode_noeeprom(rgblight_config.mode);