From cbc5de67be36d5b9b3872a3c41c9619b93b04b9f Mon Sep 17 00:00:00 2001 From: MechMerlin <30334081+mechmerlin@users.noreply.github.com> Date: Wed, 3 Jan 2018 09:17:09 -0800 Subject: [PATCH] Duck Eagle/Viper V2 support (#2216) * Preliminary support for Duck Eagle/Viper V2 60% board. This is a copy of the octagon/v2 with things changed to reach a compiling state * Get a 60% keymap compiling, this might not be what the eagle/viper really supports * Update readme to point to correct GeekHack link * Get keymap working on a Duck Eagle * Add code submitted by profanum429 - Add HHKB style top row to v2.h - Modify read_rows function to take into accout the caps lock firmware key - Modify default keymap to match the new v2.h - Adjust readmes * Fix bug related to col 0 not working * Add keymap for mechmerlin * Add profanum429's viper hhkb layout * Add visual representation for mechmerlin layout Add navigation keys to keymap * Add a better visual representation to the mechmerlin keymap * Add profanum429's Viper layout! * Updated profanum429 keymap to match a full HHKB Enabled media keys in rules.mk * Revert "Updated profanum429 keymap to match a full HHKB" This reverts commit ed914160d7e27e6412d2c7c5c1c4fa0a04838667. * Fix default keymap for Eagle * Enable extra keys for audio control support * Modified timings in indicator_leds to accomodate the WS2811S chips on the Eagle/Viper2 PCBs at 800kHz with a 16mHz clock Modified the backlight settings to not interfere with the default RGB underglow code from QMK Modified the order of the LEDs in the LED status bar at the top of the Eagle/Viper2 PCBs (3,2,1,6,5,4,8,7 order) * Cleaned up indicator code to remove unused functions as the RGB underglow uses the default driver provided by QMK Commented out backlighting code in v2.c * update readmes to reflect profanum's awesome contributions and fix typo in make instructions * Remove custom RGB logic and just rely on QMK RGB underglow. We'll leave the backlighting in place for now --- keyboards/eagle_viper/eagle_viper.c | 1 + keyboards/eagle_viper/eagle_viper.h | 10 + keyboards/eagle_viper/readme.md | 12 + keyboards/eagle_viper/rules.mk | 1 + keyboards/eagle_viper/v2/config.h | 54 ++++ keyboards/eagle_viper/v2/indicator_leds.c | 89 ++++++ keyboards/eagle_viper/v2/indicator_leds.h | 2 + .../eagle_viper/v2/keymaps/default/keymap.c | 37 +++ .../eagle_viper/v2/keymaps/default/readme.md | 10 + .../v2/keymaps/mechmerlin/keymap.c | 44 +++ .../v2/keymaps/mechmerlin/readme.md | 15 + .../v2/keymaps/profanum429/keymap.c | 40 +++ .../v2/keymaps/profanum429/readme.md | 5 + keyboards/eagle_viper/v2/matrix.c | 266 ++++++++++++++++++ keyboards/eagle_viper/v2/readme.md | 30 ++ keyboards/eagle_viper/v2/rules.mk | 72 +++++ keyboards/eagle_viper/v2/v2.c | 66 +++++ keyboards/eagle_viper/v2/v2.h | 34 +++ 18 files changed, 788 insertions(+) create mode 100644 keyboards/eagle_viper/eagle_viper.c create mode 100644 keyboards/eagle_viper/eagle_viper.h create mode 100644 keyboards/eagle_viper/readme.md create mode 100644 keyboards/eagle_viper/rules.mk create mode 100644 keyboards/eagle_viper/v2/config.h create mode 100644 keyboards/eagle_viper/v2/indicator_leds.c create mode 100644 keyboards/eagle_viper/v2/indicator_leds.h create mode 100644 keyboards/eagle_viper/v2/keymaps/default/keymap.c create mode 100644 keyboards/eagle_viper/v2/keymaps/default/readme.md create mode 100644 keyboards/eagle_viper/v2/keymaps/mechmerlin/keymap.c create mode 100644 keyboards/eagle_viper/v2/keymaps/mechmerlin/readme.md create mode 100644 keyboards/eagle_viper/v2/keymaps/profanum429/keymap.c create mode 100644 keyboards/eagle_viper/v2/keymaps/profanum429/readme.md create mode 100644 keyboards/eagle_viper/v2/matrix.c create mode 100644 keyboards/eagle_viper/v2/readme.md create mode 100644 keyboards/eagle_viper/v2/rules.mk create mode 100644 keyboards/eagle_viper/v2/v2.c create mode 100644 keyboards/eagle_viper/v2/v2.h diff --git a/keyboards/eagle_viper/eagle_viper.c b/keyboards/eagle_viper/eagle_viper.c new file mode 100644 index 00000000000..c2d44c4e7ea --- /dev/null +++ b/keyboards/eagle_viper/eagle_viper.c @@ -0,0 +1 @@ +#include "eagle_viper.h" diff --git a/keyboards/eagle_viper/eagle_viper.h b/keyboards/eagle_viper/eagle_viper.h new file mode 100644 index 00000000000..fc34e7dde84 --- /dev/null +++ b/keyboards/eagle_viper/eagle_viper.h @@ -0,0 +1,10 @@ +#ifndef EAGLE_VIPER_H +#define EAGLE_VIPER_H + +#include "quantum.h" + +#ifdef KEYBOARD_eagle_viper_v2 + #include "v2.h" +#endif + +#endif diff --git a/keyboards/eagle_viper/readme.md b/keyboards/eagle_viper/readme.md new file mode 100644 index 00000000000..48f4a4be33d --- /dev/null +++ b/keyboards/eagle_viper/readme.md @@ -0,0 +1,12 @@ +# Duck Eagle/Viper + +Non official firmware for custom Korean keyboard with 60% key layout made by Duck. + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. + +Newest version is the [Eagle/Viper V2](http://duck0113.tistory.com/127) + +Make example for this keyboard (after setting up your build environment): + + make eagle_viper/v2:default + diff --git a/keyboards/eagle_viper/rules.mk b/keyboards/eagle_viper/rules.mk new file mode 100644 index 00000000000..ba2241fa8cc --- /dev/null +++ b/keyboards/eagle_viper/rules.mk @@ -0,0 +1 @@ +DEFAULT_FOLDER = eagle_viper/v2 diff --git a/keyboards/eagle_viper/v2/config.h b/keyboards/eagle_viper/v2/config.h new file mode 100644 index 00000000000..0538f96203b --- /dev/null +++ b/keyboards/eagle_viper/v2/config.h @@ -0,0 +1,54 @@ +/* +Copyright 2017 MechMerlin + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6050 +#define DEVICE_VER 0x0104 +#define MANUFACTURER Duck +#define PRODUCT Eagle/Viper V2 +#define DESCRIPTION 60% Korean custom keyboard + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 + +#define DIODE_DIRECTION COL2ROW + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 1 + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +#define RGBLIGHT_ANIMATIONS +#define RGB_DI_PIN D6 +#define RGBLED_NUM 17 + +#define TAPPING_TERM 200 + +#endif diff --git a/keyboards/eagle_viper/v2/indicator_leds.c b/keyboards/eagle_viper/v2/indicator_leds.c new file mode 100644 index 00000000000..03a93197da6 --- /dev/null +++ b/keyboards/eagle_viper/v2/indicator_leds.c @@ -0,0 +1,89 @@ +/* +Copyright 2017 MechMerlin + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include +#include +#include +#include +#include "indicator_leds.h" + +#define RES 6000 + +#define LED_T1H 600 +#define LED_T1L 650 +#define LED_T0H 250 +#define LED_T0L 1000 + +#define NS_PER_SEC (1000000000L) +#define CYCLES_PER_SEC (F_CPU) +#define NS_PER_CYCLE (NS_PER_SEC / CYCLES_PER_SEC) +#define NS_TO_CYCLES(n) ((n) / NS_PER_CYCLE) + +void send_bit_d4(bool bitVal) { + if(bitVal) { + asm volatile ( + "sbi %[port], %[bit] \n\t" + ".rept %[onCycles] \n\t" + "nop \n\t" + ".endr \n\t" + "cbi %[port], %[bit] \n\t" + ".rept %[offCycles] \n\t" + "nop \n\t" + ".endr \n\t" + :: + [port] "I" (_SFR_IO_ADDR(PORTD)), + [bit] "I" (4), + [onCycles] "I" (NS_TO_CYCLES(LED_T1H) - 2), + [offCycles] "I" (NS_TO_CYCLES(LED_T1L) - 2)); + } else { + asm volatile ( + "sbi %[port], %[bit] \n\t" + ".rept %[onCycles] \n\t" + "nop \n\t" + ".endr \n\t" + "cbi %[port], %[bit] \n\t" + ".rept %[offCycles] \n\t" + "nop \n\t" + ".endr \n\t" + :: + [port] "I" (_SFR_IO_ADDR(PORTD)), + [bit] "I" (4), + [onCycles] "I" (NS_TO_CYCLES(LED_T0H) - 2), + [offCycles] "I" (NS_TO_CYCLES(LED_T0L) - 2)); + } +} + +void show(void) { + _delay_us((RES / 1000UL) + 1); +} + +void send_value(uint8_t byte) { + for(uint8_t b = 0; b < 8; b++) { + send_bit_d4(byte & 0b10000000); + byte <<= 1; + } +} + +// Send the LED indicators to the WS2811S chips +void indicator_leds_set(bool leds[8]) { + uint8_t led_cnt; + + cli(); + for(led_cnt = 0; led_cnt < 8; led_cnt++) + send_value(leds[led_cnt] ? 255 : 0); + sei(); + show(); +} diff --git a/keyboards/eagle_viper/v2/indicator_leds.h b/keyboards/eagle_viper/v2/indicator_leds.h new file mode 100644 index 00000000000..c174fa404da --- /dev/null +++ b/keyboards/eagle_viper/v2/indicator_leds.h @@ -0,0 +1,2 @@ +void indicator_leds_set(bool leds[8]); +void show(void); diff --git a/keyboards/eagle_viper/v2/keymaps/default/keymap.c b/keyboards/eagle_viper/v2/keymaps/default/keymap.c new file mode 100644 index 00000000000..c76eaa7be4d --- /dev/null +++ b/keyboards/eagle_viper/v2/keymaps/default/keymap.c @@ -0,0 +1,37 @@ +/* Copyright 2017 MechMerlin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "eagle_viper.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* layer 0: qwerty */ + [0] = KEYMAP(\ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_NO, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENT, + KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_NO, KC_RALT, KC_RGUI, KC_RCTL), + + [1] = KEYMAP(\ + KC_TRNS, RGB_TOG, RGB_MOD, RGB_VAI, 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, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + }; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + return MACRO_NONE; +}; diff --git a/keyboards/eagle_viper/v2/keymaps/default/readme.md b/keyboards/eagle_viper/v2/keymaps/default/readme.md new file mode 100644 index 00000000000..834ff7cd3a6 --- /dev/null +++ b/keyboards/eagle_viper/v2/keymaps/default/readme.md @@ -0,0 +1,10 @@ +# Default Eagle Layout + +This is the default implement layout for Duck Eagle V2. + +![Duck Eagle V2 Default Layout](https://imgur.com/mWBY3Dc.png) + + +## Features + +* Default QWERTY layer diff --git a/keyboards/eagle_viper/v2/keymaps/mechmerlin/keymap.c b/keyboards/eagle_viper/v2/keymaps/mechmerlin/keymap.c new file mode 100644 index 00000000000..2dc3f0190f6 --- /dev/null +++ b/keyboards/eagle_viper/v2/keymaps/mechmerlin/keymap.c @@ -0,0 +1,44 @@ +/* Copyright 2017 MechMerlin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "eagle_viper.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* layer 0: qwerty */ + [0] = KEYMAP(\ + KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_NO, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENT, + KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_NO, KC_RALT, KC_RGUI, KC_RCTL), + + [1] = KEYMAP(\ + KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_DEL, + RGB_TOG, RGB_MOD, RGB_VAI, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_TRNS, KC_TRNS, + KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_END, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_PGDN, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, TG(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + + [2] = KEYMAP(\ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_LEFT, KC_DOWN, KC_RIGHT), + }; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + return MACRO_NONE; +}; diff --git a/keyboards/eagle_viper/v2/keymaps/mechmerlin/readme.md b/keyboards/eagle_viper/v2/keymaps/mechmerlin/readme.md new file mode 100644 index 00000000000..2e878469642 --- /dev/null +++ b/keyboards/eagle_viper/v2/keymaps/mechmerlin/readme.md @@ -0,0 +1,15 @@ +MechMerlin's Duck Eagle V2 Layout +====================== + +This is the preferred 60% layout used by u/merlin36, host of the MechMerlin YouTube channel. + +![Duck Eagle V2 Layout](https://imgur.com/FRcsmJc.png) + +## Keymap Notes +- Highly influenced by the KBP V60 and WKL B.Face standard layouts +- Does not support any form of inswitch lighting as Merlin hates them. +- Arrow toggle switch is FN + Space +- Reset is FN + R + +### Build +To build this keymap, simply run `make eagle_viper/v2:mechmerlin` from the qmk_firmware directory. \ No newline at end of file diff --git a/keyboards/eagle_viper/v2/keymaps/profanum429/keymap.c b/keyboards/eagle_viper/v2/keymaps/profanum429/keymap.c new file mode 100644 index 00000000000..4141f612285 --- /dev/null +++ b/keyboards/eagle_viper/v2/keymaps/profanum429/keymap.c @@ -0,0 +1,40 @@ +/* Copyright 2017 MechMerlin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "eagle_viper.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* layer 0: qwerty */ + [0] = KEYMAP(\ + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENT, + KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1), + KC_NO, KC_LGUI, KC_LALT, KC_SPC, KC_NO, KC_NO, KC_RALT, KC_RGUI, KC_NO), + + [1] = KEYMAP(\ + KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, + KC_CAPS, RGB_TOG, RGB_MOD, RGB_VAI, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_BSPC, + KC_TRNS, KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RIGHT, KC_TRNS, KC_ENT, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + }; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + return MACRO_NONE; +}; + + + diff --git a/keyboards/eagle_viper/v2/keymaps/profanum429/readme.md b/keyboards/eagle_viper/v2/keymaps/profanum429/readme.md new file mode 100644 index 00000000000..0f993559eae --- /dev/null +++ b/keyboards/eagle_viper/v2/keymaps/profanum429/readme.md @@ -0,0 +1,5 @@ +# Profanum429 Duck Viper V2 Layout +TODO + +## Features +TODO diff --git a/keyboards/eagle_viper/v2/matrix.c b/keyboards/eagle_viper/v2/matrix.c new file mode 100644 index 00000000000..c93766d1bcf --- /dev/null +++ b/keyboards/eagle_viper/v2/matrix.c @@ -0,0 +1,266 @@ +/* +Copyright 2017 MechMerlin +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include +#include +#include +#include "matrix.h" +#include "util.h" +#include "print.h" +#include "debug.h" + +static uint8_t debouncing = DEBOUNCING_DELAY; + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +static uint8_t read_rows(uint8_t col); +static void init_rows(void); +static void unselect_cols(void); +static void select_col(uint8_t col); + +__attribute__ ((weak)) +void matrix_init_quantum(void) { + matrix_init_kb(); +} + +__attribute__ ((weak)) +void matrix_scan_quantum(void) { + matrix_scan_kb(); +} + +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +__attribute__ ((weak)) +void matrix_init_user(void) { +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { +} + +void backlight_init_ports(void) +{ + DDRD |= 0b11010000; + PORTD &= ~0b01010000; + PORTD |= 0b10000000; + DDRB |= 0b00011111; + PORTB &= ~0b00001110; + PORTB |= 0b00010001; + DDRE |= 0b01000000; + PORTE &= ~0b01000000; +} + +void matrix_init(void) { + backlight_init_ports(); + unselect_cols(); + init_rows(); + + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } + + matrix_init_quantum(); +} + +uint8_t matrix_scan(void) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + select_col(col); + _delay_us(3); + + uint8_t rows = read_rows(col); + + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1< + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "v2.h" +#include "indicator_leds.h" + +enum BACKLIGHT_AREAS { + BACKLIGHT_ALPHA = 0b0000001, + BACKLIGHT_EXTRA = 0b0000010, + BACKLIGHT_MODNUM = 0b0000100, + BACKLIGHT_FROW = 0b0001000, + BACKLIGHT_RGB = 0b0010000, + BACKLIGHT_SWITCH = 0b0001111 +}; + +uint8_t backlight_rgb_r = 255; +uint8_t backlight_rgb_g = 0; +uint8_t backlight_rgb_b = 0; + +void backlight_set(uint8_t level) { +/* + * DISABLE for now -> this causes issues with initial rgb setup + */ + +/* + level & BACKLIGHT_ALPHA ? (PORTB |= 0b00000010) : (PORTB &= ~0b00000010); + level & BACKLIGHT_EXTRA ? (PORTB |= 0b00000100) : (PORTB &= ~0b00000100); + level & BACKLIGHT_MODNUM ? (PORTB |= 0b00001000) : (PORTB &= ~0b00001000); + level & BACKLIGHT_FROW ? (PORTE |= 0b01000000) : (PORTE &= ~0b01000000); + level & BACKLIGHT_RGB ? backlight_toggle_rgb(true) : backlight_toggle_rgb(false); +*/ +} + +// Port from backlight_update_state +void led_set_kb(uint8_t usb_led) { + bool status[8] = { + host_keyboard_leds() & (1< + * + * 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 . + */ +#ifndef V2_H +#define V2_H + +#include "../eagle_viper.h" + +#define KEYMAP( \ + K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, \ + K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, \ + K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2O, \ + K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1O, \ + K0A, K0B, K0C, K0J, K0K, K0L, K0M, K0N, K0O \ +) { \ + { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, }, \ + { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, KC_NO, K3O, }, \ + { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, KC_NO, K2O, }, \ + { K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, KC_NO, K1M, K1N, K1O, }, \ + { K0A, K0B, K0C, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K0J, KC_NO, K0K, K0L, K0M, K0N, K0O } \ +} +#endif