diff options
Diffstat (limited to 'keyboards')
51 files changed, 1196 insertions, 1055 deletions
diff --git a/keyboards/ergodox_ez/config.h b/keyboards/ergodox_ez/config.h index 65d307d28c..5fdc4e5f19 100644 --- a/keyboards/ergodox_ez/config.h +++ b/keyboards/ergodox_ez/config.h @@ -24,11 +24,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* USB Device descriptor parameter */ #define VENDOR_ID 0x3297 -#define PRODUCT_ID 0x4974 #define DEVICE_VER 0x0001 -#define MANUFACTURER ZSA Technology Labs Inc +#define MANUFACTURER ZSA Technology Labs +#define PRODUCT_ID 0x4974 #define PRODUCT ErgoDox EZ -#define WEBUSB_LANDING_PAGE_URL u8"configure.ergodox-ez.com" /* key matrix size */ #define MATRIX_ROWS 14 @@ -44,7 +43,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MATRIX_EXPANDER_COL_PINS { 5, 4, 3, 2, 1, 0 } #define MATRIX_EXPANDER_ROW_PINS { 0, 1, 2, 3, 4, 5, 6 } - #define MOUSEKEY_INTERVAL 20 #define MOUSEKEY_DELAY 0 #define MOUSEKEY_TIME_TO_MAX 60 @@ -54,6 +52,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MOUSEKEY_WHEEL_MAX_SPEED MOUSEKEY_MAX_SPEED #define MOUSEKEY_WHEEL_TIME_TO_MAX MOUSEKEY_TIME_TO_MAX +#define DEBOUNCE 30 + #define TAPPING_TOGGLE 1 /* define if matrix has ghost */ @@ -114,9 +114,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. * manufacturer specs. */ -#define DEBOUNCE 30 - -#define USB_MAX_POWER_CONSUMPTION 500 // RGB backlight #define DRIVER_ADDR_1 0b1110100 @@ -128,7 +125,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define RGB_MATRIX_LED_PROCESS_LIMIT 5 #define RGB_MATRIX_LED_FLUSH_LIMIT 26 -#define RGB_DISABLE_WHEN_USB_SUSPENDED true + +#define RGB_DISABLE_WHEN_USB_SUSPENDED // #define RGBLIGHT_COLOR_LAYER_0 0x00, 0x00, 0xFF /* #define RGBLIGHT_COLOR_LAYER_1 0x00, 0x00, 0xFF */ diff --git a/keyboards/ergodox_ez/ergodox_ez.c b/keyboards/ergodox_ez/ergodox_ez.c index 9f3d82581e..c7fded7fbb 100644 --- a/keyboards/ergodox_ez/ergodox_ez.c +++ b/keyboards/ergodox_ez/ergodox_ez.c @@ -43,29 +43,30 @@ extern inline void ergodox_right_led_set(uint8_t led, uint8_t n); extern inline void ergodox_led_all_set(uint8_t n); keyboard_config_t keyboard_config; -bool i2c_initialized = 0; + +bool i2c_initialized = 0; i2c_status_t mcp23018_status = 0x20; void matrix_init_kb(void) { - // keyboard LEDs (see "PWM on ports OC1(A|B|C)" in "teensy-2-0.md") + // keyboard LEDs (see "PWM on ports OC1(A|B|C)" in "teensy-2-0.md") TCCR1A = 0b10101001; // set and configure fast PWM TCCR1B = 0b00001001; // set and configure fast PWM // (tied to Vcc for hardware convenience) - DDRB &= ~(1<<4); // set B(4) as input - PORTB &= ~(1<<4); // set B(4) internal pull-up disabled + DDRB &= ~(1 << 4); // set B(4) as input + PORTB &= ~(1 << 4); // set B(4) internal pull-up disabled // unused pins - C7, D4, D5, D7, E6 // set as input with internal pull-up enabled - DDRC &= ~(1<<7); - DDRD &= ~(1<<5 | 1<<4); - DDRE &= ~(1<<6); - PORTC |= (1<<7); - PORTD |= (1<<5 | 1<<4); - PORTE |= (1<<6); + DDRC &= ~(1 << 7); + DDRD &= ~(1 << 5 | 1 << 4); + DDRE &= ~(1 << 6); + PORTC |= (1 << 7); + PORTD |= (1 << 5 | 1 << 4); + PORTE |= (1 << 6); keyboard_config.raw = eeconfig_read_kb(); - ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 ); + ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4); #ifdef RGB_MATRIX_ENABLE if (keyboard_config.rgb_matrix_enable) { rgb_matrix_set_flags(LED_FLAG_ALL); @@ -79,8 +80,7 @@ void matrix_init_kb(void) { matrix_init_user(); } -void ergodox_blink_all_leds(void) -{ +void ergodox_blink_all_leds(void) { ergodox_led_all_off(); ergodox_led_all_set(LED_BRIGHTNESS_DEFAULT); ergodox_right_led_1_on(); @@ -93,17 +93,17 @@ void ergodox_blink_all_leds(void) ergodox_left_led_1_on(); _delay_ms(50); if (!mcp23018_status) { - mcp23018_status = ergodox_left_leds_update(); + mcp23018_status = ergodox_left_leds_update(); } ergodox_left_led_2_on(); _delay_ms(50); if (!mcp23018_status) { - mcp23018_status = ergodox_left_leds_update(); + mcp23018_status = ergodox_left_leds_update(); } ergodox_left_led_3_on(); _delay_ms(50); if (!mcp23018_status) { - mcp23018_status = ergodox_left_leds_update(); + mcp23018_status = ergodox_left_leds_update(); } #endif ergodox_right_led_1_off(); @@ -115,21 +115,21 @@ void ergodox_blink_all_leds(void) _delay_ms(50); ergodox_left_led_1_off(); if (!mcp23018_status) { - mcp23018_status = ergodox_left_leds_update(); + mcp23018_status = ergodox_left_leds_update(); } _delay_ms(50); ergodox_left_led_2_off(); if (!mcp23018_status) { - mcp23018_status = ergodox_left_leds_update(); + mcp23018_status = ergodox_left_leds_update(); } _delay_ms(50); ergodox_left_led_3_off(); if (!mcp23018_status) { - mcp23018_status = ergodox_left_leds_update(); + mcp23018_status = ergodox_left_leds_update(); } #endif - //ergodox_led_all_on(); + // ergodox_led_all_on(); //_delay_ms(333); ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 ); @@ -157,27 +157,35 @@ uint8_t init_mcp23018(void) { // - unused : input : 1 // - input : input : 1 // - driving : output : 0 - mcp23018_status = i2c_start(I2C_ADDR_WRITE, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(IODIRA, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00000000, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00111111, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; + mcp23018_status = i2c_start(I2C_ADDR_WRITE, ERGODOX_EZ_I2C_TIMEOUT); + if (mcp23018_status) goto out; + mcp23018_status = i2c_write(IODIRA, ERGODOX_EZ_I2C_TIMEOUT); + if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00000000, ERGODOX_EZ_I2C_TIMEOUT); + if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00111111, ERGODOX_EZ_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, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(GPPUA, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00000000, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00111111, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; + mcp23018_status = i2c_start(I2C_ADDR_WRITE, ERGODOX_EZ_I2C_TIMEOUT); + if (mcp23018_status) goto out; + mcp23018_status = i2c_write(GPPUA, ERGODOX_EZ_I2C_TIMEOUT); + if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00000000, ERGODOX_EZ_I2C_TIMEOUT); + if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00111111, ERGODOX_EZ_I2C_TIMEOUT); + if (mcp23018_status) goto out; out: i2c_stop(); #ifdef LEFT_LEDS if (!mcp23018_status) mcp23018_status = ergodox_left_leds_update(); -#endif // LEFT_LEDS +#endif // LEFT_LEDS // SREG=sreg_prev; @@ -186,12 +194,12 @@ out: #ifdef LEFT_LEDS uint8_t ergodox_left_leds_update(void) { - if (mcp23018_status) { // if there was an error + if (mcp23018_status) { // if there was an error return mcp23018_status; } -#define LEFT_LED_1_SHIFT 7 // in MCP23018 port B -#define LEFT_LED_2_SHIFT 6 // in MCP23018 port B -#define LEFT_LED_3_SHIFT 7 // in MCP23018 port A +# define LEFT_LED_1_SHIFT 7 // in MCP23018 port B +# define LEFT_LED_2_SHIFT 6 // in MCP23018 port B +# define LEFT_LED_3_SHIFT 7 // in MCP23018 port A // set logical value (doesn't matter on inputs) // - unused : hi-Z : 1 @@ -201,59 +209,43 @@ uint8_t ergodox_left_leds_update(void) { if (mcp23018_status) goto out; mcp23018_status = i2c_write(OLATA, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b11111111 - & ~(ergodox_left_led_3<<LEFT_LED_3_SHIFT), - ERGODOX_EZ_I2C_TIMEOUT); + mcp23018_status = i2c_write(0b11111111 & ~(ergodox_left_led_3 << LEFT_LED_3_SHIFT), ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b11111111 - & ~(ergodox_left_led_2<<LEFT_LED_2_SHIFT) - & ~(ergodox_left_led_1<<LEFT_LED_1_SHIFT), - ERGODOX_EZ_I2C_TIMEOUT); + mcp23018_status = i2c_write(0b11111111 & ~(ergodox_left_led_2 << LEFT_LED_2_SHIFT) & ~(ergodox_left_led_1 << LEFT_LED_1_SHIFT), ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - out: +out: i2c_stop(); return mcp23018_status; } #endif - #ifdef SWAP_HANDS_ENABLE -__attribute__ ((weak)) +__attribute__((weak)) // swap-hands action needs a matrix to define the swap -const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { +const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { /* Left hand, matrix positions */ - {{0,13}, {1,13}, {2,13}, {3,13}, {4,13}, {5,13}}, - {{0,12}, {1,12}, {2,12}, {3,12}, {4,12}, {5,12}}, - {{0,11}, {1,11}, {2,11}, {3,11}, {4,11}, {5,11}}, - {{0,10}, {1,10}, {2,10}, {3,10}, {4,10}, {5,10}}, - {{0,9}, {1,9}, {2,9}, {3,9}, {4,9}, {5,9}}, - {{0,8}, {1,8}, {2,8}, {3,8}, {4,8}, {5,8}}, - {{0,7}, {1,7}, {2,7}, {3,7}, {4,7}, {5,7}}, + {{0, 13}, {1, 13}, {2, 13}, {3, 13}, {4, 13}, {5, 13}}, + {{0, 12}, {1, 12}, {2, 12}, {3, 12}, {4, 12}, {5, 12}}, + {{0, 11}, {1, 11}, {2, 11}, {3, 11}, {4, 11}, {5, 11}}, + {{0, 10}, {1, 10}, {2, 10}, {3, 10}, {4, 10}, {5, 10}}, + {{0, 9}, {1, 9}, {2, 9}, {3, 9}, {4, 9}, {5, 9}}, + {{0, 8}, {1, 8}, {2, 8}, {3, 8}, {4, 8}, {5, 8}}, + {{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}, {5, 7}}, /* Right hand, matrix positions */ - {{0,6}, {1,6}, {2,6}, {3,6}, {4,6}, {5,6}}, - {{0,5}, {1,5}, {2,5}, {3,5}, {4,5}, {5,5}}, - {{0,4}, {1,4}, {2,4}, {3,4}, {4,4}, {5,4}}, - {{0,3}, {1,3}, {2,3}, {3,3}, {4,3}, {5,3}}, - {{0,2}, {1,2}, {2,2}, {3,2}, {4,2}, {5,2}}, - {{0,1}, {1,1}, {2,1}, {3,1}, {4,1}, {5,1}}, - {{0,0}, {1,0}, {2,0}, {3,0}, {4,0}, {5,0}}, + {{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}}, + {{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}}, + {{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}}, + {{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}}, + {{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}}, + {{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}}, + {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}}, }; #endif #ifdef RGB_MATRIX_ENABLE - -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(); -} - -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +// clang-format off +const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = { /* driver * | R location * | | G location @@ -347,62 +339,63 @@ led_config_t g_led_config = { { 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1 } }; +// clang-format on +# ifdef ORYX_CONFIGURATOR void keyboard_post_init_kb(void) { rgb_matrix_enable_noeeprom(); keyboard_post_init_user(); } +# endif #endif - +#ifdef ORYX_CONFIGURATOR bool process_record_kb(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case LED_LEVEL: if (record->event.pressed) { - keyboard_config.led_level++; - if (keyboard_config.led_level > 4) { + keyboard_config.led_level++; + if (keyboard_config.led_level > 4) { keyboard_config.led_level = 0; - } - ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 ); - eeconfig_update_kb(keyboard_config.raw); - layer_state_set_kb(layer_state); + } + ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4); + eeconfig_update_kb(keyboard_config.raw); + layer_state_set_kb(layer_state); } break; -#ifdef RGB_MATRIX_ENABLE +# ifdef RGB_MATRIX_ENABLE case TOGGLE_LAYER_COLOR: if (record->event.pressed) { keyboard_config.disable_layer_led ^= 1; - if (keyboard_config.disable_layer_led) - rgb_matrix_set_color_all(0, 0, 0); + if (keyboard_config.disable_layer_led) rgb_matrix_set_color_all(0, 0, 0); eeconfig_update_kb(keyboard_config.raw); } break; case RGB_TOG: if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - keyboard_config.rgb_matrix_enable = false; - rgb_matrix_set_color_all(0, 0, 0); - } - break; - default: { - rgb_matrix_set_flags(LED_FLAG_ALL); - keyboard_config.rgb_matrix_enable = true; - } - break; - } - eeconfig_update_kb(keyboard_config.raw); + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_NONE); + keyboard_config.rgb_matrix_enable = false; + rgb_matrix_set_color_all(0, 0, 0); + } break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + keyboard_config.rgb_matrix_enable = true; + } break; + } + eeconfig_update_kb(keyboard_config.raw); } return false; -#endif +# endif } return process_record_user(keycode, record); } +#endif void eeconfig_init_kb(void) { // EEPROM is getting reset! - keyboard_config.raw = 0; - keyboard_config.led_level = 4; + keyboard_config.raw = 0; + keyboard_config.led_level = 4; keyboard_config.rgb_matrix_enable = true; eeconfig_update_kb(keyboard_config.raw); eeconfig_init_user(); diff --git a/keyboards/ergodox_ez/ergodox_ez.h b/keyboards/ergodox_ez/ergodox_ez.h index a10e0fee63..eb04cb88c0 100644 --- a/keyboards/ergodox_ez/ergodox_ez.h +++ b/keyboards/ergodox_ez/ergodox_ez.h @@ -86,8 +86,7 @@ inline void ergodox_left_led_2_off(void) { ergodox_left_led_2 = 0; } inline void ergodox_left_led_3_off(void) { ergodox_left_led_3 = 0; } #endif // LEFT_LEDS -inline void ergodox_led_all_on(void) -{ +inline void ergodox_led_all_on(void) { ergodox_board_led_on(); ergodox_right_led_1_on(); ergodox_right_led_2_on(); @@ -121,8 +120,7 @@ inline void ergodox_right_led_set(uint8_t led, uint8_t n) { (OCR1C = n); } -inline void ergodox_led_all_set(uint8_t n) -{ +inline void ergodox_led_all_set(uint8_t n) { ergodox_right_led_1_set(n); ergodox_right_led_2_set(n); ergodox_right_led_3_set(n); diff --git a/keyboards/ergodox_ez/glow/glow.h b/keyboards/ergodox_ez/glow/glow.h index a504e4fdfb..da7a6073ef 100644 --- a/keyboards/ergodox_ez/glow/glow.h +++ b/keyboards/ergodox_ez/glow/glow.h @@ -3,14 +3,17 @@ Copyright 2012 Jun Wako <wakojun@gmail.com> Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com> Copyright 2015 ZSA Technology Labs Inc (@zsa) Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + 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 <http://www.gnu.org/licenses/>. */ diff --git a/keyboards/ergodox_ez/glow/rules.mk b/keyboards/ergodox_ez/glow/rules.mk index f1a5c8b0f2..aad92997d0 100644 --- a/keyboards/ergodox_ez/glow/rules.mk +++ b/keyboards/ergodox_ez/glow/rules.mk @@ -1,3 +1 @@ -RGB_MATRIX_ENABLE = IS31FL3731 RGB_MATRIX_ENABLE = yes -RGB_MATRIX_DRIVER = IS31FL3731 diff --git a/keyboards/ergodox_ez/info.json b/keyboards/ergodox_ez/info.json index 6f7a941574..1682f4bb45 100644 --- a/keyboards/ergodox_ez/info.json +++ b/keyboards/ergodox_ez/info.json @@ -1,10 +1,7 @@ { "keyboard_name": "ErgoDox EZ", "url": "ergodox-ez.com", - "maintainer": "erez", - "width": 17, - "height": 8, - + "maintainer": "ZSA via Drashna", "layouts": { "LAYOUT_ergodox": { "layout": [ diff --git a/keyboards/ergodox_ez/keymaps/default/keymap.c b/keyboards/ergodox_ez/keymaps/default/keymap.c index 9550d6465c..3c0ef320a4 100644 --- a/keyboards/ergodox_ez/keymaps/default/keymap.c +++ b/keyboards/ergodox_ez/keymaps/default/keymap.c @@ -1,16 +1,21 @@ #include QMK_KEYBOARD_H #include "version.h" -#define BASE 0 // default layer -#define SYMB 1 // symbols -#define MDIA 2 // media keys +enum layers { + BASE, // default layer + SYMB, // symbols + MDIA, // media keys +}; enum custom_keycodes { - EPRM = SAFE_RANGE, - VRSN, - RGB_SLD +#ifdef ORYX_CONFIGURATOR + VRSN = EZ_SAFE_RANGE, +#else + VRSN = SAFE_RANGE, +#endif }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap 0: Basic layer * @@ -33,25 +38,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | |ace | End | | PgDn | | | * `--------------------' `----------------------' */ -[BASE] = LAYOUT_ergodox( +[BASE] = LAYOUT_ergodox_pretty( // left hand - KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, - KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), - KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, - KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), - LT(SYMB,KC_GRV), KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT, - ALT_T(KC_APP), KC_LGUI, - KC_HOME, - KC_SPC, KC_BSPC, KC_END, - // right hand - KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, - TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, - KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN), GUI_T(KC_QUOT), - MEH_T(KC_NO), KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLSH), KC_RSFT, - KC_UP, KC_DOWN, KC_LBRC, KC_RBRC, TT(SYMB), - KC_LALT, CTL_T(KC_ESC), - KC_PGUP, - KC_PGDN, KC_TAB, KC_ENT + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_DEL, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN), GUI_T(KC_QUOT), + KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), MEH_T(KC_NO), KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLSH), KC_RSFT, + LT(SYMB,KC_GRV), KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT, KC_UP, KC_DOWN, KC_LBRC, KC_RBRC, TT(SYMB), + ALT_T(KC_APP), KC_LGUI, KC_LALT, CTL_T(KC_ESC), + KC_HOME, KC_PGUP, + KC_SPC, KC_BSPC, KC_END, KC_PGDN, KC_TAB, KC_ENT ), /* Keymap 1: Symbol Layer * @@ -74,25 +70,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | * `--------------------' `--------------------' */ -[SYMB] = LAYOUT_ergodox( +[SYMB] = LAYOUT_ergodox_pretty( // left hand - VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, - KC_TRNS, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, KC_TRNS, - KC_TRNS, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_GRV, - KC_TRNS, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, KC_TRNS, - EPRM, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - RGB_MOD, KC_TRNS, - KC_TRNS, - RGB_VAD, RGB_VAI, KC_TRNS, - // right hand - KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, - KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12, - KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS, - KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, - KC_TRNS, KC_DOT, KC_0, KC_EQL, KC_TRNS, - RGB_TOG, RGB_SLD, - KC_TRNS, - KC_TRNS, RGB_HUD, RGB_HUI + VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_TRNS, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, KC_TRNS, KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12, + KC_TRNS, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_GRV, KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS, + KC_TRNS, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, KC_TRNS, KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, + EEP_RST, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DOT, KC_0, KC_EQL, KC_TRNS, + RGB_MOD, KC_TRNS, RGB_TOG, RGB_M_P, + KC_TRNS, KC_TRNS, + RGB_VAD, RGB_VAI, KC_TRNS, KC_TRNS, RGB_HUD, RGB_HUI ), /* Keymap 2: Media and mouse keys * @@ -115,122 +102,103 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | * `--------------------' `--------------------' */ -[MDIA] = LAYOUT_ergodox( +[MDIA] = LAYOUT_ergodox_pretty( // left hand - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, - KC_TRNS, KC_TRNS, - KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, - // right hand - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, - KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, - KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, - KC_TRNS, - KC_TRNS, KC_TRNS, KC_WBAK + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, + + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_WBAK ), }; +// clang-format on bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if (record->event.pressed) { - switch (keycode) { - case EPRM: - eeconfig_init(); - return false; - case VRSN: - SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); - return false; -#ifdef RGBLIGHT_ENABLE - case RGB_SLD: - rgblight_mode(1); - return false; -#endif + if (record->event.pressed) { + switch (keycode) { + case VRSN: + SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + return false; + } } - } - return true; + return true; } // Runs just one time when the keyboard initializes. -void matrix_init_user(void) { +void keyboard_post_init_user(void) { #ifdef RGBLIGHT_COLOR_LAYER_0 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); #endif }; // Runs whenever there is a layer state change. layer_state_t layer_state_set_user(layer_state_t state) { - ergodox_board_led_off(); - ergodox_right_led_1_off(); - ergodox_right_led_2_off(); - ergodox_right_led_3_off(); + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); - uint8_t layer = biton32(state); - switch (layer) { - case 0: - #ifdef RGBLIGHT_COLOR_LAYER_0 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); - #else - #ifdef RGBLIGHT_ENABLE - rgblight_init(); - #endif - #endif - break; - case 1: - ergodox_right_led_1_on(); - #ifdef RGBLIGHT_COLOR_LAYER_1 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_1); - #endif - break; - case 2: - ergodox_right_led_2_on(); - #ifdef RGBLIGHT_COLOR_LAYER_2 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_2); - #endif - break; - case 3: - ergodox_right_led_3_on(); - #ifdef RGBLIGHT_COLOR_LAYER_3 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_3); - #endif - break; - case 4: - ergodox_right_led_1_on(); - ergodox_right_led_2_on(); - #ifdef RGBLIGHT_COLOR_LAYER_4 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_4); - #endif - break; - case 5: - ergodox_right_led_1_on(); - ergodox_right_led_3_on(); - #ifdef RGBLIGHT_COLOR_LAYER_5 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_5); - #endif - break; - case 6: - ergodox_right_led_2_on(); - ergodox_right_led_3_on(); - #ifdef RGBLIGHT_COLOR_LAYER_6 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_6); - #endif - break; - case 7: - ergodox_right_led_1_on(); - ergodox_right_led_2_on(); - ergodox_right_led_3_on(); - #ifdef RGBLIGHT_COLOR_LAYER_7 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_7); - #endif - break; - default: - break; + uint8_t layer = get_highest_layer(state); + switch (layer) { + case 0: +#ifdef RGBLIGHT_COLOR_LAYER_0 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); +#endif + break; + case 1: + ergodox_right_led_1_on(); +#ifdef RGBLIGHT_COLOR_LAYER_1 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_1); +#endif + break; + case 2: + ergodox_right_led_2_on(); +#ifdef RGBLIGHT_COLOR_LAYER_2 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_2); +#endif + break; + case 3: + ergodox_right_led_3_on(); +#ifdef RGBLIGHT_COLOR_LAYER_3 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_3); +#endif + break; + case 4: + ergodox_right_led_1_on(); + ergodox_right_led_2_on(); +#ifdef RGBLIGHT_COLOR_LAYER_4 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_4); +#endif + break; + case 5: + ergodox_right_led_1_on(); + ergodox_right_led_3_on(); +#ifdef RGBLIGHT_COLOR_LAYER_5 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_5); +#endif + break; + case 6: + ergodox_right_led_2_on(); + ergodox_right_led_3_on(); +#ifdef RGBLIGHT_COLOR_LAYER_6 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_6); +#endif + break; + case 7: + ergodox_right_led_1_on(); + ergodox_right_led_2_on(); + ergodox_right_led_3_on(); +#ifdef RGBLIGHT_COLOR_LAYER_7 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_7); +#endif + break; + default: + break; } - return state; + return state; }; diff --git a/keyboards/ergodox_ez/matrix.c b/keyboards/ergodox_ez/matrix.c index 88aeb61722..41919a7000 100644 --- a/keyboards/ergodox_ez/matrix.c +++ b/keyboards/ergodox_ez/matrix.c @@ -24,6 +24,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ + /* * scan matrix */ diff --git a/keyboards/ergodox_ez/rules.mk b/keyboards/ergodox_ez/rules.mk index bfd8355ad0..88821a1deb 100644 --- a/keyboards/ergodox_ez/rules.mk +++ b/keyboards/ergodox_ez/rules.mk @@ -2,13 +2,6 @@ MCU = atmega32u4 # Bootloader selection -# Teensy halfkay -# Pro Micro caterina -# Atmel DFU atmel-dfu -# LUFA DFU lufa-dfu -# QMK DFU qmk-dfu -# ATmega32A bootloadHID -# ATmega328P USBasp BOOTLOADER = halfkay # If you have Left LEDs (see @@ -19,27 +12,29 @@ BOOTLOADER = halfkay # Build Options # comment out to disable the options. # -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = yes # Commands for debug and configuration CUSTOM_MATRIX = lite # Custom matrix file for the ErgoDox EZ NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work + UNICODE_ENABLE = no # Unicode SWAP_HANDS_ENABLE= no # Allow swapping hands of keyboard SLEEP_LED_ENABLE = no -API_SYSEX_ENABLE = no RGB_MATRIX_ENABLE = no # enable later RGB_MATRIX_DRIVER = IS31FL3731 -DEBOUNCE_TYPE = eager_pr +DEBOUNCE_TYPE = sym_eager_pr # project specific files SRC += matrix.c \ led_i2c.c QUANTUM_LIB_SRC += i2c_master.c -LAYOUTS = ergodox - MOUSE_SHARED_EP = no + +# Disable unsupported hardware +AUDIO_SUPPORTED = no +BACKLIGHT_SUPPORTED = no diff --git a/keyboards/ergodox_ez/shine/config.h b/keyboards/ergodox_ez/shine/config.h index c2bc6b5342..cf4f59f3b8 100644 --- a/keyboards/ergodox_ez/shine/config.h +++ b/keyboards/ergodox_ez/shine/config.h @@ -3,14 +3,17 @@ Copyright 2012 Jun Wako <wakojun@gmail.com> Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com> Copyright 2015 ZSA Technology Labs Inc (@zsa) Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + 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 <http://www.gnu.org/licenses/>. */ diff --git a/keyboards/ergodox_ez/shine/shine.h b/keyboards/ergodox_ez/shine/shine.h index a504e4fdfb..da7a6073ef 100644 --- a/keyboards/ergodox_ez/shine/shine.h +++ b/keyboards/ergodox_ez/shine/shine.h @@ -3,14 +3,17 @@ Copyright 2012 Jun Wako <wakojun@gmail.com> Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com> Copyright 2015 ZSA Technology Labs Inc (@zsa) Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + 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 <http://www.gnu.org/licenses/>. */ diff --git a/keyboards/ergodox_ez/util/compile_keymap.py b/keyboards/ergodox_ez/util/compile_keymap.py index f427d6fd80..b447ecaf5c 100644..100755 --- a/keyboards/ergodox_ez/util/compile_keymap.py +++ b/keyboards/ergodox_ez/util/compile_keymap.py @@ -584,11 +584,6 @@ def unicode_macro_cases(config): for macro_id, uc_hex in config['unicode_macros'].items(): hi = int(uc_hex, 16) >> 8 lo = int(uc_hex, 16) & 0xFF - unimacro_keys = ", ".join( - "T({})".format( - "KP_" + digit if digit.isdigit() else digit - ) for digit in uc_hex - ) yield UNICODE_MACRO_TEMPLATE.format( macro_id=macro_id, hi=hi, lo=lo ) diff --git a/keyboards/ergodox_ez/util/readme.md b/keyboards/ergodox_ez/util/readme.md index 26c5e5d99c..deb0cad5db 100644 --- a/keyboards/ergodox_ez/util/readme.md +++ b/keyboards/ergodox_ez/util/readme.md @@ -1,3 +1,11 @@ # ErgoDox EZ Utilities +## compile_keymap.py + The Python script in this directory, by [mbarkhau](https://github.com/mbarkhau) allows you to write out a basic ErgoDox EZ keymap using Markdown notation, and then transpile it to C, which you can then compile. It's experimental, but if you're not comfortable using C, it's a nice option. + +## keymap_beautifier.py + +This Python 3 script, by [Tsan-Kuang Lee](https://github.com/tsankuanglee) takes the keymap.c downloaded from [ErgoDox EZ Configurator](https://configure.ergodox-ez.com/) and beautifies it for easier customization, allowing one to quickly draft a layout to build upon. + +See [README.md](./keymap_beautifier/README.md) for this utility for more details. diff --git a/keyboards/moonlander/config.h b/keyboards/moonlander/config.h index d49c33de8c..a3e2975735 100644 --- a/keyboards/moonlander/config.h +++ b/keyboards/moonlander/config.h @@ -1,19 +1,20 @@ -/* -Copyright 2018 Jack Humbert <jack.humb@gmail.com> - -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 <http://www.gnu.org/licenses/>. -*/ +/* Copyright 2020 ZSA Technology Labs, Inc <@zsa> + * Copyright 2020 Jack Humbert <jack.humb@gmail.com> + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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 <http://www.gnu.org/licenses/>. + */ #pragma once @@ -23,9 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // clang-format off #define VENDOR_ID 0x3297 #define PRODUCT_ID 0x1969 -#define MANUFACTURER ZSA +#define MANUFACTURER ZSA Technology Labs #define PRODUCT Moonlander Mark I -#define DESCRIPTION A keyboard #define DEVICE_VER 0x0001 #define WEBUSB_LANDING_PAGE_URL u8"configure.ergodox-ez.com" @@ -35,9 +35,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MATRIX_ROWS 12 #define MATRIX_COLS 7 -/* Planck PCB default pin-out */ +/* PCB default pin-out */ // #define MATRIX_ROW_PINS { B10, B11, B12, B13, B14, B15 } -// #define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6 } +// #define MATRIX_COL_PINS { A0, A1, A2, A3, A6, A7, B0 } // #define MCP23_ROW_PINS { GPB5, GBP4, GBP3, GBP2, GBP1, GBP0 } // #define MCP23_COL_PINS { GPA0, GBA1, GBA2, GBA3, GBA4, GBA5, GBA6 } @@ -46,9 +46,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // #define MCP23_LED_G GPB6 // #define MCP23_LED_B GPA7 -#define EEPROM_I2C_24LC128 -#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR (1638-1) - // Not needed, is default address: // #define EXTERNAL_EEPROM_I2C_BASE_ADDRESS 0b10100000 @@ -78,10 +75,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. //#define NO_ACTION_LAYER //#define NO_ACTION_TAPPING //#define NO_ACTION_ONESHOT -# define NO_ACTION_MACRO -# define NO_ACTION_FUNCTION - -#define I2C1_CLOCK_SPEED 400000 +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION #define DRIVER_ADDR_1 0b1110100 #define DRIVER_ADDR_2 0b1110111 @@ -90,12 +85,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define DRIVER_1_LED_TOTAL 36 #define DRIVER_2_LED_TOTAL 36 #define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) -#define RGB_MATRIX_CENTER \ - { 125, 26 } -#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 175 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 +#define RGB_MATRIX_CENTER { 125, 26 } +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 175 #define RGB_MATRIX_FRAMEBUFFER_EFFECTS #define RGB_MATRIX_KEYPRESSES -#define RGB_DISABLE_WHEN_USB_SUSPENDED true +#define RGB_DISABLE_WHEN_USB_SUSPENDED // #define RGB_MATRIX_LED_PROCESS_LIMIT 5 // #define RGB_MATRIX_LED_FLUSH_LIMIT 26 @@ -115,6 +109,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MUSIC_MAP - #define FIRMWARE_VERSION_SIZE 17 #define DYNAMIC_KEYMAP_EEPROM_ADDR (EECONFIG_SIZE + FIRMWARE_VERSION_SIZE) + +#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 16383 +#define DYNAMIC_KEYMAP_LAYER_COUNT 8 +#define EEPROM_I2C_24LC128 + +#define AUDIO_PIN A5 +#define AUDIO_PIN_ALT A4 +#define AUDIO_PIN_ALT_AS_NEGATIVE diff --git a/keyboards/moonlander/halconf.h b/keyboards/moonlander/halconf.h new file mode 100644 index 0000000000..46b53b1a7f --- /dev/null +++ b/keyboards/moonlander/halconf.h @@ -0,0 +1,22 @@ +/* Copyright 2021 QMK + * + * 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 3 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 <https://www.gnu.org/licenses/>. + */ +#pragma once + +#define HAL_USE_I2C TRUE +#define HAL_USE_GPT TRUE +#define HAL_USE_DAC TRUE + +#include_next <halconf.h> diff --git a/keyboards/moonlander/info.json b/keyboards/moonlander/info.json new file mode 100644 index 0000000000..60b560eeee --- /dev/null +++ b/keyboards/moonlander/info.json @@ -0,0 +1,27 @@ +{ + "keyboard_name": "Moonlander Mark I", + "url": "zsa.io/moonlander", + "maintainer": "ZSA via Drashna", + "layouts": { + "LAYOUT_moonlander": { + "layout": [ + {"x":0, "y":0.375}, {"x":1, "y":0.375}, {"x":2, "y":0.125}, {"x":3, "y":0}, {"x":4, "y":0.125}, {"x":5, "y":0.25}, {"x":6, "y":0.25}, + {"x":10, "y":0.25}, {"x":11, "y":0.25}, {"x":12, "y":0.125}, {"x":13, "y":0}, {"x":14, "y":0.125}, {"x":15, "y":0.375}, {"x":16, "y":0.375}, + + {"x":0, "y":1.375}, {"x":1, "y":1.375}, {"x":2, "y":1.125}, {"x":3, "y":1}, {"x":4, "y":1.125}, {"x":5, "y":1.25}, {"x":6, "y":1.25}, + {"x":10, "y":1.25}, {"x":11, "y":1.25}, {"x":12, "y":1.125}, {"x":13, "y":1}, {"x":14, "y":1.125}, {"x":15, "y":1.375}, {"x":16, "y":1.375}, + + {"x":0, "y":2.375}, {"x":1, "y":2.375}, {"x":2, "y":2.125}, {"x":3, "y":2}, {"x":4, "y":2.125}, {"x":5, "y":2.25}, {"x":6, "y":2.25}, + {"x":10, "y":2.25}, {"x":11, "y":2.25}, {"x":12, "y":2.125}, {"x":13, "y":2}, {"x":14, "y":2.125}, {"x":15, "y":2.375}, {"x":16, "y":2.375}, + + {"x":0, "y":3.375}, {"x":1, "y":3.375}, {"x":2, "y":3.125}, {"x":3, "y":3}, {"x":4, "y":3.125}, {"x":5, "y":3.25}, + {"x":11, "y":3.25}, {"x":12, "y":3.125}, {"x":13, "y":3}, {"x":14, "y":3.125}, {"x":15, "y":3.375}, {"x":16, "y":3.375}, + + {"x":0, "y":4.375}, {"x":1, "y":4.375}, {"x":2, "y":4.125}, {"x":3, "y":4}, {"x":4, "y":4.125}, {"x":5, "y":4.5, "w":2}, + {"x":10, "y":4.5, "w":2}, {"x":12, "y":4.125}, {"x":13, "y":4}, {"x":14, "y":4.125}, {"x":15, "y":4.375}, {"x":16, "y":4.375}, + + {"x":5, "y":5.5, "h":1.5}, {"x":6, "y":5.5, "h":1.5}, {"x":7, "y":5.5, "h":1.5}, {"x":9, "y":5.5, "h":1.5}, {"x":10, "y":5.5, "h":1.5}, {"x":11, "y":5.5, "h":1.5} + ] + } + } +} diff --git a/keyboards/moonlander/keymaps/default/config.h b/keyboards/moonlander/keymaps/default/config.h index 8da226b0a6..83ea2a1b58 100644 --- a/keyboards/moonlander/keymaps/default/config.h +++ b/keyboards/moonlander/keymaps/default/config.h @@ -1,3 +1,21 @@ +/* Copyright 2020 ZSA Technology Labs, Inc <@zsa> + * Copyright 2020 Jack Humbert <jack.humb@gmail.com> + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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 <http://www.gnu.org/licenses/>. + */ + #pragma once #define ORYX_CONFIGURATOR diff --git a/keyboards/moonlander/keymaps/default/keymap.c b/keyboards/moonlander/keymaps/default/keymap.c index 6d98a8607e..0cb7fa5d27 100644 --- a/keyboards/moonlander/keymaps/default/keymap.c +++ b/keyboards/moonlander/keymaps/default/keymap.c @@ -1,6 +1,6 @@ /* Copyright 2020 ZSA Technology Labs, Inc <@zsa> * Copyright 2020 Jack Humbert <jack.humb@gmail.com> - * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> * * 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 diff --git a/keyboards/moonlander/matrix.c b/keyboards/moonlander/matrix.c index 13009b7e40..7492109d22 100644 --- a/keyboards/moonlander/matrix.c +++ b/keyboards/moonlander/matrix.c @@ -1,61 +1,41 @@ -/* -Copyright 2018 Jack Humbert <jack.humb@gmail.com> - -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 <http://www.gnu.org/licenses/>. +/* Copyright 2020 ZSA Technology Labs, Inc <@zsa> + * Copyright 2020 Jack Humbert <jack.humb@gmail.com> + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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 <http://www.gnu.org/licenses/>. */ -#include <stdint.h> -#include <stdbool.h> -#include <string.h> -#include <hal.h> -#include "timer.h" -#include "wait.h" -#include "print.h" -#include "matrix.h" -#include "action.h" -#include "keycode.h" -#include <string.h> #include "moonlander.h" #include "i2c_master.h" -#include "debounce.h" /* #define MATRIX_ROW_PINS { B10, B11, B12, B13, B14, B15 } outputs #define MATRIX_COL_PINS { A0, A1, A2, A3, A6, A7, B0 } inputs */ /* matrix state(1:on, 0:off) */ -static matrix_row_t matrix[MATRIX_ROWS]; -static matrix_row_t matrix_debouncing[MATRIX_ROWS]; -static matrix_row_t matrix_debouncing_right[MATRIX_COLS]; -static bool debouncing = false; -static uint16_t debouncing_time = 0; -static bool debouncing_right = false; -static uint16_t debouncing_time_right = 0; +extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values +extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values +static matrix_row_t raw_matrix_right[MATRIX_COLS]; #define ROWS_PER_HAND (MATRIX_ROWS / 2) +#ifndef MOONLANDER_I2C_TIMEOUT +# define MOONLANDER_I2C_TIMEOUT 100 +#endif extern bool mcp23018_leds[3]; extern bool is_launching; -__attribute__((weak)) void matrix_init_user(void) {} - -__attribute__((weak)) void matrix_scan_user(void) {} - -__attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); } - -__attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); } - bool mcp23018_initd = false; static uint8_t mcp23018_reset_loop; @@ -72,14 +52,14 @@ void mcp23018_init(void) { mcp23018_tx[1] = 0b00000000; // A is output mcp23018_tx[2] = 0b00111111; // B is inputs - if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, I2C_TIMEOUT)) { + if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, MOONLANDER_I2C_TIMEOUT)) { dprintf("error hori\n"); } else { mcp23018_tx[0] = 0x0C; // GPPUA mcp23018_tx[1] = 0b10000000; // A is not pulled-up mcp23018_tx[2] = 0b11111111; // B is pulled-up - if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, I2C_TIMEOUT)) { + if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, MOONLANDER_I2C_TIMEOUT)) { dprintf("error hori\n"); } else { mcp23018_initd = is_launching = true; @@ -87,10 +67,9 @@ void mcp23018_init(void) { } } -void matrix_init(void) { +void matrix_init_custom(void) { dprintf("matrix init\n"); // debug_matrix = true; - // outputs setPinOutput(B10); setPinOutput(B11); @@ -108,21 +87,34 @@ void matrix_init(void) { setPinInputLow(A7); setPinInputLow(B0); - memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t)); - memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t)); - memset(matrix_debouncing_right, 0, MATRIX_COLS * sizeof(matrix_row_t)); - mcp23018_init(); - - matrix_init_quantum(); } -uint8_t matrix_scan(void) { +bool matrix_scan_custom(matrix_row_t current_matrix[]) { bool changed = false; + // Try to re-init right side + if (!mcp23018_initd) { + if (++mcp23018_reset_loop == 0) { + // if (++mcp23018_reset_loop >= 1300) { + // since mcp23018_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans + // this will be approx bit more frequent than once per second + print("trying to reset mcp23018\n"); + mcp23018_init(); + if (!mcp23018_initd) { + print("left side not responding\n"); + } else { + print("left side attached\n"); +#ifdef RGB_MATRIX_ENABLE + rgb_matrix_init(); +#endif + } + } + } + matrix_row_t data = 0; // actual matrix - for (uint8_t row = 0; row < ROWS_PER_HAND; row++) { + for (uint8_t row = 0; row <= ROWS_PER_HAND; row++) { // strobe row switch (row) { case 0: writePinHigh(B10); break; @@ -131,161 +123,94 @@ uint8_t matrix_scan(void) { case 3: writePinHigh(B13); break; case 4: writePinHigh(B14); break; case 5: writePinHigh(B15); break; + case 6: break; // Left hand has 6 rows } - // need wait to settle pin state - wait_us(20); - - // read col data - data = ( - (readPin(A0) << 0 ) | - (readPin(A1) << 1 ) | - (readPin(A2) << 2 ) | - (readPin(A3) << 3 ) | - (readPin(A6) << 4 ) | - (readPin(A7) << 5 ) | - (readPin(B0) << 6 ) - ); - - // unstrobe row - switch (row) { - case 0: writePinLow(B10); break; - case 1: writePinLow(B11); break; - case 2: writePinLow(B12); break; - case 3: writePinLow(B13); break; - case 4: writePinLow(B14); break; - case 5: writePinLow(B15); break; - } - - if (matrix_debouncing[row] != data) { - matrix_debouncing[row] = data; - debouncing = true; - debouncing_time = timer_read(); - changed = true; - } - } - - for (uint8_t row = 0; row <= ROWS_PER_HAND; row++) { // right side - - if (!mcp23018_initd) { - if (++mcp23018_reset_loop == 0) { - // if (++mcp23018_reset_loop >= 1300) { - // since mcp23018_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans - // this will be approx bit more frequent than once per second - print("trying to reset mcp23018\n"); - mcp23018_init(); - if (!mcp23018_initd) { - print("left side not responding\n"); - } else { - print("left side attached\n"); -#ifdef RGB_MATRIX_ENABLE - rgb_matrix_init(); -#endif - } + if (mcp23018_initd) { + // #define MCP23_ROW_PINS { GPB5, GBP4, GBP3, GBP2, GBP1, GBP0 } outputs + // #define MCP23_COL_PINS { GPA0, GBA1, GBA2, GBA3, GBA4, GBA5, GBA6 } inputs + + // select row + mcp23018_tx[0] = 0x12; // GPIOA + mcp23018_tx[1] = (0b01111111 & ~(1 << (row))) | ((uint8_t)!mcp23018_leds[2] << 7); // activate row + mcp23018_tx[2] = ((uint8_t)!mcp23018_leds[1] << 6) | ((uint8_t)!mcp23018_leds[0] << 7); // activate row + + if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, MOONLANDER_I2C_TIMEOUT)) { + dprintf("error hori\n"); + mcp23018_initd = false; } - } - // #define MCP23_ROW_PINS { GPB5, GBP4, GBP3, GBP2, GBP1, GBP0 } outputs - // #define MCP23_COL_PINS { GPA0, GBA1, GBA2, GBA3, GBA4, GBA5, GBA6 } inputs + // read col - // select row - - mcp23018_tx[0] = 0x12; // GPIOA - mcp23018_tx[1] = (0b01111111 & ~(1 << (row))) | ((uint8_t)!mcp23018_leds[2] << 7); // activate row - mcp23018_tx[2] = ((uint8_t)!mcp23018_leds[1] << 6) | ((uint8_t)!mcp23018_leds[0] << 7); // activate row + mcp23018_tx[0] = 0x13; // GPIOB + if (MSG_OK != i2c_readReg(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx[0], &mcp23018_rx[0], 1, MOONLANDER_I2C_TIMEOUT)) { + dprintf("error vert\n"); + mcp23018_initd = false; + } - if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, I2C_TIMEOUT)) { - dprintf("error hori\n"); - mcp23018_initd = false; + data = ~(mcp23018_rx[0] & 0b00111111); + // data = 0x01; + } else { + data = 0; } - // read col - - mcp23018_tx[0] = 0x13; // GPIOB - if (MSG_OK != i2c_readReg(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx[0], &mcp23018_rx[0], 1, I2C_TIMEOUT)) { - dprintf("error vert\n"); - mcp23018_initd = false; + if (raw_matrix_right[row] != data) { + raw_matrix_right[row] = data; + changed = true; } - data = ~(mcp23018_rx[0] & 0b00111111); - // data = 0x01; - if (matrix_debouncing_right[row] != data) { - matrix_debouncing_right[row] = data; - debouncing_right = true; - debouncing_time_right = timer_read(); - changed = true; - } - } - - if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) { - for (int row = 0; row < ROWS_PER_HAND; row++) { - matrix[row] = matrix_debouncing[row]; - } - debouncing = false; - } + // left side + if (row < ROWS_PER_HAND) { + // i2c comm incur enough wait time + if (!mcp23018_initd) { + // need wait to settle pin state + matrix_io_delay(); + } + // read col data + data = ( + (readPin(A0) << 0 ) | + (readPin(A1) << 1 ) | + (readPin(A2) << 2 ) | + (readPin(A3) << 3 ) | + (readPin(A6) << 4 ) | + (readPin(A7) << 5 ) | + (readPin(B0) << 6 ) + ); + // unstrobe row + switch (row) { + case 0: writePinLow(B10); break; + case 1: writePinLow(B11); break; + case 2: writePinLow(B12); break; + case 3: writePinLow(B13); break; + case 4: writePinLow(B14); break; + case 5: writePinLow(B15); break; + case 6: break; + } - if (debouncing_right && timer_elapsed(debouncing_time_right) > DEBOUNCE && mcp23018_initd) { - for (int row = 0; row < ROWS_PER_HAND; row++) { - matrix[11 - row] = 0; - for (int col = 0; col < MATRIX_COLS; col++) { - matrix[11 - row] |= ((matrix_debouncing_right[6 - col] & (1 << row) ? 1 : 0) << col); + if (current_matrix[row] != data) { + current_matrix[row] = data; + changed = true; } } - debouncing_right = false; } - - matrix_scan_quantum(); - - return (uint8_t)changed; -} - -bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & (1 << col)); } - -matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; } - -void matrix_print(void) { - dprintf("\nr/c 01234567\n"); - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - dprintf("%X0: ", row); - matrix_row_t data = matrix_get_row(row); - for (int col = 0; col < MATRIX_COLS; col++) { - if (data & (1 << col)) - dprintf("1"); - else - dprintf("0"); + for (uint8_t row = 0; row < ROWS_PER_HAND; row++) { + current_matrix[11 - row] = 0; + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + current_matrix[11 - row] |= ((raw_matrix_right[6 - col] & (1 << row) ? 1 : 0) << col); } - dprintf("\n"); } + return changed; } // DO NOT REMOVE // Needed for proper wake/sleep - void matrix_power_up(void) { bool temp_launching = is_launching; - // outputs - setPinOutput(B10); - setPinOutput(B11); - setPinOutput(B12); - setPinOutput(B13); - setPinOutput(B14); - setPinOutput(B15); - - wait_us(30); + matrix_init_custom(); - // inputs - setPinInputLow(A0); - setPinInputLow(A1); - setPinInputLow(A2); - setPinInputLow(A3); - setPinInputLow(A6); - setPinInputLow(A7); - setPinInputLow(B0); - - mcp23018_init(); is_launching = temp_launching; if (!temp_launching) { ML_LED_1(false); diff --git a/keyboards/moonlander/mcuconf.h b/keyboards/moonlander/mcuconf.h new file mode 100644 index 0000000000..69f458a937 --- /dev/null +++ b/keyboards/moonlander/mcuconf.h @@ -0,0 +1,39 @@ +/* Copyright 2021 QMK + * + * 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 3 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 <https://www.gnu.org/licenses/>. + */ + +#pragma once + +#include_next "mcuconf.h" + +// for i2c expander, and ISSI +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE + +// for future hardwar +#undef STM32_I2C_USE_I2C2 +#define STM32_I2C_USE_I2C2 TRUE + +// for audio +#undef STM32_DAC_USE_DAC1_CH1 +#define STM32_DAC_USE_DAC1_CH1 TRUE +#undef STM32_DAC_USE_DAC1_CH2 +#define STM32_DAC_USE_DAC1_CH2 TRUE +#undef STM32_GPT_USE_TIM6 +#define STM32_GPT_USE_TIM6 TRUE +#undef STM32_GPT_USE_TIM7 +#define STM32_GPT_USE_TIM7 TRUE +#undef STM32_GPT_USE_TIM8 +#define STM32_GPT_USE_TIM8 TRUE diff --git a/keyboards/moonlander/moonlander.c b/keyboards/moonlander/moonlander.c index 42c119c2d9..4452a3a5e2 100644 --- a/keyboards/moonlander/moonlander.c +++ b/keyboards/moonlander/moonlander.c @@ -1,36 +1,37 @@ -/* -Copyright 2018 Jack Humbert <jack.humb@gmail.com> - -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. +/* Copyright 2020 ZSA Technology Labs, Inc <@zsa> + * Copyright 2020 Jack Humbert <jack.humb@gmail.com> + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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 <http://www.gnu.org/licenses/>. +*/ -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 <http://www.gnu.org/licenses/>. -*/ #include "moonlander.h" #ifdef WEBUSB_ENABLE -#include "webusb.h" +# include "webusb.h" #endif keyboard_config_t keyboard_config; bool mcp23018_leds[3] = {0, 0, 0}; -bool is_launching = false; +bool is_launching = false; #ifdef DYNAMIC_MACRO_ENABLE static bool is_dynamic_recording = false; -void dynamic_macro_record_start_user(void) { - is_dynamic_recording = true; -} +void dynamic_macro_record_start_user(void) { is_dynamic_recording = true; } void dynamic_macro_record_end_user(int8_t direction) { is_dynamic_recording = false; @@ -163,8 +164,7 @@ void keyboard_pre_init_kb(void) { writePinLow(B4); writePinLow(B3); - - chThdCreateStatic(waLEDThread, sizeof(waLEDThread), NORMALPRIO-16, LEDThread, NULL); + chThdCreateStatic(waLEDThread, sizeof(waLEDThread), NORMALPRIO - 16, LEDThread, NULL); /* the array is initialized to 0, no need to re-set it here */ // mcp23018_leds[0] = 0; // blue @@ -176,7 +176,7 @@ void keyboard_pre_init_kb(void) { #if !defined(MOONLANDER_USER_LEDS) layer_state_t layer_state_set_kb(layer_state_t state) { - state = layer_state_set_user(state); + state = layer_state_set_user(state); if (is_launching || !keyboard_config.led_level) return state; ML_LED_1(false); @@ -219,7 +219,7 @@ layer_state_t layer_state_set_kb(layer_state_t state) { #ifdef RGB_MATRIX_ENABLE // clang-format off -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver * | R location @@ -356,15 +356,6 @@ led_config_t g_led_config = { { } }; // clang-format on -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(); -} #endif #ifdef AUDIO_ENABLE @@ -386,7 +377,7 @@ bool music_mask_kb(uint16_t keycode) { #ifdef SWAP_HANDS_ENABLE // swap-hands action needs a matrix to define the swap // clang-format off -const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { +const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { /* Left hand, matrix positions */ {{6,6}, {5,6}, {4,6}, {3,6}, {2,6}, {1,6},{0,6}}, {{6,7}, {5,7}, {4,7}, {3,7}, {2,7}, {1,7},{0,7}}, @@ -423,13 +414,11 @@ const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS] = LAYOUT_moonlander( // clang-format on #endif - bool process_record_kb(uint16_t keycode, keyrecord_t *record) { switch (keycode) { #ifdef WEBUSB_ENABLE case WEBUSB_PAIR: - if (!record->event.pressed && !webusb_state.pairing) - layer_state_set_kb(layer_state); + if (!record->event.pressed && !webusb_state.pairing) layer_state_set_kb(layer_state); break; #endif #if !defined(MOONLANDER_USER_LEDS) @@ -454,27 +443,24 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { case TOGGLE_LAYER_COLOR: if (record->event.pressed) { keyboard_config.disable_layer_led ^= 1; - if (keyboard_config.disable_layer_led) - rgb_matrix_set_color_all(0, 0, 0); + if (keyboard_config.disable_layer_led) rgb_matrix_set_color_all(0, 0, 0); eeconfig_update_kb(keyboard_config.raw); } break; case RGB_TOG: if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - keyboard_config.rgb_matrix_enable = false; - rgb_matrix_set_color_all(0, 0, 0); - } - break; - default: { - rgb_matrix_set_flags(LED_FLAG_ALL); - keyboard_config.rgb_matrix_enable = true; - } - break; - } - eeconfig_update_kb(keyboard_config.raw); + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_NONE); + keyboard_config.rgb_matrix_enable = false; + rgb_matrix_set_color_all(0, 0, 0); + } break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + keyboard_config.rgb_matrix_enable = true; + } break; + } + eeconfig_update_kb(keyboard_config.raw); } return false; #endif @@ -490,7 +476,6 @@ void matrix_init_kb(void) { keyboard_config.led_level_res = 0b11; eeconfig_update_kb(keyboard_config.raw); } - #ifdef RGB_MATRIX_ENABLE if (keyboard_config.rgb_matrix_enable) { rgb_matrix_set_flags(LED_FLAG_ALL); diff --git a/keyboards/moonlander/moonlander.h b/keyboards/moonlander/moonlander.h index 1fd1db8ad5..16c6859613 100644 --- a/keyboards/moonlander/moonlander.h +++ b/keyboards/moonlander/moonlander.h @@ -1,22 +1,29 @@ -/* -Copyright 2018 Jack Humbert <jack.humb@gmail.com> - -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. +/* Copyright 2020 ZSA Technology Labs, Inc <@zsa> + * Copyright 2020 Jack Humbert <jack.humb@gmail.com> + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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 <http://www.gnu.org/licenses/>. +*/ -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 <http://www.gnu.org/licenses/>. -*/ #pragma once +#include "quantum.h" + +extern bool mcp23018_leds[]; + #define MCP23018_DEFAULT_ADDRESS 0b0100000 #define ML_LED_1(status) writePin(B5, (bool)status) @@ -27,8 +34,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define ML_LED_5(status) mcp23018_leds[1] = (bool)status #define ML_LED_6(status) mcp23018_leds[2] = (bool)status -#include "quantum.h" - // clang-format off #define LAYOUT_moonlander( \ k00, k01, k02, k03, k04, k05, k06, k60, k61, k62, k63, k64, k65, k66, \ diff --git a/keyboards/moonlander/readme.md b/keyboards/moonlander/readme.md new file mode 100644 index 0000000000..0ad2e4775c --- /dev/null +++ b/keyboards/moonlander/readme.md @@ -0,0 +1,44 @@ +# Moonlander + +![Moonlander](https://zsa.io/static/gallery-white-case-7a2ef555f8f7f4ce1b9030477b16e517.png) + +A next-gen split, ergonomic keyboard with an active left side, USB type C, integrated wrist rest, and a thumb cluster that can move. + + +* Keyboard Maintainer: [drashna](https://github.com/drashna), [ZSA](https://github.com/zsa/) +* Hardware Supported: Moonlander MK 1 (STM32F303xC) +* Hardware Availability: [ZSA Store](https://zsa.io/moonlander/) + +Make example for this keyboard (after setting up your build environment): + + make moonlander:default + +Flashing example for this keyboard: + + make moonlander:default:flash + +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). + + +## Moonlander Customization + +### Indicator LEDs + +There are 6 functions for enabling and disabling the LEDs on the top of the boards. The functions are `ML_LED_1(bool)` through `ML_LED_6(bool)`, with the first LED being the left most LED on the left hand, and the sixth LED being the right most LED on the right side. + +By default, the Indicator LEDs are used to indicate the layer state for the keyboard. If you wish to change this (and indicate caps/num/scroll lock status instead), then define `MOONLANDER_USER_LEDS` in your `config.h` file. + + +### Oryx Configuration + +To enable the features from Oryx (ZSA's Configurator), either compile the the `default` keymap, or add `#define ORYX_CONFIGURATOR` to your `config.h` file. + +This enables the front Indicator LEDs, and the `TOGGLE_LAYER_COLOR` keycode. The `TOGGLE_LAYER_COLOR` keycode toggles the customized LED map configured on Oryx. + +### RGB Matrix Features + +If you're using the Smart LED (layer indication) feature from the Oryx Configurator, you want to make sure that you enable these options by adding `#define ORYX_CONFIGURATOR` to your keymap's `config.h`. + +This changes the `RGB_TOG` keycode so that it will toggle the lights on and off, in a way that will allow the Smart LEDs to continue to work, even with the rest of the LEDs turned off. + +Additionally, a new keycode has been added to toggle the Smart LEDs. Use `TOGGLE_LAYER_COLOR`, if you aren't already. diff --git a/keyboards/moonlander/rules.mk b/keyboards/moonlander/rules.mk index f5a3859cca..2295b7db95 100644 --- a/keyboards/moonlander/rules.mk +++ b/keyboards/moonlander/rules.mk @@ -1,27 +1,31 @@ -#Cortex version -MCU = STM32F303 +# MCU name +MCU = STM32F303 -#Build Options -#comment out to disable the options. +# Bootloader selection +BOOTLOADER = stm32-dfu + +# Build Options +# change yes to no to disable # -BACKLIGHT_ENABLE = no -BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = yes # Commands for debug and configuration -#SLEEP_LED_ENABLE = yes #Breathing sleep LED during USB suspend -NKRO_ENABLE = yes # USB Nkey Rollover -CUSTOM_MATRIX = yes # Custom matrix file -AUDIO_ENABLE = yes -SWAP_HANDS_ENABLE = no +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # Console for debug +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 = 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 +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = yes # Audio output +CUSTOM_MATRIX = lite +SWAP_HANDS_ENABLE = yes RGB_MATRIX_ENABLE = yes RGB_MATRIX_DRIVER = IS31FL3731 -#SERIAL_LINK_ENABLE = yes -EEPROM_DRIVER = i2c +EEPROM_DRIVER = i2c +MOUSE_SHARED_EP = no #project specific files -SRC = matrix.c +SRC += matrix.c QUANTUM_LIB_SRC += i2c_master.c - -MOUSE_SHARED_EP = no diff --git a/keyboards/planck/config.h b/keyboards/planck/config.h index 837311c769..9ef2b0b0dd 100644 --- a/keyboards/planck/config.h +++ b/keyboards/planck/config.h @@ -21,11 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "config_common.h" /* USB Device descriptor parameter */ -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x6060 +#define VENDOR_ID 0x03A8 #define MANUFACTURER OLKB #define PRODUCT Planck -#define DESCRIPTION A compact ortholinear keyboard /* key matrix size */ #define MATRIX_ROWS 4 @@ -56,7 +54,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define BACKLIGHT_LEVELS 3 /* Set 0 if debouncing isn't needed */ -#define DEBOUNCING_DELAY 5 +#define DEBOUNCE 5 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE diff --git a/keyboards/planck/ez/chconf.h b/keyboards/planck/ez/chconf.h new file mode 100644 index 0000000000..e1243f23ec --- /dev/null +++ b/keyboards/planck/ez/chconf.h @@ -0,0 +1,29 @@ +/* Copyright 2020 QMK + * + * 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 <http://www.gnu.org/licenses/>. + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/planck/rev6/chconf.h -r platforms/chibios/QMK_PROTON_C/configs/chconf.h` + */ + +#pragma once + +#define CH_CFG_ST_RESOLUTION 16 + +#define CH_CFG_ST_FREQUENCY 10000 + +#include_next <chconf.h> + diff --git a/keyboards/planck/ez/config.h b/keyboards/planck/ez/config.h index e5071f7e0c..e924d077d2 100644 --- a/keyboards/planck/ez/config.h +++ b/keyboards/planck/ez/config.h @@ -1,5 +1,6 @@ -/* - * Copyright 2018 Jack Humbert <jack.humb@gmail.com> +/* Copyright 2018 Jack Humbert <jack.humb@gmail.com> + * Copyright 2015 ZSA Technology Labs Inc (@zsa) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> * * 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 @@ -17,7 +18,7 @@ #pragma once -/* USB Device descriptor parameter */ + #undef VENDOR_ID #define VENDOR_ID 0x3297 #undef PRODUCT_ID @@ -27,7 +28,7 @@ #undef PRODUCT #define PRODUCT Planck EZ #define DEVICE_VER 0x0000 -#define WEBUSB_LANDING_PAGE_URL u8"configure.ergodox-ez.com" + #undef MATRIX_ROWS #undef MATRIX_COLS @@ -60,7 +61,7 @@ #undef C6_AUDIO /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ -#define DEBOUNCE 6 +// #define DEBOUNCE 6 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ //#define LOCKING_SUPPORT_ENABLE @@ -106,39 +107,6 @@ //#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 1 - -// #define WS2812_LED_N 2 -// #define RGBLED_NUM WS2812_LED_N -// #define WS2812_TIM_N 2 -// #define WS2812_TIM_CH 2 -// #define PORT_WS2812 GPIOA -// #define PIN_WS2812 1 -// #define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA stream for TIMx_UP (look up in reference manual under DMA Channel selection) -//#define WS2812_DMA_CHANNEL 7 // DMA channel for TIMx_UP -//#define WS2812_EXTERNAL_PULLUP - #define DRIVER_ADDR_1 0b1010000 #define DRIVER_ADDR_2 0b1010000 // this is here for compliancy reasons. @@ -148,13 +116,11 @@ #define RGB_MATRIX_KEYPRESSES #define RGB_MATRIX_FRAMEBUFFER_EFFECTS -#define RGB_DISABLE_WHEN_USB_SUSPENDED true - +#define RGB_DISABLE_WHEN_USB_SUSPENDED #define RGB_MATRIX_LED_PROCESS_LIMIT 5 #define RGB_MATRIX_LED_FLUSH_LIMIT 26 -#define I2C1_CLOCK_SPEED 400000 #define IGNORE_MOD_TAP_INTERRUPT diff --git a/keyboards/planck/ez/ez.c b/keyboards/planck/ez/ez.c index b4f3d811ef..dc95607604 100644 --- a/keyboards/planck/ez/ez.c +++ b/keyboards/planck/ez/ez.c @@ -1,4 +1,6 @@ /* Copyright 2018 Jack Humbert <jack.humb@gmail.com> + * Copyright 2015 ZSA Technology Labs Inc (@zsa) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> * * 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,19 +20,8 @@ #include <hal.h> keyboard_config_t keyboard_config; - #ifdef RGB_MATRIX_ENABLE -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(); -} - -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver * | R location @@ -114,8 +105,24 @@ led_config_t g_led_config = { { 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1 } }; + +void suspend_power_down_kb(void) { + rgb_matrix_set_color_all(0, 0, 0); + 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(); +} +void keyboard_post_init_kb(void) { + rgb_matrix_enable_noeeprom(); + keyboard_post_init_user(); +} #endif +/* Left B9 Right B8 */ // See http://jared.geek.nz/2013/feb/linear-led-pwm static uint16_t cie_lightness(uint16_t v) { @@ -133,7 +140,7 @@ static uint16_t cie_lightness(uint16_t v) { } } - static PWMConfig pwmCFG = { +static PWMConfig pwmCFG = { 0xFFFF,/* PWM clock frequency */ 256,/* initial PWM period (in ticks) 1S (1/10kHz=0.1mS 0.1ms*10000 ticks=1S) */ NULL, @@ -218,29 +225,18 @@ void keyboard_pre_init_kb(void) { rgb_matrix_set_flags(LED_FLAG_NONE); } #endif - - // initialize settings for front LEDs led_initialize_hardware(); keyboard_pre_init_user(); } -#ifdef RGB_MATRIX_ENABLE -void keyboard_post_init_kb(void) { - rgb_matrix_enable_noeeprom(); - keyboard_post_init_user(); -} -#endif - void eeconfig_init_kb(void) { // EEPROM is getting reset! keyboard_config.raw = 0; keyboard_config.rgb_matrix_enable = true; keyboard_config.led_level = 4; - eeconfig_update_kb(keyboard_config.raw); eeconfig_init_user(); } - layer_state_t layer_state_set_kb(layer_state_t state) { planck_ez_left_led_off(); planck_ez_right_led_off(); @@ -281,7 +277,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { case TOGGLE_LAYER_COLOR: if (record->event.pressed) { keyboard_config.disable_layer_led ^= 1; - if (keyboard_config.disable_layer_led) + if (keyboard_config.disable_layer_led) rgb_matrix_set_color_all(0, 0, 0); eeconfig_update_kb(keyboard_config.raw); } @@ -306,9 +302,10 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { return false; #endif } - return process_record_user(keycode, record); + return process_record_user(keycode, record); } + #ifdef AUDIO_ENABLE bool music_mask_kb(uint16_t keycode) { switch (keycode) { @@ -324,6 +321,7 @@ bool music_mask_kb(uint16_t keycode) { } } #endif + #ifdef ORYX_ENABLE static uint16_t loops = 0; static bool is_on = false; diff --git a/keyboards/planck/ez/ez.h b/keyboards/planck/ez/ez.h index 07182417fc..9e572d258d 100644 --- a/keyboards/planck/ez/ez.h +++ b/keyboards/planck/ez/ez.h @@ -1,4 +1,6 @@ /* Copyright 2018 Jack Humbert <jack.humb@gmail.com> + * Copyright 2015 ZSA Technology Labs Inc (@zsa) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> * * 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 @@ -39,19 +41,22 @@ } #define LAYOUT_ortho_4x12( \ - k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ - k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ - k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ - k30, k31, k32, k33, k34, k35, KC_NO, k37, k38, k39, k3a, k3b \ -) \ -LAYOUT_planck_1x2uC( \ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ - k30, k31, k32, k33, k34, k35, k37, k38, k39, k3a, k3b \ -) + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05 }, \ + { k10, k11, k12, k13, k14, k15 }, \ + { k20, k21, k22, k23, k24, k25 }, \ + { k30, k31, k32, k3a, k3b, KC_NO }, \ + { k06, k07, k08, k09, k0a, k0b }, \ + { k16, k17, k18, k19, k1a, k1b }, \ + { k26, k27, k28, k29, k2a, k2b }, \ + { k37, k38, k39, k33, k34, k35 } \ +} -#define KEYMAP LAYOUT_ortho_4x12 #define LAYOUT_planck_mit LAYOUT_planck_1x2uC #define LAYOUT_planck_grid LAYOUT_ortho_4x12 @@ -71,7 +76,7 @@ enum planck_ez_keycodes { typedef union { uint32_t raw; struct { - uint8_t led_level :3; + uint8_t led_level :3; bool disable_layer_led :1; bool rgb_matrix_enable :1; }; diff --git a/keyboards/planck/ez/glow/config.h b/keyboards/planck/ez/glow/config.h index 21a339da28..55ce289010 100644 --- a/keyboards/planck/ez/glow/config.h +++ b/keyboards/planck/ez/glow/config.h @@ -1,5 +1,6 @@ -/* - * Copyright 2018 Jack Humbert <jack.humb@gmail.com> +/* Copyright 2018 Jack Humbert <jack.humb@gmail.com> + * Copyright 2015 ZSA Technology Labs Inc (@zsa) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> * * 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 diff --git a/keyboards/planck/ez/glow/glow.c b/keyboards/planck/ez/glow/glow.c new file mode 100644 index 0000000000..c6733bbe50 --- /dev/null +++ b/keyboards/planck/ez/glow/glow.c @@ -0,0 +1,19 @@ +/* Copyright 2018 Jack Humbert <jack.humb@gmail.com> + * Copyright 2015 ZSA Technology Labs Inc (@zsa) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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 <http://www.gnu.org/licenses/>. + */ + +#include "glow.h" diff --git a/keyboards/planck/ez/glow/glow.h b/keyboards/planck/ez/glow/glow.h index d8a01f4359..cfc26b5e03 100644 --- a/keyboards/planck/ez/glow/glow.h +++ b/keyboards/planck/ez/glow/glow.h @@ -1,3 +1,21 @@ +/* Copyright 2018 Jack Humbert <jack.humb@gmail.com> + * Copyright 2015 ZSA Technology Labs Inc (@zsa) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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 <http://www.gnu.org/licenses/>. + */ + #pragma once #include "ez.h" diff --git a/keyboards/planck/ez/glow/keymaps/glow/config.h b/keyboards/planck/ez/glow/keymaps/glow/config.h index 6fa31cc8a7..501d118632 100644 --- a/keyboards/planck/ez/glow/keymaps/glow/config.h +++ b/keyboards/planck/ez/glow/keymaps/glow/config.h @@ -1,39 +1,7 @@ #pragma once #ifdef AUDIO_ENABLE - #define STARTUP_SONG SONG(PLANCK_SOUND) - // #define STARTUP_SONG SONG(NO_SOUND) - - #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ - SONG(COLEMAK_SOUND), \ - SONG(DVORAK_SOUND) \ - } + #define STARTUP_SONG SONG(DVORAK_SOUND) #endif -/* - * 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 - -// Most tactile encoders have detents every 4 stages -#define ENCODER_RESOLUTION 4 - +#define RGBLIGHT_EFFECT_KNIGHT_OFFSET 5 diff --git a/keyboards/planck/ez/glow/keymaps/glow/keymap.c b/keyboards/planck/ez/glow/keymaps/glow/keymap.c index 03cc0049e4..37659fbc32 100644 --- a/keyboards/planck/ez/glow/keymaps/glow/keymap.c +++ b/keyboards/planck/ez/glow/keymaps/glow/keymap.c @@ -176,7 +176,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); #endif -uint32_t layer_state_set_user(uint32_t state) { +layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); } @@ -256,7 +256,7 @@ uint16_t muse_counter = 0; uint8_t muse_offset = 70; uint16_t muse_tempo = 50; -void encoder_update(bool clockwise) { +bool encoder_update_user(uint8_t index, bool clockwise) { if (muse_mode) { if (IS_LAYER_ON(_RAISE)) { if (clockwise) { @@ -290,9 +290,10 @@ void encoder_update(bool clockwise) { #endif } } + return true; } -void dip_update(uint8_t index, bool active) { +bool dip_switch_update_user(uint8_t index, bool active) { switch (index) { case 0: if (active) { @@ -317,6 +318,7 @@ void dip_update(uint8_t index, bool active) { #endif } } + return true; } void matrix_scan_user(void) { diff --git a/keyboards/planck/ez/halconf.h b/keyboards/planck/ez/halconf.h new file mode 100644 index 0000000000..f1044867f7 --- /dev/null +++ b/keyboards/planck/ez/halconf.h @@ -0,0 +1,23 @@ +/* Copyright 2021 QMK + * + * 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 3 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 <https://www.gnu.org/licenses/>. + */ +#pragma once + +#define HAL_USE_I2C TRUE +#define HAL_USE_GPT TRUE +#define HAL_USE_DAC TRUE +#define HAL_USE_PWM TRUE + +#include_next <halconf.h> diff --git a/keyboards/planck/ez/info.json b/keyboards/planck/ez/info.json index b8382bfe0a..6c9332b052 100644 --- a/keyboards/planck/ez/info.json +++ b/keyboards/planck/ez/info.json @@ -1,13 +1,9 @@ { "keyboard_name": "Planck EZ", - "keyboard_folder": "planck/ez", "url": "https://ergodox-ez.com/pages/planck", "maintainer": "jackhumbert", - "width": 12, - "height": 4, "layouts": { "LAYOUT_planck_1x2uC": { - "key_count": 47, "layout": [ { "x": 0, "y": 0 }, { "x": 1, "y": 0 }, @@ -59,7 +55,6 @@ ] }, "LAYOUT_ortho_4x12": { - "key_count": 48, "layout": [ { "x": 0, "y": 0 }, { "x": 1, "y": 0 }, diff --git a/keyboards/planck/ez/mcuconf.h b/keyboards/planck/ez/mcuconf.h new file mode 100644 index 0000000000..44035e7827 --- /dev/null +++ b/keyboards/planck/ez/mcuconf.h @@ -0,0 +1,41 @@ +/* Copyright 2021 QMK + * + * 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 3 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 <https://www.gnu.org/licenses/>. + */ + +#pragma once + +#include_next "mcuconf.h" + +// for i2c expander, and ISSI +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE + +// for indicator LEDs +#undef STM32_PWM_USE_TIM3 +#define STM32_PWM_USE_TIM3 TRUE +#undef STM32_PWM_USE_TIM4 +#define STM32_PWM_USE_TIM4 TRUE + +// for audio +#undef STM32_DAC_USE_DAC1_CH1 +#define STM32_DAC_USE_DAC1_CH1 TRUE +#undef STM32_DAC_USE_DAC1_CH2 +#define STM32_DAC_USE_DAC1_CH2 TRUE +#undef STM32_GPT_USE_TIM6 +#define STM32_GPT_USE_TIM6 TRUE +#undef STM32_GPT_USE_TIM7 +#define STM32_GPT_USE_TIM7 TRUE +#undef STM32_GPT_USE_TIM8 +#define STM32_GPT_USE_TIM8 TRUE diff --git a/keyboards/planck/ez/readme.md b/keyboards/planck/ez/readme.md index 247bf7448a..f85ab59693 100644 --- a/keyboards/planck/ez/readme.md +++ b/keyboards/planck/ez/readme.md @@ -4,24 +4,26 @@ A variant of the Planck featuring a 2u spacebar and per-key RGB backlighting. -Keyboard Maintainer: [Jack Humbert](https://github.com/jackhumbert) +Keyboard Maintainer: [Jack Humbert](https://github.com/jackhumbert), [Drashna Jael're](https://github.com/drashna) Hardware Supported: Planck EZ -Hardware Availability: [ergodox-ez.com](https://ergodox-ez.com/pages/planck) +Hardware Availability: [ZSA](https://www.zsa.io/planck/) Make example for this keyboard (after setting up your build environment): - make planck/ez: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). - -# Planck EZ Glow + make planck/ez:oryx For the per key RGB version of this keyboard, you want to use the "glow" subdirectory. For example: - make planck/ez/glow:default + make planck/ez/glow:oryx + +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). ## Planck EZ Configuration (from Oryx) +To enable the features from Oryx (ZSA's Configurator), either compile the the `oryx` keymap, or add `#define ORYX_CONFIGURATOR` to your `config.h` file. + +This enables the front Indicator LEDs, and the `TOGGLE_LAYER_COLOR`, and `LED_LEVEL` keycodes. The `TOGGLE_LAYER_COLOR` keycode toggles the customized LED map configured on Oryx. The `LED_LEVEL` cycles through the brightness levels for the front "teeth" LEDs. + ### Indicator LEDs The two front "teeth" LED indicators are PWM controlled. If you have `ORYX_CONFIGURATOR` defined in your keymap's `config.h`, you can use the `LED_LEVEL` to cycle through preset vales (0, 25%, 50%, 75%, 100%), and will be saved to EEPROM (persistent storage) diff --git a/keyboards/planck/ez/rules.mk b/keyboards/planck/ez/rules.mk index a146c65aa9..bc18497a74 100644..100755 --- a/keyboards/planck/ez/rules.mk +++ b/keyboards/planck/ez/rules.mk @@ -1,24 +1,34 @@ # MCU name MCU = STM32F303 +# Bootloader selection +BOOTLOADER = stm32-dfu + # Build Options -# comment out to disable the options. + +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically # -BACKLIGHT_ENABLE = no -BOOTMAGIC_ENABLE = yes # 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 +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +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 -AUDIO_ENABLE = yes +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 +AUDIO_ENABLE = yes # Audio output on port C6 RGBLIGHT_ENABLE = no -# SERIAL_LINK_ENABLE = yes + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + ENCODER_ENABLE = yes RGB_MATRIX_DRIVER = IS31FL3737 -LAYOUTS += ortho_4x12 - MOUSE_SHARED_EP = no + +LAYOUTS_HAS_RGB = no + +RGB_MATRIX_SUPPORTED = yes +RGBLIGHT_SUPPORTED = no +BAKCLIGHT_SUPPORTED = no diff --git a/keyboards/planck/info.json b/keyboards/planck/info.json index 765d7d06ad..a4710d781f 100644 --- a/keyboards/planck/info.json +++ b/keyboards/planck/info.json @@ -1,112 +1,107 @@ { "keyboard_name": "Planck", - "keyboard_folder": "planck", "url": "https://olkb.com/planck", "maintainer": "jackhumbert", - "width": 12, - "height": 4, "layouts": { - "LAYOUT_planck_mit": { - "key_count": 47, - "layout": [ - { "w": 1, "x": 0, "y": 0 }, - { "w": 1, "x": 1, "y": 0 }, - { "w": 1, "x": 2, "y": 0 }, - { "w": 1, "x": 3, "y": 0 }, - { "w": 1, "x": 4, "y": 0 }, - { "w": 1, "x": 5, "y": 0 }, - { "w": 1, "x": 6, "y": 0 }, - { "w": 1, "x": 7, "y": 0 }, - { "w": 1, "x": 8, "y": 0 }, - { "w": 1, "x": 9, "y": 0 }, - { "w": 1, "x": 10, "y": 0 }, - { "w": 1, "x": 11, "y": 0 }, - { "w": 1, "x": 0, "y": 1 }, - { "w": 1, "x": 1, "y": 1 }, - { "w": 1, "x": 2, "y": 1 }, - { "w": 1, "x": 3, "y": 1 }, - { "w": 1, "x": 4, "y": 1 }, - { "w": 1, "x": 5, "y": 1 }, - { "w": 1, "x": 6, "y": 1 }, - { "w": 1, "x": 7, "y": 1 }, - { "w": 1, "x": 8, "y": 1 }, - { "w": 1, "x": 9, "y": 1 }, - { "w": 1, "x": 10, "y": 1 }, - { "w": 1, "x": 11, "y": 1 }, - { "w": 1, "x": 0, "y": 2 }, - { "w": 1, "x": 1, "y": 2 }, - { "w": 1, "x": 2, "y": 2 }, - { "w": 1, "x": 3, "y": 2 }, - { "w": 1, "x": 4, "y": 2 }, - { "w": 1, "x": 5, "y": 2 }, - { "w": 1, "x": 6, "y": 2 }, - { "w": 1, "x": 7, "y": 2 }, - { "w": 1, "x": 8, "y": 2 }, - { "w": 1, "x": 9, "y": 2 }, - { "w": 1, "x": 10, "y": 2 }, - { "w": 1, "x": 11, "y": 2 }, - { "w": 1, "x": 0, "y": 3 }, - { "w": 1, "x": 1, "y": 3 }, - { "w": 1, "x": 2, "y": 3 }, - { "w": 1, "x": 3, "y": 3 }, - { "w": 1, "x": 4, "y": 3 }, - { "w": 2, "x": 5, "y": 3 }, - { "w": 1, "x": 7, "y": 3 }, - { "w": 1, "x": 8, "y": 3 }, - { "w": 1, "x": 9, "y": 3 }, - { "w": 1, "x": 10, "y": 3 }, + "LAYOUT_planck_1x2uC": { + "layout": [ + { "w": 1, "x": 0, "y": 0 }, + { "w": 1, "x": 1, "y": 0 }, + { "w": 1, "x": 2, "y": 0 }, + { "w": 1, "x": 3, "y": 0 }, + { "w": 1, "x": 4, "y": 0 }, + { "w": 1, "x": 5, "y": 0 }, + { "w": 1, "x": 6, "y": 0 }, + { "w": 1, "x": 7, "y": 0 }, + { "w": 1, "x": 8, "y": 0 }, + { "w": 1, "x": 9, "y": 0 }, + { "w": 1, "x": 10, "y": 0 }, + { "w": 1, "x": 11, "y": 0 }, + { "w": 1, "x": 0, "y": 1 }, + { "w": 1, "x": 1, "y": 1 }, + { "w": 1, "x": 2, "y": 1 }, + { "w": 1, "x": 3, "y": 1 }, + { "w": 1, "x": 4, "y": 1 }, + { "w": 1, "x": 5, "y": 1 }, + { "w": 1, "x": 6, "y": 1 }, + { "w": 1, "x": 7, "y": 1 }, + { "w": 1, "x": 8, "y": 1 }, + { "w": 1, "x": 9, "y": 1 }, + { "w": 1, "x": 10, "y": 1 }, + { "w": 1, "x": 11, "y": 1 }, + { "w": 1, "x": 0, "y": 2 }, + { "w": 1, "x": 1, "y": 2 }, + { "w": 1, "x": 2, "y": 2 }, + { "w": 1, "x": 3, "y": 2 }, + { "w": 1, "x": 4, "y": 2 }, + { "w": 1, "x": 5, "y": 2 }, + { "w": 1, "x": 6, "y": 2 }, + { "w": 1, "x": 7, "y": 2 }, + { "w": 1, "x": 8, "y": 2 }, + { "w": 1, "x": 9, "y": 2 }, + { "w": 1, "x": 10, "y": 2 }, + { "w": 1, "x": 11, "y": 2 }, + { "w": 1, "x": 0, "y": 3 }, + { "w": 1, "x": 1, "y": 3 }, + { "w": 1, "x": 2, "y": 3 }, + { "w": 1, "x": 3, "y": 3 }, + { "w": 1, "x": 4, "y": 3 }, + { "w": 2, "x": 5, "y": 3 }, + { "w": 1, "x": 7, "y": 3 }, + { "w": 1, "x": 8, "y": 3 }, + { "w": 1, "x": 9, "y": 3 }, + { "w": 1, "x": 10, "y": 3 }, { "w": 1, "x": 11, "y": 3 } ] }, - "LAYOUT_planck_grid": { - "key_count": 48, - "layout": [ - { "w": 1, "x": 0, "y": 0 }, - { "w": 1, "x": 1, "y": 0 }, - { "w": 1, "x": 2, "y": 0 }, - { "w": 1, "x": 3, "y": 0 }, - { "w": 1, "x": 4, "y": 0 }, - { "w": 1, "x": 5, "y": 0 }, - { "w": 1, "x": 6, "y": 0 }, - { "w": 1, "x": 7, "y": 0 }, - { "w": 1, "x": 8, "y": 0 }, - { "w": 1, "x": 9, "y": 0 }, - { "w": 1, "x": 10, "y": 0 }, - { "w": 1, "x": 11, "y": 0 }, - { "w": 1, "x": 0, "y": 1 }, - { "w": 1, "x": 1, "y": 1 }, - { "w": 1, "x": 2, "y": 1 }, - { "w": 1, "x": 3, "y": 1 }, - { "w": 1, "x": 4, "y": 1 }, - { "w": 1, "x": 5, "y": 1 }, - { "w": 1, "x": 6, "y": 1 }, - { "w": 1, "x": 7, "y": 1 }, - { "w": 1, "x": 8, "y": 1 }, - { "w": 1, "x": 9, "y": 1 }, - { "w": 1, "x": 10, "y": 1 }, - { "w": 1, "x": 11, "y": 1 }, - { "w": 1, "x": 0, "y": 2 }, - { "w": 1, "x": 1, "y": 2 }, - { "w": 1, "x": 2, "y": 2 }, - { "w": 1, "x": 3, "y": 2 }, - { "w": 1, "x": 4, "y": 2 }, - { "w": 1, "x": 5, "y": 2 }, - { "w": 1, "x": 6, "y": 2 }, - { "w": 1, "x": 7, "y": 2 }, - { "w": 1, "x": 8, "y": 2 }, - { "w": 1, "x": 9, "y": 2 }, - { "w": 1, "x": 10, "y": 2 }, - { "w": 1, "x": 11, "y": 2 }, - { "w": 1, "x": 0, "y": 3 }, - { "w": 1, "x": 1, "y": 3 }, - { "w": 1, "x": 2, "y": 3 }, - { "w": 1, "x": 3, "y": 3 }, - { "w": 1, "x": 4, "y": 3 }, - { "w": 1, "x": 5, "y": 3 }, - { "w": 1, "x": 6, "y": 3 }, - { "w": 1, "x": 7, "y": 3 }, - { "w": 1, "x": 8, "y": 3 }, - { "w": 1, "x": 9, "y": 3 }, - { "w": 1, "x": 10, "y": 3 }, + "LAYOUT_ortho_4x12": { + "layout": [ + { "w": 1, "x": 0, "y": 0 }, + { "w": 1, "x": 1, "y": 0 }, + { "w": 1, "x": 2, "y": 0 }, + { "w": 1, "x": 3, "y": 0 }, + { "w": 1, "x": 4, "y": 0 }, + { "w": 1, "x": 5, "y": 0 }, + { "w": 1, "x": 6, "y": 0 }, + { "w": 1, "x": 7, "y": 0 }, + { "w": 1, "x": 8, "y": 0 }, + { "w": 1, "x": 9, "y": 0 }, + { "w": 1, "x": 10, "y": 0 }, + { "w": 1, "x": 11, "y": 0 }, + { "w": 1, "x": 0, "y": 1 }, + { "w": 1, "x": 1, "y": 1 }, + { "w": 1, "x": 2, "y": 1 }, + { "w": 1, "x": 3, "y": 1 }, + { "w": 1, "x": 4, "y": 1 }, + { "w": 1, "x": 5, "y": 1 }, + { "w": 1, "x": 6, "y": 1 }, + { "w": 1, "x": 7, "y": 1 }, + { "w": 1, "x": 8, "y": 1 }, + { "w": 1, "x": 9, "y": 1 }, + { "w": 1, "x": 10, "y": 1 }, + { "w": 1, "x": 11, "y": 1 }, + { "w": 1, "x": 0, "y": 2 }, + { "w": 1, "x": 1, "y": 2 }, + { "w": 1, "x": 2, "y": 2 }, + { "w": 1, "x": 3, "y": 2 }, + { "w": 1, "x": 4, "y": 2 }, + { "w": 1, "x": 5, "y": 2 }, + { "w": 1, "x": 6, "y": 2 }, + { "w": 1, "x": 7, "y": 2 }, + { "w": 1, "x": 8, "y": 2 }, + { "w": 1, "x": 9, "y": 2 }, + { "w": 1, "x": 10, "y": 2 }, + { "w": 1, "x": 11, "y": 2 }, + { "w": 1, "x": 0, "y": 3 }, + { "w": 1, "x": 1, "y": 3 }, + { "w": 1, "x": 2, "y": 3 }, + { "w": 1, "x": 3, "y": 3 }, + { "w": 1, "x": 4, "y": 3 }, + { "w": 1, "x": 5, "y": 3 }, + { "w": 1, "x": 6, "y": 3 }, + { "w": 1, "x": 7, "y": 3 }, + { "w": 1, "x": 8, "y": 3 }, + { "w": 1, "x": 9, "y": 3 }, + { "w": 1, "x": 10, "y": 3 }, { "w": 1, "x": 11, "y": 3 } ] } } diff --git a/keyboards/planck/keymaps/default/config.h b/keyboards/planck/keymaps/default/config.h index 6fa31cc8a7..464b7b29f8 100644 --- a/keyboards/planck/keymaps/default/config.h +++ b/keyboards/planck/keymaps/default/config.h @@ -1,22 +1,33 @@ +/* Copyright 2015-2021 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 <http://www.gnu.org/licenses/>. + */ + #pragma once #ifdef AUDIO_ENABLE - #define STARTUP_SONG SONG(PLANCK_SOUND) - // #define STARTUP_SONG SONG(NO_SOUND) +# define STARTUP_SONG SONG(PLANCK_SOUND) +// #define STARTUP_SONG SONG(NO_SOUND) - #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ - SONG(COLEMAK_SOUND), \ - SONG(DVORAK_SOUND) \ - } +# define DEFAULT_LAYER_SONGS \ + { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND) } #endif /* * 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 */ @@ -36,4 +47,3 @@ // Most tactile encoders have detents every 4 stages #define ENCODER_RESOLUTION 4 - diff --git a/keyboards/planck/keymaps/default/keymap.c b/keyboards/planck/keymaps/default/keymap.c index bc72e360ba..7c787e0366 100644 --- a/keyboards/planck/keymaps/default/keymap.c +++ b/keyboards/planck/keymaps/default/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2015-2017 Jack Humbert +/* Copyright 2015-2021 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 @@ -17,7 +17,6 @@ #include QMK_KEYBOARD_H #include "muse.h" -extern keymap_config_t keymap_config; enum planck_layers { _QWERTY, @@ -46,9 +45,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Qwerty * ,-----------------------------------------------------------------------------------. * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| + * |------+------+------+------+------+------+------+------+------+------+------+------| * | Esc | A | S | D | F | G | H | J | K | L | ; | " | - * |------+------+------+------+------+------|------+------+------+------+------+------| + * |------+------+------+------+------+------+------+------+------+------+------+------| * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | * |------+------+------+------+------+------+------+------+------+------+------+------| * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | @@ -64,9 +63,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Colemak * ,-----------------------------------------------------------------------------------. * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| + * |------+------+------+------+------+------+------+------+------+------+------+------| * | Esc | A | R | S | T | D | H | N | E | I | O | " | - * |------+------+------+------+------+------|------+------+------+------+------+------| + * |------+------+------+------+------+------+------+------+------+------+------+------| * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | * |------+------+------+------+------+------+------+------+------+------+------+------| * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | @@ -82,9 +81,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Dvorak * ,-----------------------------------------------------------------------------------. * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| + * |------+------+------+------+------+------+------+------+------+------+------+------| * | Esc | A | O | E | U | I | D | H | T | N | S | / | - * |------+------+------+------+------+------|------+------+------+------+------+------| + * |------+------+------+------+------+------+------+------+------+------+------+------| * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | * |------+------+------+------+------+------+------+------+------+------+------+------| * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | @@ -100,9 +99,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Lower * ,-----------------------------------------------------------------------------------. * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| + * |------+------+------+------+------+------+------+------+------+------+------+------| * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | - * |------+------+------+------+------+------|------+------+------+------+------+------| + * |------+------+------+------+------+------+------+------+------+------+------+------| * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | Next | Vol- | Vol+ | Play | @@ -118,9 +117,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Raise * ,-----------------------------------------------------------------------------------. * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| + * |------+------+------+------+------+------+------+------+------+------+------+------| * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | - * |------+------+------+------+------+------|------+------+------+------+------+------| + * |------+------+------+------+------+------+------+------+------+------+------+------| * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | Next | Vol- | Vol+ | Play | @@ -136,9 +135,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Plover layer (http://opensteno.org) * ,-----------------------------------------------------------------------------------. * | # | # | # | # | # | # | # | # | # | # | # | # | - * |------+------+------+------+------+-------------+------+------+------+------+------| + * |------+------+------+------+------+------+------+------+------+------+------+------| * | | S | T | P | H | * | * | F | P | L | T | D | - * |------+------+------+------+------+------|------+------+------+------+------+------| + * |------+------+------+------+------+------+------+------+------+------+------+------| * | | S | K | W | R | * | * | R | B | G | S | Z | * |------+------+------+------+------+------+------+------+------+------+------+------| * | Exit | | | A | O | | E | U | | | | @@ -152,12 +151,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), /* Adjust (Lower + Raise) + * v------------------------RGB CONTROL--------------------v * ,-----------------------------------------------------------------------------------. - * | | Reset| | | | | | | | | | Del | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | | + * | | Reset|Debug | RGB |RGBMOD| HUE+ | HUE- | SAT+ | SAT- |BRGTH+|BRGTH-| Del | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | |MUSmod|Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof|TermOn|TermOf| | | | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | | | | | * `-----------------------------------------------------------------------------------' @@ -208,12 +208,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { backlight_step(); #endif #ifdef KEYBOARD_planck_rev5 - PORTE &= ~(1<<6); + writePinLow(E6); #endif } else { unregister_code(KC_RSFT); #ifdef KEYBOARD_planck_rev5 - PORTE |= (1<<6); + writePinHigh(E6); #endif } return false; @@ -256,7 +256,7 @@ uint16_t muse_counter = 0; uint8_t muse_offset = 70; uint16_t muse_tempo = 50; -void encoder_update(bool clockwise) { +bool encoder_update_user(uint8_t index, bool clockwise) { if (muse_mode) { if (IS_LAYER_ON(_RAISE)) { if (clockwise) { @@ -274,65 +274,72 @@ void encoder_update(bool clockwise) { } else { if (clockwise) { #ifdef MOUSEKEY_ENABLE - register_code(KC_MS_WH_DOWN); - unregister_code(KC_MS_WH_DOWN); + tap_code(KC_MS_WH_DOWN); #else - register_code(KC_PGDN); - unregister_code(KC_PGDN); + tap_code(KC_PGDN); #endif } else { #ifdef MOUSEKEY_ENABLE - register_code(KC_MS_WH_UP); - unregister_code(KC_MS_WH_UP); + tap_code(KC_MS_WH_UP); #else - register_code(KC_PGUP); - unregister_code(KC_PGUP); + tap_code(KC_PGUP); #endif } } + return true; } -void dip_switch_update_user(uint8_t index, bool active) { - switch (index) { - case 0: - if (active) { - #ifdef AUDIO_ENABLE - PLAY_SONG(plover_song); - #endif - layer_on(_ADJUST); - } else { - #ifdef AUDIO_ENABLE - PLAY_SONG(plover_gb_song); - #endif - layer_off(_ADJUST); - } - break; - case 1: - if (active) { - muse_mode = true; - } else { - muse_mode = false; - #ifdef AUDIO_ENABLE - stop_all_notes(); - #endif - } - } +bool dip_switch_update_user(uint8_t index, bool active) { + switch (index) { + case 0: { +#ifdef AUDIO_ENABLE + static bool play_sound = false; +#endif + if (active) { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_song); } +#endif + layer_on(_ADJUST); + } else { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_gb_song); } +#endif + layer_off(_ADJUST); + } +#ifdef AUDIO_ENABLE + play_sound = true; +#endif + break; + } + case 1: + if (active) { + muse_mode = true; + } else { + muse_mode = false; + } + } + return true; } void matrix_scan_user(void) { - #ifdef AUDIO_ENABLE +#ifdef AUDIO_ENABLE if (muse_mode) { - if (muse_counter == 0) { - uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; - if (muse_note != last_muse_note) { - stop_note(compute_freq_for_midi_note(last_muse_note)); - play_note(compute_freq_for_midi_note(muse_note), 0xF); - last_muse_note = muse_note; + if (muse_counter == 0) { + uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; + if (muse_note != last_muse_note) { + stop_note(compute_freq_for_midi_note(last_muse_note)); + play_note(compute_freq_for_midi_note(muse_note), 0xF); + last_muse_note = muse_note; + } + } + muse_counter = (muse_counter + 1) % muse_tempo; + } else { + if (muse_counter) { + stop_all_notes(); + muse_counter = 0; } - } - muse_counter = (muse_counter + 1) % muse_tempo; } - #endif +#endif } bool music_mask_user(uint16_t keycode) { diff --git a/keyboards/planck/keymaps/oryx/config.h b/keyboards/planck/keymaps/oryx/config.h index d46cb36945..d0313de699 100644 --- a/keyboards/planck/keymaps/oryx/config.h +++ b/keyboards/planck/keymaps/oryx/config.h @@ -1,7 +1,24 @@ +/* Copyright 2020 ZSA Technology Inc + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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 <http://www.gnu.org/licenses/>. + */ + #pragma once #ifdef AUDIO_ENABLE -#define STARTUP_SONG SONG(PLANCK_SOUND) +# define STARTUP_SONG SONG(PLANCK_SOUND) #endif #define MIDI_BASIC @@ -14,3 +31,11 @@ */ #define LAYER_STATE_8BIT +#define ORYX_CONFIGURATOR +#define USB_SUSPEND_WAKEUP_DELAY 0 +#define FIRMWARE_VERSION u8"vAxxa/ZlQEV" +#define RGB_MATRIX_STARTUP_SPD 60 + +#define PLANCK_EZ_LED_LOWER 1 +#define PLANCK_EZ_LED_RAISE 2 +#define PLANCK_EZ_LED_ADJUST 3 diff --git a/keyboards/planck/keymaps/oryx/keymap.c b/keyboards/planck/keymaps/oryx/keymap.c index 55a9168dca..2ce5dc3c5e 100644 --- a/keyboards/planck/keymaps/oryx/keymap.c +++ b/keyboards/planck/keymaps/oryx/keymap.c @@ -1,136 +1,153 @@ +/* Copyright 2020 ZSA Technology Inc + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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 <http://www.gnu.org/licenses/>. + */ + #include QMK_KEYBOARD_H -#include "muse.h" -#include "eeprom.h" -#include "keymap_german.h" -#include "keymap_nordic.h" -#include "keymap_french.h" -#include "keymap_spanish.h" -#include "keymap_hungarian.h" -#include "keymap_swedish.h" - -#define KC_MAC_UNDO LGUI(KC_U) -#define KC_MAC_CUT LGUI(KC_X) -#define KC_MAC_COPY LGUI(KC_C) -#define KC_MAC_PASTE LGUI(KC_V) -#define KC_PC_UNDO LCTL(KC_U) -#define KC_PC_CUT LCTL(KC_X) -#define KC_PC_COPY LCTL(KC_C) -#define KC_PC_PASTE LCTL(KC_V) enum planck_keycodes { - RGB_SLD = SAFE_RANGE, - EPRM, + RGB_SLD = EZ_SAFE_RANGE, }; enum planck_layers { - _BASE, - _LOWER, - _RAISE, - _ADJUST, + _BASE, + _LOWER, + _RAISE, + _ADJUST, }; +# define LOWER MO(_LOWER) +# define RAISE MO(_RAISE) -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) - +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_BASE] = 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_BSPACE,KC_ESCAPE,KC_A,KC_S,KC_D,KC_F,KC_G,KC_H,KC_J,KC_K,KC_L,KC_SCOLON,KC_QUOTE,KC_LSHIFT,KC_Z,KC_X,KC_C,KC_V,KC_B,KC_N,KC_M,KC_COMMA,KC_DOT,KC_SLASH,KC_ENTER,KC_TRANSPARENT,KC_LCTRL,KC_LALT,KC_LGUI,LOWER,KC_SPACE,KC_NO,RAISE,KC_LEFT,KC_DOWN,KC_UP,KC_RIGHT), - - [_LOWER] = LAYOUT_planck_grid(KC_TILD,KC_EXLM,KC_AT,KC_HASH,KC_DLR,KC_PERC,KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,KC_RPRN,KC_TRANSPARENT,KC_DELETE,KC_F1,KC_F2,KC_F3,KC_F4,KC_F5,KC_F6,KC_UNDS,KC_PLUS,KC_LCBR,KC_RCBR,KC_PIPE,KC_TRANSPARENT,KC_F7,KC_F8,KC_F9,KC_F10,KC_F11,KC_F12,KC_NONUS_HASH,KC_NONUS_BSLASH,KC_HOME,KC_END,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_NO,KC_TRANSPARENT,KC_MEDIA_NEXT_TRACK,KC_AUDIO_VOL_DOWN,KC_AUDIO_VOL_UP,KC_MEDIA_PLAY_PAUSE), - - [_RAISE] = LAYOUT_planck_grid(KC_GRAVE,KC_1,KC_2,KC_3,KC_4,KC_5,KC_6,KC_7,KC_8,KC_9,KC_0,KC_TRANSPARENT,KC_DELETE,KC_F1,KC_F2,KC_F3,KC_F4,KC_F5,KC_F6,KC_MINUS,KC_EQUAL,KC_LBRACKET,KC_RBRACKET,KC_BSLASH,KC_TRANSPARENT,KC_F7,KC_F8,KC_F9,KC_F10,KC_F11,KC_F12,KC_NONUS_HASH,KC_NONUS_BSLASH,KC_PGUP,KC_PGDOWN,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_NO,KC_TRANSPARENT,KC_MEDIA_NEXT_TRACK,KC_AUDIO_VOL_DOWN,KC_AUDIO_VOL_UP,KC_MEDIA_PLAY_PAUSE), - - [_ADJUST] = LAYOUT_planck_grid(KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_DELETE,KC_TRANSPARENT,AU_ON,AU_OFF,AU_TOG,KC_TRANSPARENT,KC_TRANSPARENT,RGB_TOG,RGB_VAI,RGB_VAD,KC_TRANSPARENT,RESET,KC_TRANSPARENT,KC_TRANSPARENT,MU_ON,MU_OFF,MU_TOG,KC_TRANSPARENT,KC_TRANSPARENT,RGB_MOD,RGB_HUI,RGB_HUD,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_NO,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT), + [_BASE] = 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_BSPACE, + KC_ESCAPE, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCOLON, KC_QUOTE, + KC_LSHIFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMMA, KC_DOT, KC_SLASH, KC_ENTER, + WEBUSB_PAIR, KC_LCTRL, KC_LALT, KC_LGUI, LOWER, KC_SPACE, KC_NO, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT + ), + + [_LOWER] = LAYOUT_planck_grid( + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, + KC_DELETE, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NONUS_HASH, KC_NONUS_BSLASH,KC_HOME, KC_END, _______, + KC_COMMA, _______, _______, _______, _______, _______, KC_NO, _______, KC_MEDIA_NEXT_TRACK,KC_AUDIO_VOL_DOWN,KC_AUDIO_VOL_UP,KC_MEDIA_PLAY_PAUSE + ), + + [_RAISE] = LAYOUT_planck_grid( + KC_GRAVE,KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINUS, KC_EQUAL, KC_LBRACKET, KC_RBRACKET, KC_BSLASH, + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NONUS_HASH, KC_NONUS_BSLASH,KC_PGUP, KC_PGDOWN, _______, + _______, _______, _______, _______, _______, _______, KC_NO, _______, KC_MEDIA_NEXT_TRACK,KC_AUDIO_VOL_DOWN,KC_AUDIO_VOL_UP,KC_MEDIA_PLAY_PAUSE + ), + + [_ADJUST] = LAYOUT_planck_grid( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_DEL, _______, AU_ON, AU_OFF, AU_TOG, _______, _______, RGB_TOG, RGB_VAI, RGB_VAD, LED_LEVEL, RESET, + _______, _______, MU_ON, MU_OFF, MU_TOG, _______, _______, RGB_MOD, RGB_HUI, RGB_HUD, TOGGLE_LAYER_COLOR, _______, + _______, _______, _______, _______, _______, _______, KC_NO, _______, _______, _______, _______, _______ + ), }; +// clang-format on +#ifdef RGB_MATRIX_EANBLE +const uint8_t PROGMEM ledmap[][DRIVER_LED_TOTAL][3] = { + [0] = {{42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {32, 255, 234}, {32, 255, 234}, {32, 255, 234}, {32, 255, 234}}, + [1] = {{89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {169, 120, 255}, {169, 120, 255}, {169, 120, 255}, {169, 120, 255}, {169, 120, 255}, {169, 120, 255}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {169, 120, 255}, {169, 120, 255}, {169, 120, 255}, {169, 120, 255}, {169, 120, 255}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}}, -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case EPRM: - if (record->event.pressed) { - eeconfig_init(); - } - return false; -#ifdef RGBLIGHT_ENABLE - case RGB_SLD: - if (record->event.pressed) { - rgblight_mode(1); - } - return false; -#endif - } - return true; -} + [2] = {{216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {249, 228, 255}, {249, 228, 255}, {249, 228, 255}, {216, 255, 255}, {216, 255, 255}, {105, 255, 255}, {105, 255, 255}, {105, 255, 255}, {216, 255, 255}, {14, 255, 255}, {216, 255, 255}, {216, 255, 255}, {249, 228, 255}, {249, 228, 255}, {249, 228, 255}, {216, 255, 255}, {216, 255, 255}, {105, 255, 255}, {105, 255, 255}, {105, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}}, -bool muse_mode = false; -uint8_t last_muse_note = 0; -uint16_t muse_counter = 0; -uint8_t muse_offset = 70; -uint16_t muse_tempo = 50; - -void encoder_update(bool clockwise) { - if (muse_mode) { - if (IS_LAYER_ON(_RAISE)) { - if (clockwise) { - muse_offset++; - } else { - muse_offset--; - } - } else { - if (clockwise) { - muse_tempo+=1; - } else { - muse_tempo-=1; - } - } - } else { - if (clockwise) { - #ifdef MOUSEKEY_ENABLE - register_code(KC_MS_WH_DOWN); - unregister_code(KC_MS_WH_DOWN); - #else - register_code(KC_PGDN); - unregister_code(KC_PGDN); - #endif +}; + +void set_layer_color(int layer) { + for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + HSV hsv = { + .h = pgm_read_byte(&ledmap[layer][i][0]), + .s = pgm_read_byte(&ledmap[layer][i][1]), + .v = pgm_read_byte(&ledmap[layer][i][2]), + }; + if (!hsv.h && !hsv.s && !hsv.v) { + rgb_matrix_set_color(i, 0, 0, 0); } else { - #ifdef MOUSEKEY_ENABLE - register_code(KC_MS_WH_UP); - unregister_code(KC_MS_WH_UP); - #else - register_code(KC_PGUP); - unregister_code(KC_PGUP); - #endif + RGB rgb = hsv_to_rgb(hsv); + float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX; + rgb_matrix_set_color(i, f * rgb.r, f * rgb.g, f * rgb.b); } } } -void matrix_scan_user(void) { -#ifdef AUDIO_ENABLE - if (muse_mode) { - if (muse_counter == 0) { - uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; - if (muse_note != last_muse_note) { - stop_note(compute_freq_for_midi_note(last_muse_note)); - play_note(compute_freq_for_midi_note(muse_note), 0xF); - last_muse_note = muse_note; +void rgb_matrix_indicators_user(void) { + if (g_suspend_state || keyboard_config.disable_layer_led) { + return; + } + switch (biton32(layer_state)) { + case 1: + set_layer_color(0); + break; + case 2: + set_layer_color(1); + break; + case 3: + set_layer_color(2); + break; + default: + if (rgb_matrix_get_flags() == LED_FLAG_NONE) rgb_matrix_set_color_all(0, 0, 0); + break; + } +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case RGB_SLD: + if (record->event.pressed) { + rgblight_mode(1); } - } - muse_counter = (muse_counter + 1) % muse_tempo; + return false; } + return true; +} #endif + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (clockwise) { +# ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_DOWN); +# else + tap_code(KC_PGDN); +# endif + } else { +# ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_UP); +# else + tap_code(KC_PGUP); +# endif + } + return true; } bool music_mask_user(uint16_t keycode) { switch (keycode) { - case RAISE: - case LOWER: - return false; - default: - return true; + case RAISE: + case LOWER: + return false; + default: + return true; } } -layer_state_t layer_state_set_user(layer_state_t state) { - return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); -} + +layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); } diff --git a/keyboards/planck/keymaps/oryx/rules.mk b/keyboards/planck/keymaps/oryx/rules.mk index 27ab9be851..1e29b5f218 100644 --- a/keyboards/planck/keymaps/oryx/rules.mk +++ b/keyboards/planck/keymaps/oryx/rules.mk @@ -1,6 +1,7 @@ -SRC += muse.c # Set any rules.mk overrides for your specific keymap here. # See rules at https://docs.qmk.fm/#/config_options?id=the-rulesmk-file +CONSOLE_ENABLE = no COMMAND_ENABLE = no MOUSEKEY_ENABLE = no +WEBUSB_ENABLE = yes ORYX_ENABLE = yes diff --git a/keyboards/planck/keymaps/webusb/config.h b/keyboards/planck/keymaps/webusb/config.h index 6fa31cc8a7..9020d2b9f8 100644 --- a/keyboards/planck/keymaps/webusb/config.h +++ b/keyboards/planck/keymaps/webusb/config.h @@ -14,9 +14,6 @@ * 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 */ diff --git a/keyboards/planck/keymaps/webusb/keymap.c b/keyboards/planck/keymaps/webusb/keymap.c index f9d6998940..ee77bf007c 100644 --- a/keyboards/planck/keymaps/webusb/keymap.c +++ b/keyboards/planck/keymaps/webusb/keymap.c @@ -68,7 +68,7 @@ uint16_t muse_counter = 0; uint8_t muse_offset = 70; uint16_t muse_tempo = 50; -void encoder_update(bool clockwise) { +bool encoder_update_user(uint8_t index, bool clockwise) { if (muse_mode) { if (IS_LAYER_ON(_RAISE)) { if (clockwise) { @@ -102,6 +102,7 @@ void encoder_update(bool clockwise) { #endif } } + return false; } void matrix_scan_user(void) { diff --git a/keyboards/planck/planck.c b/keyboards/planck/planck.c index d9e3f00f2b..a17036fcf1 100644 --- a/keyboards/planck/planck.c +++ b/keyboards/planck/planck.c @@ -2,7 +2,7 @@ #ifdef SWAP_HANDS_ENABLE __attribute__ ((weak)) -const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { +const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { {{11, 0}, {10, 0}, {9, 0}, {8, 0}, {7, 0}, {6, 0}, {5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}}, {{11, 1}, {10, 1}, {9, 1}, {8, 1}, {7, 1}, {6, 1}, {5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}}, {{11, 2}, {10, 2}, {9, 2}, {8, 2}, {7, 2}, {6, 2}, {5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}}, @@ -12,10 +12,10 @@ const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { __attribute__ ((weak)) void matrix_init_kb(void) { - // Turn status LED on - #ifdef __AVR__ - DDRE |= (1<<6); - PORTE |= (1<<6); + // Turn status LED on, with the exception of THK + #if defined(__AVR_ATmega32U4__) + setPinOutput(E6); + writePinHigh(E6); #endif matrix_init_user(); @@ -26,4 +26,4 @@ const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS] = LAYOUT_planck_grid( 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 -);
\ No newline at end of file +); diff --git a/keyboards/planck/planck.h b/keyboards/planck/planck.h index d575112d36..0d5c14fdac 100644 --- a/keyboards/planck/planck.h +++ b/keyboards/planck/planck.h @@ -1,9 +1,23 @@ +/* Copyright 2018 Jack Humbert <jack.humb@gmail.com> + * + * 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 <http://www.gnu.org/licenses/>. + */ + #pragma once #include "quantum.h" -#define encoder_update(clockwise) encoder_update_user(uint8_t index, clockwise) - #if defined(KEYBOARD_planck_ez) # include "ez.h" #endif // Planck revisions diff --git a/keyboards/planck/readme.md b/keyboards/planck/readme.md index d8591953b4..748c251478 100644 --- a/keyboards/planck/readme.md +++ b/keyboards/planck/readme.md @@ -15,6 +15,7 @@ Make example for this keyboard (after setting up your build environment): Install examples: - make planck/rev6:default:dfu-util + make planck/rev5:default:dfu # For Planck rev5 or earlier and Planck Light + make planck/rev6:default:dfu-util # For Planck rev6 -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 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/planck/rules.mk b/keyboards/planck/rules.mk deleted file mode 100644 index 09d4a74ea6..0000000000 --- a/keyboards/planck/rules.mk +++ /dev/null @@ -1,32 +0,0 @@ -# MCU name -MCU = atmega32u4 - - -# Interrupt driven control endpoint task(+60) -OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT - -# 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 = 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 # 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 = yes # Audio output on port C6 -UNICODE_ENABLE = no # Unicode -BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = no # 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 - -LAYOUTS = ortho_4x12 planck_mit planck_grid -LAYOUTS_HAS_RGB = no - -DEFAULT_FOLDER = planck/ez |