diff options
author | Jack Humbert <jack.humb@gmail.com> | 2019-04-08 19:57:43 -0400 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2019-04-08 16:57:43 -0700 |
commit | fa4052c26e33b42b65521fd5ba9f94a3a778b275 (patch) | |
tree | b16d69187656b109d98710359c9044edc716aaa2 /keyboards | |
parent | bc536b9b6d98e5428a28f6e6ba69675bd77b79cc (diff) |
Adds the Planck EZ, 3737 RGB, fixes out-of-tune notes (#5532)
* RGB Matrix overhaul
Breakout of animations to separate files
Integration of optimized int based math lib
Overhaul of rgb_matrix.c and animations for performance
* Updating effect function api for future extensions
* Combined the keypresses || keyreleases define checks into a single define so I stop forgetting it where necessary
* Moving define RGB_MATRIX_KEYREACTIVE_ENABLED earlier in the include chain
* Adds the Planck EZ, 3737 RGB, fixes out-of-tune notes
* fix bug in quantum/rgb_matrix_drivers.c
Co-Authored-By: jackhumbert <jack.humb@gmail.com>
* update command setting to the correct default
* correct rgb config
* remove commented-out lines
* update docs for the 3737
* Update docs/feature_rgb_matrix.md
Co-Authored-By: jackhumbert <jack.humb@gmail.com>
Diffstat (limited to 'keyboards')
-rw-r--r-- | keyboards/planck/ez/config.h | 141 | ||||
-rw-r--r-- | keyboards/planck/ez/ez.c | 175 | ||||
-rw-r--r-- | keyboards/planck/ez/ez.h | 107 | ||||
-rw-r--r-- | keyboards/planck/ez/rules.mk | 24 | ||||
-rw-r--r-- | keyboards/planck/planck.h | 6 |
5 files changed, 452 insertions, 1 deletions
diff --git a/keyboards/planck/ez/config.h b/keyboards/planck/ez/config.h new file mode 100644 index 0000000000..c449d17192 --- /dev/null +++ b/keyboards/planck/ez/config.h @@ -0,0 +1,141 @@ +/* + * 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 + +/* USB Device descriptor parameter */ +#define DEVICE_VER 0x0000 + +#undef MATRIX_ROWS +#undef MATRIX_COLS +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 6 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ + +#undef MATRIX_ROW_PINS +#undef MATRIX_COL_PINS + +#define MATRIX_ROW_PINS { A10, A9, A8, B15, C13, C14, C15, A2 } +#define MATRIX_COL_PINS { B11, B10, B2, B1, A7, B0 } + +#define NUMBER_OF_ENCODERS 1 +#define ENCODERS_PAD_A { B12 } +#define ENCODERS_PAD_B { B13 } + +#define MUSIC_MAP +#undef AUDIO_VOICES +#undef C6_AUDIO + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 6 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +//#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +//#define LOCKING_RESYNC_ENABLE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +//#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 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. + +#define DRIVER_COUNT 1 +#define DRIVER_1_LED_TOTAL 47 +#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL + +#define RGB_MATRIX_KEYPRESSES diff --git a/keyboards/planck/ez/ez.c b/keyboards/planck/ez/ez.c new file mode 100644 index 0000000000..b859af6c15 --- /dev/null +++ b/keyboards/planck/ez/ez.c @@ -0,0 +1,175 @@ +/* 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/>. + */ +#include "ez.h" + +const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +/* Refer to IS31 manual for these locations + * driver + * | R location + * | | G location + * | | | B location + * | | | | */ + {0, A_12, B_12, C_12}, + {0, A_11, B_11, C_11}, + {0, A_10, B_10, C_10}, + {0, A_9, B_9, C_9}, + {0, A_8, B_8, C_8}, + {0, A_7, B_7, C_7}, + + {0, G_12, H_12, I_12}, + {0, G_11, H_11, I_11}, + {0, G_10, H_10, I_10}, + {0, G_9, H_9, I_9}, + {0, G_8, H_8, I_8}, + {0, G_7, H_7, I_7}, + + {0, A_6, B_6, C_6}, + {0, A_5, B_5, C_5}, + {0, A_4, B_4, C_4}, + {0, A_3, B_3, C_3}, + {0, A_2, B_2, C_2}, + {0, A_1, B_1, C_1}, + + {0, G_6, H_6, I_6}, + {0, G_5, H_5, I_5}, + {0, G_4, H_4, I_4}, + {0, G_3, H_3, I_3}, + {0, G_2, H_2, I_2}, + {0, G_1, H_1, I_1}, + + {0, D_12, E_12, F_12}, + {0, D_11, E_11, F_11}, + {0, D_10, E_10, F_10}, + {0, D_9, E_9, F_9}, + {0, D_8, E_8, F_8}, + {0, D_7, E_7, F_7}, + + {0, J_12, K_12, L_12}, + {0, J_11, K_11, L_11}, + {0, J_10, K_10, L_10}, + {0, J_9, K_9, L_9}, + {0, J_8, K_8, L_8}, + {0, J_7, K_7, L_7}, + + {0, D_6, E_6, F_6}, + {0, D_5, E_5, F_5}, + {0, D_4, E_4, F_4}, + {0, D_3, E_3, F_3}, + {0, D_2, E_2, F_2}, + {0, D_1, E_1, F_1}, + + {0, J_6, K_6, L_6}, + {0, J_5, K_5, L_5}, + {0, J_4, K_4, L_4}, + {0, J_3, K_3, L_3}, + {0, J_2, K_2, L_2}, + +}; + +const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { + + /*{row | col << 4} + | {x=0..224, y=0..64} + | | modifier + | | | */ + {{0|(0<<4)}, {20.36*0, 21.33*0}, 1}, + {{0|(1<<4)}, {20.36*1, 21.33*0}, 0}, + {{0|(2<<4)}, {20.36*2, 21.33*0}, 0}, + {{0|(3<<4)}, {20.36*3, 21.33*0}, 0}, + {{0|(4<<4)}, {20.36*4, 21.33*0}, 0}, + {{0|(5<<4)}, {20.36*5, 21.33*0}, 0}, + {{4|(0<<4)}, {20.36*6, 21.33*0}, 0}, + {{4|(1<<4)}, {20.36*7, 21.33*0}, 0}, + {{4|(2<<4)}, {20.36*8, 21.33*0}, 0}, + {{4|(3<<4)}, {20.36*9, 21.33*0}, 0}, + {{4|(4<<4)}, {20.36*10,21.33*0}, 0}, + {{4|(5<<4)}, {20.36*11,21.33*0}, 1}, + + {{1|(0<<4)}, {20.36*0, 21.33*1}, 1}, + {{1|(1<<4)}, {20.36*1, 21.33*1}, 0}, + {{1|(2<<4)}, {20.36*2, 21.33*1}, 0}, + {{1|(3<<4)}, {20.36*3, 21.33*1}, 0}, + {{1|(4<<4)}, {20.36*4, 21.33*1}, 0}, + {{1|(5<<4)}, {20.36*5, 21.33*1}, 0}, + {{5|(0<<4)}, {20.36*6, 21.33*1}, 0}, + {{5|(1<<4)}, {20.36*7, 21.33*1}, 0}, + {{5|(2<<4)}, {20.36*8, 21.33*1}, 0}, + {{5|(3<<4)}, {20.36*9, 21.33*1}, 0}, + {{5|(4<<4)}, {20.36*10,21.33*1}, 0}, + {{5|(5<<4)}, {20.36*11,21.33*1}, 1}, + + {{2|(0<<4)}, {20.36*0, 21.33*2}, 1}, + {{2|(1<<4)}, {20.36*1, 21.33*2}, 0}, + {{2|(2<<4)}, {20.36*2, 21.33*2}, 0}, + {{2|(3<<4)}, {20.36*3, 21.33*2}, 0}, + {{2|(4<<4)}, {20.36*4, 21.33*2}, 0}, + {{2|(5<<4)}, {20.36*5, 21.33*2}, 0}, + {{6|(0<<4)}, {20.36*6, 21.33*2}, 0}, + {{6|(1<<4)}, {20.36*7, 21.33*2}, 0}, + {{6|(2<<4)}, {20.36*8, 21.33*2}, 0}, + {{6|(3<<4)}, {20.36*9, 21.33*2}, 0}, + {{6|(4<<4)}, {20.36*10,21.33*2}, 0}, + {{6|(5<<4)}, {20.36*11,21.33*2}, 1}, + + {{3|(0<<4)}, {20.36*0, 21.33*3}, 1}, + {{3|(1<<4)}, {20.36*1, 21.33*3}, 1}, + {{3|(2<<4)}, {20.36*2, 21.33*3}, 1}, + {{7|(3<<4)}, {20.36*3, 21.33*3}, 1}, + {{7|(4<<4)}, {20.36*4, 21.33*3}, 1}, + {{7|(5<<4)}, {20.36*5.5,21.33*3}, 0}, + {{7|(0<<4)}, {20.36*7, 21.33*3}, 1}, + {{7|(1<<4)}, {20.36*8, 21.33*3}, 1}, + {{7|(2<<4)}, {20.36*9, 21.33*3}, 1}, + {{3|(3<<4)}, {20.36*10,21.33*3}, 1}, + {{3|(4<<4)}, {20.36*11,21.33*3}, 1} +}; + +void matrix_init_kb(void) { + matrix_init_user(); + + palSetPadMode(GPIOB, 8, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOB, 9, PAL_MODE_OUTPUT_PUSHPULL); + + palClearPad(GPIOB, 8); + palClearPad(GPIOB, 9); +} + +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +uint32_t layer_state_set_kb(uint32_t state) { + + palClearPad(GPIOB, 8); + palClearPad(GPIOB, 9); + state = layer_state_set_user(state); + uint8_t layer = biton32(state); + switch (layer) { + case 3: + palSetPad(GPIOB, 9); + break; + case 4: + palSetPad(GPIOB, 8); + break; + case 6: + palSetPad(GPIOB, 9); + palSetPad(GPIOB, 8); + break; + default: + break; + } + return state; +} diff --git a/keyboards/planck/ez/ez.h b/keyboards/planck/ez/ez.h new file mode 100644 index 0000000000..a3ca2b6ece --- /dev/null +++ b/keyboards/planck/ez/ez.h @@ -0,0 +1,107 @@ +/* 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 "planck.h" + +#define 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, k36, k37, k38, k39, k3a \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05 }, \ + { k10, k11, k12, k13, k14, k15 }, \ + { k20, k21, k22, k23, k24, k25 }, \ + { k30, k31, k32, k39, k3a, k3b }, \ + { k06, k07, k08, k09, k0a, k0b }, \ + { k16, k17, k18, k19, k1a, k1b }, \ + { k26, k27, k28, k29, k2a, k2b }, \ + { k36, k37, k38, k33, k34, k35 } \ +} + +#define LAYOUT_planck_1x2uR( \ + 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, k36, k37, k38, k39, k3a \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05 }, \ + { k10, k11, k12, k13, k14, k15 }, \ + { k20, k21, k22, k23, k24, k25 }, \ + { k30, k31, k32, k39, k3a, k3b }, \ + { k06, k07, k08, k09, k0a, k0b }, \ + { k16, k17, k18, k19, k1a, k1b }, \ + { k26, k27, k28, k29, k2a, k2b }, \ + { k36, k37, k38, k33, k34, k35 } \ +} + +#define LAYOUT_planck_1x2uL( \ + 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, k36, k37, k38, k39, k3a \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05 }, \ + { k10, k11, k12, k13, k14, k15 }, \ + { k20, k21, k22, k23, k24, k25 }, \ + { k30, k31, k32, k39, k3a, k3b }, \ + { k06, k07, k08, k09, k0a, k0b }, \ + { k16, k17, k18, k19, k1a, k1b }, \ + { k26, k27, k28, k29, k2a, k2b }, \ + { k36, k37, k38, k33, k34, k35 } \ +} + +#define LAYOUT_planck_2x2u( \ + 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, k36, k37, k38, k39, k3a \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05 }, \ + { k10, k11, k12, k13, k14, k15 }, \ + { k20, k21, k22, k23, k24, k25 }, \ + { k30, k31, k32, k39, k3a, k3b }, \ + { k06, k07, k08, k09, k0a, k0b }, \ + { k16, k17, k18, k19, k1a, k1b }, \ + { k26, k27, k28, k29, k2a, k2b }, \ + { k36, k37, k38, k33, k34, k35 } \ +} + +#define LAYOUT_planck_grid( \ + 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, k36, k37, k38, k39, k3a \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05 }, \ + { k10, k11, k12, k13, k14, k15 }, \ + { k20, k21, k22, k23, k24, k25 }, \ + { k30, k31, k32, k39, k3a, KC_NO }, \ + { k06, k07, k08, k09, k0a, k0b }, \ + { k16, k17, k18, k19, k1a, k1b }, \ + { k26, k27, k28, k29, k2a, k2b }, \ + { k36, k37, k38, k33, k34, k35 } \ +} + +#define KEYMAP LAYOUT_planck_grid +#define LAYOUT_ortho_4x12 LAYOUT_planck_grid +#define KC_LAYOUT_ortho_4x12 KC_KEYMAP diff --git a/keyboards/planck/ez/rules.mk b/keyboards/planck/ez/rules.mk new file mode 100644 index 0000000000..c6fb52d2b5 --- /dev/null +++ b/keyboards/planck/ez/rules.mk @@ -0,0 +1,24 @@ +# project specific files +LAYOUTS += ortho_4x12 + +# Cortex version +MCU = STM32F303 + +# Build Options +# comment out to disable the options. +# +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 +CONSOLE_ENABLE = yes # 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 = no # Custom matrix file +AUDIO_ENABLE = yes +RGBLIGHT_ENABLE = no +# SERIAL_LINK_ENABLE = yes +ENCODER_ENABLE = yes +RGB_MATRIX_ENABLE = IS31FL3737 diff --git a/keyboards/planck/planck.h b/keyboards/planck/planck.h index d908d80ec4..4bc5e9c3f2 100644 --- a/keyboards/planck/planck.h +++ b/keyboards/planck/planck.h @@ -5,6 +5,10 @@ #define encoder_update(clockwise) encoder_update_user(uint8_t index, clockwise) +#ifdef KEYBOARD_planck_ez + #include "ez.h" +#endif + #ifdef __AVR__ #define LAYOUT_planck_mit( \ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ @@ -50,7 +54,7 @@ #define LAYOUT_ortho_4x12 LAYOUT_planck_grid #define KC_LAYOUT_ortho_4x12 KC_KEYMAP -#else +#elif KEYBOARD_planck_rev6 #define LAYOUT_planck_1x2uC( \ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ |