From c768ffeb33e8635f1ef6fa46928a5b992ee8aae9 Mon Sep 17 00:00:00 2001 From: Danny Date: Tue, 15 Jan 2019 17:04:56 -0500 Subject: [PATCH] [Keyboard] Iris via support, Rev 3 updates (#4849) * Add encoder support * Add VIA support to Iris Rev. 3 * Update pinout and disable mouse keys to free up space * Rollout VIA support to all Iris revisions * Update default keymap * Update vendor ID --- keyboards/iris/iris.h | 1 + keyboards/iris/keymaps/default/keymap.c | 71 ++++++------------------- keyboards/iris/rev1/config.h | 32 +++++------ keyboards/iris/rev1/rev1.c | 14 ----- keyboards/iris/rev1_led/config.h | 32 +++++------ keyboards/iris/rev1_led/rev1_led.c | 14 ----- keyboards/iris/rev2/config.h | 32 +++++------ keyboards/iris/rev2/rev2.c | 14 ----- keyboards/iris/rev3/config.h | 41 ++++++++------ keyboards/iris/rev3/rev3.c | 15 ------ keyboards/iris/rev3/rev3.h | 2 - keyboards/iris/rev3/rules.mk | 1 + keyboards/iris/rules.mk | 40 +++----------- 13 files changed, 104 insertions(+), 205 deletions(-) diff --git a/keyboards/iris/iris.h b/keyboards/iris/iris.h index afad9a0d6d..4212462c15 100644 --- a/keyboards/iris/iris.h +++ b/keyboards/iris/iris.h @@ -11,6 +11,7 @@ #endif #include "quantum.h" +#include "../../zeal60/zeal60_keycodes.h" // Used to create a keymap using only KC_ prefixed keys #define LAYOUT_kc( \ diff --git a/keyboards/iris/keymaps/default/keymap.c b/keyboards/iris/keymaps/default/keymap.c index 4644c3d9b5..f67b71fc1a 100644 --- a/keyboards/iris/keymaps/default/keymap.c +++ b/keyboards/iris/keymaps/default/keymap.c @@ -2,21 +2,14 @@ extern keymap_config_t keymap_config; -#define _QWERTY 0 -#define _LOWER 1 -#define _RAISE 2 -#define _ADJUST 16 - -enum custom_keycodes { - QWERTY = SAFE_RANGE, - LOWER, - RAISE, - ADJUST, -}; +#define _MAIN 0 +#define _FN1 1 +#define _FN2 2 +#define _FN3 3 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_QWERTY] = LAYOUT( + [_MAIN] = LAYOUT( //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ @@ -26,11 +19,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_HOME, KC_END, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, //└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘ - KC_LGUI, LOWER, KC_ENT, KC_SPC, RAISE, KC_LALT + KC_LGUI, FN_MO13, KC_ENT, KC_SPC, FN_MO23, KC_LALT // └────────┴────────┴────────┘ └────────┴────────┴────────┘ ), - [_LOWER] = LAYOUT( + [_FN1] = LAYOUT( //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ @@ -44,7 +37,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // └────────┴────────┴────────┘ └────────┴────────┴────────┘ ), - [_RAISE] = LAYOUT( + [_FN2] = LAYOUT( //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ @@ -58,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // └────────┴────────┴────────┘ └────────┴────────┴────────┘ ), - [_ADJUST] = LAYOUT( + [_FN3] = LAYOUT( //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ @@ -73,42 +66,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) }; -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case QWERTY: - if (record->event.pressed) { - set_single_persistent_default_layer(_QWERTY); - } - return false; - break; - case LOWER: - if (record->event.pressed) { - layer_on(_LOWER); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } else { - layer_off(_LOWER); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } - return false; - break; - case RAISE: - if (record->event.pressed) { - layer_on(_RAISE); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } else { - layer_off(_RAISE); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } - return false; - break; - case ADJUST: - if (record->event.pressed) { - layer_on(_ADJUST); - } else { - layer_off(_ADJUST); - } - return false; - break; - } - return true; +void encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { + if (clockwise) { + tap_code(KC_PGDN); + } else { + tap_code(KC_PGUP); + } + } } diff --git a/keyboards/iris/rev1/config.h b/keyboards/iris/rev1/config.h index 3b31ca0d7e..1eddb54b4f 100644 --- a/keyboards/iris/rev1/config.h +++ b/keyboards/iris/rev1/config.h @@ -20,7 +20,7 @@ along with this program. If not, see . #include QMK_KEYBOARD_CONFIG_H /* USB Device descriptor parameter */ -#define VENDOR_ID 0xCEEB +#define VENDOR_ID 0xCB10 #define PRODUCT_ID 0x1256 #define DEVICE_VER 0x0100 #define MANUFACTURER Keebio @@ -68,20 +68,22 @@ along with this program. If not, see . #define RGB_DI_PIN D3 #define RGBLED_NUM 12 // Number of LEDs -/* - * Feature disable options - * These options are also useful to firmware size reduction. - */ +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 -/* disable debug print */ -// #define NO_DEBUG +// EEPROM usage -/* disable print */ -// #define NO_PRINT +// TODO: refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x451F +#define EEPROM_MAGIC_ADDR 32 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x08 +#define EEPROM_VERSION_ADDR 34 -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR 35 +// Dynamic macro starts after dynamic keymaps (35+(4*10*6*2)) = (35+480) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 515 +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 509 // 1024-DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR +#define DYNAMIC_KEYMAP_MACRO_COUNT 16 diff --git a/keyboards/iris/rev1/rev1.c b/keyboards/iris/rev1/rev1.c index fe91fa3ead..9694d122df 100644 --- a/keyboards/iris/rev1/rev1.c +++ b/keyboards/iris/rev1/rev1.c @@ -7,20 +7,6 @@ void led_set_kb(uint8_t usb_led) { } #endif -void matrix_init_kb(void) { - - // // green led on - // DDRD |= (1<<5); - // PORTD &= ~(1<<5); - - // // orange led on - // DDRB |= (1<<0); - // PORTB &= ~(1<<0); - - matrix_init_user(); -}; - - #ifdef SWAP_HANDS_ENABLE __attribute__ ((weak)) // swap-hands action needs a matrix to define the swap diff --git a/keyboards/iris/rev1_led/config.h b/keyboards/iris/rev1_led/config.h index e9739c0031..4505c22299 100644 --- a/keyboards/iris/rev1_led/config.h +++ b/keyboards/iris/rev1_led/config.h @@ -20,7 +20,7 @@ along with this program. If not, see . #include QMK_KEYBOARD_CONFIG_H /* USB Device descriptor parameter */ -#define VENDOR_ID 0xCEEB +#define VENDOR_ID 0xCB10 #define PRODUCT_ID 0x1256 #define DEVICE_VER 0x0100 #define MANUFACTURER Keebio @@ -68,20 +68,22 @@ along with this program. If not, see . #define RGB_DI_PIN D3 #define RGBLED_NUM 12 // Number of LEDs -/* - * Feature disable options - * These options are also useful to firmware size reduction. - */ +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 -/* disable debug print */ -// #define NO_DEBUG +// EEPROM usage -/* disable print */ -// #define NO_PRINT +// TODO: refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x451F +#define EEPROM_MAGIC_ADDR 32 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x08 +#define EEPROM_VERSION_ADDR 34 -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR 35 +// Dynamic macro starts after dynamic keymaps (35+(4*10*6*2)) = (35+480) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 515 +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 509 // 1024-DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR +#define DYNAMIC_KEYMAP_MACRO_COUNT 16 diff --git a/keyboards/iris/rev1_led/rev1_led.c b/keyboards/iris/rev1_led/rev1_led.c index d08eaea662..af5fc9440b 100644 --- a/keyboards/iris/rev1_led/rev1_led.c +++ b/keyboards/iris/rev1_led/rev1_led.c @@ -7,20 +7,6 @@ void led_set_kb(uint8_t usb_led) { } #endif -void matrix_init_kb(void) { - - // // green led on - // DDRD |= (1<<5); - // PORTD &= ~(1<<5); - - // // orange led on - // DDRB |= (1<<0); - // PORTB &= ~(1<<0); - - matrix_init_user(); -}; - - #ifdef SWAP_HANDS_ENABLE __attribute__ ((weak)) // swap-hands action needs a matrix to define the swap diff --git a/keyboards/iris/rev2/config.h b/keyboards/iris/rev2/config.h index d43d4b1c64..e0465ca8a4 100644 --- a/keyboards/iris/rev2/config.h +++ b/keyboards/iris/rev2/config.h @@ -20,7 +20,7 @@ along with this program. If not, see . #include QMK_KEYBOARD_CONFIG_H /* USB Device descriptor parameter */ -#define VENDOR_ID 0xCEEB +#define VENDOR_ID 0xCB10 #define PRODUCT_ID 0x1256 #define DEVICE_VER 0x0200 #define MANUFACTURER Keebio @@ -68,20 +68,22 @@ along with this program. If not, see . #define RGB_DI_PIN D3 #define RGBLED_NUM 12 // Number of LEDs -/* - * Feature disable options - * These options are also useful to firmware size reduction. - */ +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 -/* disable debug print */ -// #define NO_DEBUG +// EEPROM usage -/* disable print */ -// #define NO_PRINT +// TODO: refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x451F +#define EEPROM_MAGIC_ADDR 32 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x08 +#define EEPROM_VERSION_ADDR 34 -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR 35 +// Dynamic macro starts after dynamic keymaps (35+(4*10*6*2)) = (35+480) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 515 +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 509 // 1024-DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR +#define DYNAMIC_KEYMAP_MACRO_COUNT 16 diff --git a/keyboards/iris/rev2/rev2.c b/keyboards/iris/rev2/rev2.c index 133fce66ad..8575243f0d 100644 --- a/keyboards/iris/rev2/rev2.c +++ b/keyboards/iris/rev2/rev2.c @@ -7,20 +7,6 @@ void led_set_kb(uint8_t usb_led) { } #endif -void matrix_init_kb(void) { - - // // green led on - // DDRD |= (1<<5); - // PORTD &= ~(1<<5); - - // // orange led on - // DDRB |= (1<<0); - // PORTB &= ~(1<<0); - - matrix_init_user(); -}; - - #ifdef SWAP_HANDS_ENABLE __attribute__ ((weak)) // swap-hands action needs a matrix to define the swap diff --git a/keyboards/iris/rev3/config.h b/keyboards/iris/rev3/config.h index 5642512f39..ad5937dc15 100644 --- a/keyboards/iris/rev3/config.h +++ b/keyboards/iris/rev3/config.h @@ -20,7 +20,7 @@ along with this program. If not, see . #include QMK_KEYBOARD_CONFIG_H /* USB Device descriptor parameter */ -#define VENDOR_ID 0xCEEB +#define VENDOR_ID 0xCB10 #define PRODUCT_ID 0x1256 #define DEVICE_VER 0x0300 #define MANUFACTURER Keebio @@ -35,6 +35,15 @@ along with this program. If not, see . // wiring of each half #define MATRIX_ROW_PINS { D2, D3, D5, D7, D6 } #define MATRIX_COL_PINS { F1, F4, F5, F6, D4, B4 } +#define SPLIT_HAND_PIN F0 +#define QMK_ESC_OUTPUT D2 +#define QMK_ESC_INPUT F1 +#define QMK_LED B0 +#define QMK_SPEAKER C6 + +#define NUMBER_OF_ENCODERS 1 +#define ENCODERS_PAD_A { B5 } +#define ENCODERS_PAD_B { B7 } /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW @@ -68,20 +77,22 @@ along with this program. If not, see . #define RGB_DI_PIN F7 #define RGBLED_NUM 12 // Number of LEDs -/* - * Feature disable options - * These options are also useful to firmware size reduction. - */ +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 -/* disable debug print */ -// #define NO_DEBUG +// EEPROM usage -/* disable print */ -// #define NO_PRINT +// TODO: refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x451F +#define EEPROM_MAGIC_ADDR 32 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x08 +#define EEPROM_VERSION_ADDR 34 -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR 35 +// Dynamic macro starts after dynamic keymaps (35+(4*10*6*2)) = (35+480) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 515 +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 509 // 1024-DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR +#define DYNAMIC_KEYMAP_MACRO_COUNT 16 diff --git a/keyboards/iris/rev3/rev3.c b/keyboards/iris/rev3/rev3.c index d8272db0f5..7e49330c1d 100644 --- a/keyboards/iris/rev3/rev3.c +++ b/keyboards/iris/rev3/rev3.c @@ -7,20 +7,6 @@ void led_set_kb(uint8_t usb_led) { } #endif -void matrix_init_kb(void) { - - // // green led on - // DDRD |= (1<<5); - // PORTD &= ~(1<<5); - - // // orange led on - // DDRB |= (1<<0); - // PORTB &= ~(1<<0); - - matrix_init_user(); -}; - - #ifdef SWAP_HANDS_ENABLE __attribute__ ((weak)) // swap-hands action needs a matrix to define the swap @@ -39,4 +25,3 @@ const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { {{0,4}, {1,4}, {2,4}, {3,4}, {4,4}, {5,4}}, }; #endif - diff --git a/keyboards/iris/rev3/rev3.h b/keyboards/iris/rev3/rev3.h index d44cef9a6b..da9da84403 100644 --- a/keyboards/iris/rev3/rev3.h +++ b/keyboards/iris/rev3/rev3.h @@ -12,8 +12,6 @@ #endif #endif -//void promicro_bootloader_jmp(bool program); - #define LAYOUT( \ L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ diff --git a/keyboards/iris/rev3/rules.mk b/keyboards/iris/rev3/rules.mk index d7463419b4..d7e0da9367 100644 --- a/keyboards/iris/rev3/rules.mk +++ b/keyboards/iris/rev3/rules.mk @@ -1,2 +1,3 @@ RGBLIGHT_ENABLE = yes BACKLIGHT_ENABLE = yes +ENCODER_ENABLE = yes diff --git a/keyboards/iris/rules.mk b/keyboards/iris/rules.mk index e93d7dae80..69bc62f876 100644 --- a/keyboards/iris/rules.mk +++ b/keyboards/iris/rules.mk @@ -1,36 +1,6 @@ -# MCU name MCU = atmega32u4 - -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This will be an integer division of F_USB below, as it is sourced by -# F_USB after it has run through any CPU prescalers. Note that this value -# does not *change* the processor frequency - it should merely be updated to -# reflect the processor speed set externally so that the code can use accurate -# software delays. F_CPU = 16000000 - -# -# LUFA specific -# -# Target architecture (see library "Board Types" documentation). ARCH = AVR8 - -# Input clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency (before any prescaling is performed) in Hz. This value may -# differ from F_CPU if prescaling is used on the latter, and is required as the -# raw input clock is fed directly to the PLL sections of the AVR for high speed -# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' -# at the end, this will be done automatically to create a 32-bit value in your -# source code. -# -# If no clock division is performed on the input clock inside the AVR (via the -# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. F_USB = $(F_CPU) # Bootloader @@ -50,8 +20,9 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically # + BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) CONSOLE_ENABLE = no # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration @@ -61,10 +32,15 @@ MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend SPLIT_KEYBOARD = yes DEFAULT_FOLDER = iris/rev2 + +# VIA Support - Comment these 3 lines out to disable +RAW_ENABLE = yes +DYNAMIC_KEYMAP_ENABLE = yes +SRC += keyboards/wilba_tech/wt_main.c