diff options
author | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-10-04 22:06:57 -0700 |
---|---|---|
committer | noroadsleft <18669334+noroadsleft@users.noreply.github.com> | 2019-10-04 22:06:57 -0700 |
commit | 60b2a9a5ea88321629e970e936652cc1ba786b80 (patch) | |
tree | e2d35cd155cdc334ead653a9699ff2ae7dcde6a0 /keyboards | |
parent | 537623c9db15e29889c1c78e55ebcbba13edbabb (diff) |
[Keyboard] Preliminary Support for Duck Orion V3 (#6892)
* initial commit
* fixup init_rows and read_rows routine
* fixup matrix based on Marcus's tracing info
* add a temporary keymap
* add notes
* use a standard tkl ansi keymap
* turn on that last column
* backslash and backspace row left to fix
* reorg from backslash to pgdn
* got the matrix done but the backspace location at K4N is still suspect
* add reset info into readme
* add qmk configurator support
* add community layout support
* remove uneeded keymap readme
* add a new column just for the reset switch
* change copyright dates
* add cautionary message to readme as we don't know about the lighting condition yet
* Update keyboards/duck/orion/v3/v3.c
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Update keyboards/duck/orion/v3/v3.c
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Update keyboards/duck/orion/v3/v3.c
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* change bootloader comments
Diffstat (limited to 'keyboards')
-rw-r--r-- | keyboards/duck/orion/info.json | 12 | ||||
-rw-r--r-- | keyboards/duck/orion/readme.md | 7 | ||||
-rw-r--r-- | keyboards/duck/orion/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/config.h | 50 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/indicator_leds.c | 82 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/indicator_leds.h | 1 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/keymaps/default/keymap.c | 26 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/matrix.c | 272 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/readme.md | 30 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/rules.mk | 39 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/v3.c | 65 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/v3.h | 36 |
12 files changed, 621 insertions, 0 deletions
diff --git a/keyboards/duck/orion/info.json b/keyboards/duck/orion/info.json new file mode 100644 index 0000000000..a1f0a5b389 --- /dev/null +++ b/keyboards/duck/orion/info.json @@ -0,0 +1,12 @@ +{ + "keyboard_name": "Duck Orion V3", + "url": "", + "maintainer": "qmk", + "width": 18.25, + "height": 6.5, + "layouts": { + "LAYOUT_tkl_ansi": { + "layout": [{"x":0, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6.5, "y":0}, {"x":7.5, "y":0}, {"x":8.5, "y":0}, {"x":9.5, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":15.25, "y":0}, {"x":16.25, "y":0}, {"x":17.25, "y":0}, {"x":0, "y":1.5}, {"x":1, "y":1.5}, {"x":2, "y":1.5}, {"x":3, "y":1.5}, {"x":4, "y":1.5}, {"x":5, "y":1.5}, {"x":6, "y":1.5}, {"x":7, "y":1.5}, {"x":8, "y":1.5}, {"x":9, "y":1.5}, {"x":10, "y":1.5}, {"x":11, "y":1.5}, {"x":12, "y":1.5}, {"x":13, "y":1.5, "w":2}, {"x":15.25, "y":1.5}, {"x":16.25, "y":1.5}, {"x":17.25, "y":1.5}, {"x":0, "y":2.5, "w":1.5}, {"x":1.5, "y":2.5}, {"x":2.5, "y":2.5}, {"x":3.5, "y":2.5}, {"x":4.5, "y":2.5}, {"x":5.5, "y":2.5}, {"x":6.5, "y":2.5}, {"x":7.5, "y":2.5}, {"x":8.5, "y":2.5}, {"x":9.5, "y":2.5}, {"x":10.5, "y":2.5}, {"x":11.5, "y":2.5}, {"x":12.5, "y":2.5}, {"x":13.5, "y":2.5, "w":1.5}, {"x":15.25, "y":2.5}, {"x":16.25, "y":2.5}, {"x":17.25, "y":2.5}, {"x":0, "y":3.5, "w":1.75}, {"x":1.75, "y":3.5}, {"x":2.75, "y":3.5}, {"x":3.75, "y":3.5}, {"x":4.75, "y":3.5}, {"x":5.75, "y":3.5}, {"x":6.75, "y":3.5}, {"x":7.75, "y":3.5}, {"x":8.75, "y":3.5}, {"x":9.75, "y":3.5}, {"x":10.75, "y":3.5}, {"x":11.75, "y":3.5}, {"x":12.75, "y":3.5, "w":2.25}, {"x":0, "y":4.5, "w":2.25}, {"x":2.25, "y":4.5}, {"x":3.25, "y":4.5}, {"x":4.25, "y":4.5}, {"x":5.25, "y":4.5}, {"x":6.25, "y":4.5}, {"x":7.25, "y":4.5}, {"x":8.25, "y":4.5}, {"x":9.25, "y":4.5}, {"x":10.25, "y":4.5}, {"x":11.25, "y":4.5}, {"x":12.25, "y":4.5, "w":2.75}, {"x":16.25, "y":4.5}, {"x":0, "y":5.5, "w":1.25}, {"x":1.25, "y":5.5, "w":1.25}, {"x":2.5, "y":5.5, "w":1.25}, {"x":3.75, "y":5.5, "w":6.25}, {"x":10, "y":5.5, "w":1.25}, {"x":11.25, "y":5.5, "w":1.25}, {"x":12.5, "y":5.5, "w":1.25}, {"x":13.75, "y":5.5, "w":1.25}, {"x":15.25, "y":5.5}, {"x":16.25, "y":5.5}, {"x":17.25, "y":5.5}] + } + } +}
\ No newline at end of file diff --git a/keyboards/duck/orion/readme.md b/keyboards/duck/orion/readme.md new file mode 100644 index 0000000000..b65901de16 --- /dev/null +++ b/keyboards/duck/orion/readme.md @@ -0,0 +1,7 @@ +# Duck Orion + +Non official firmware for custom TKL Korean keyboard made by Duck. + +Newest version is the [Orion V3](http://duck0113.tistory.com/127) + +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/duck/orion/rules.mk b/keyboards/duck/orion/rules.mk new file mode 100644 index 0000000000..3788e0fbfb --- /dev/null +++ b/keyboards/duck/orion/rules.mk @@ -0,0 +1 @@ +DEFAULT_FOLDER = duck/orion/v3 diff --git a/keyboards/duck/orion/v3/config.h b/keyboards/duck/orion/v3/config.h new file mode 100644 index 0000000000..3a17d59416 --- /dev/null +++ b/keyboards/duck/orion/v3/config.h @@ -0,0 +1,50 @@ +/* +Copyright 2019 MechMerlin <mechmerlin@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 "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x444B // Duck ("DK") +#define PRODUCT_ID 0x4F52 // Orion ("OR") +#define DEVICE_VER 0x0002 +#define MANUFACTURER Duck +#define PRODUCT Orion V3 +#define DESCRIPTION TKL Korean custom keyboard + +/* key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 18 + +#define DIODE_DIRECTION COL2ROW + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 3 + +#define RGBLIGHT_ANIMATIONS +#define RGB_DI_PIN D6 +#define RGBLED_NUM 17 + +/* Set to top left most key */ +#define BOOTMAGIC_LITE_ROW 4 +#define BOOTMAGIC_LITE_COLUMN 10 + +#define TAPPING_TERM 200 diff --git a/keyboards/duck/orion/v3/indicator_leds.c b/keyboards/duck/orion/v3/indicator_leds.c new file mode 100644 index 0000000000..951ef462c6 --- /dev/null +++ b/keyboards/duck/orion/v3/indicator_leds.c @@ -0,0 +1,82 @@ +/* +Copyright 2019 MechMerlin <mechmerlin@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 <avr/interrupt.h> +#include <avr/io.h> +#include <stdbool.h> +#include <util/delay.h> +#include "indicator_leds.h" +#include "duck_led/duck_led.h" + +#define LED_T1H 600 +#define LED_T1L 650 +#define LED_T0H 250 +#define LED_T0L 1000 + +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 send_value(uint8_t byte, enum Device device) { + for(uint8_t b = 0; b < 8; b++) { + if(device == Device_STATUSLED) { + 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, Device_STATUSLED); + sei(); + show(); +} + diff --git a/keyboards/duck/orion/v3/indicator_leds.h b/keyboards/duck/orion/v3/indicator_leds.h new file mode 100644 index 0000000000..fe66eef6b2 --- /dev/null +++ b/keyboards/duck/orion/v3/indicator_leds.h @@ -0,0 +1 @@ +void indicator_leds_set(bool leds[8]); diff --git a/keyboards/duck/orion/v3/keymaps/default/keymap.c b/keyboards/duck/orion/v3/keymaps/default/keymap.c new file mode 100644 index 0000000000..83fa4f9a8e --- /dev/null +++ b/keyboards/duck/orion/v3/keymaps/default/keymap.c @@ -0,0 +1,26 @@ +/* Copyright 2019 MechMerlin <mechmerlin@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 QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = LAYOUT_tkl_ansi(\ + KC_ESC, 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_PSCR,KC_SLCK,KC_PAUS, \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,KC_MINS, KC_EQL,KC_BSPC, KC_INS ,KC_HOME,KC_PGUP, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,KC_LBRC,KC_RBRC,KC_BSLS, KC_DEL ,KC_END ,KC_PGDN, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L,KC_SCLN,KC_QUOT, KC_ENT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, \ + KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, KC_APP,KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT) \ +}; diff --git a/keyboards/duck/orion/v3/matrix.c b/keyboards/duck/orion/v3/matrix.c new file mode 100644 index 0000000000..3c3240b9f4 --- /dev/null +++ b/keyboards/duck/orion/v3/matrix.c @@ -0,0 +1,272 @@ +/* +Copyright 2019 MechMerlin <mechmerlin@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 <util/delay.h> +#include <avr/io.h> +#include <stdio.h> +#include "matrix.h" +#include "util.h" +#include "print.h" +#include "debug.h" + +static uint8_t debouncing = DEBOUNCE; + +/* 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_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<<col); + bool curr_bit = rows & (1<<row); + if (prev_bit != curr_bit) { + matrix_debouncing[row] ^= ((matrix_row_t)1<<col); + if (debouncing) { + dprint("bounce!: "); dprintf("%02X", debouncing); dprintln(); + } + debouncing = DEBOUNCE; + } + } + unselect_cols(); + } + + if (debouncing) { + if (--debouncing) { + _delay_ms(1); + } else { + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = matrix_debouncing[i]; + } + } + } + + matrix_scan_quantum(); + return 1; +} + +inline matrix_row_t matrix_get_row(uint8_t row) { + return matrix[row]; +} + +void matrix_print(void) { + print("\nr/c 0123456789ABCDEF\n"); + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row))); + } +} + +/* Row pin configuration - diode connected + * row: 0 1 2 3 4 5 + * pin: PD0 PD1 PD2 PD3 PD5 PB7 + * + * Backspace uses its own pin PE2 on the column pin, row pin is grounded + */ +static void init_rows(void) { + DDRD &= ~0b00101111; + PORTD &= ~0b00101111; + + DDRB &= ~0b10000000; + PORTB &= ~0b10000000; + + DDRE &= ~0b00000100; + PORTE |= 0b00000100; +} + +static uint8_t read_rows(uint8_t col) { + + return (PIND&(1<<0) ? (1<<0) : 0) | + (PIND&(1<<1) ? (1<<1) : 0) | + (PIND&(1<<2) ? (1<<2) : 0) | + (PIND&(1<<3) ? (1<<3) : 0) | + (PIND&(1<<5) ? (1<<4) : 0) | + (PINB&(1<<7) ? (1<<5) : 0) | + (col== 17 ? ((PINE&(1<<2) ? 0 : (1<<1))) : 0); + +} + +uint8_t read_fwkey(void) +{ + return PINE&(1<<2) ? 0 : (1<<2); +} + +/* Columns 0 - 15 + * + * atmega32u4 decoder pin + * PC6 U1 E3 + * PB6 U2 E3 + * PF0 U1, U2 A0 + * PF1 U1, U2 A1 + * PC7 U1, U2 A2 + * + * These columns uses two 74HC237D 3 to 8 bit demultiplexers. + * col / pin: PC6 PB6 PF0 PF1 PC7 Decoder Pin + * 0: 1 0 0 0 0 U1 Y0 + * 1: 1 0 1 0 0 U1 Y1 + * 2: 1 0 0 1 0 U1 Y2 + * 3: 1 0 1 1 0 U1 Y3 + * 4: 1 0 0 0 1 U1 Y4 + * 5: 1 0 1 0 1 U1 Y5 + * 6: 1 0 0 1 1 U1 Y6 + * 7: 1 0 1 1 1 U1 Y7 + * + * 8: 0 1 0 0 0 U2 Y0 + * 9: 0 1 1 0 0 U2 Y1 + * 10: 0 1 0 1 0 U2 Y2 + * 11: 0 1 1 1 0 U2 Y3 + * 12: 0 1 0 0 1 U2 Y4 + * 13: 0 1 1 0 1 U2 Y5 + * 14: 0 1 0 1 1 U2 Y6 + * 15: 0 1 1 1 1 U2 Y7 + * + */ +static void unselect_cols(void) { + DDRB |= 0b01100000; + PORTB &= ~0b01100000; + + DDRC |= 0b11000000; + PORTC &= ~0b11000000; + + DDRF |= 0b00000011; + PORTF &= ~0b00000011; +} + +static void select_col(uint8_t col) { + + switch (col) { + case 0: + PORTC |= 0b01000000; + break; + case 1: + PORTC |= 0b01000000; + PORTF |= 0b00000001; + break; + case 2: + PORTC |= 0b01000000; + PORTF |= 0b00000010; + break; + case 3: + PORTC |= 0b01000000; + PORTF |= 0b00000011; + break; + case 4: + PORTC |= 0b11000000; + break; + case 5: + PORTC |= 0b11000000; + PORTF |= 0b00000001; + break; + case 6: + PORTC |= 0b11000000; + PORTF |= 0b00000010; + break; + case 7: + PORTC |= 0b11000000; + PORTF |= 0b00000011; + break; + case 8: + PORTB |= 0b01000000; + break; + case 9: + PORTB |= 0b01000000; + PORTF |= 0b00000001; + break; + case 10: + PORTB |= 0b01000000; + PORTF |= 0b00000010; + break; + case 11: + PORTB |= 0b01000000; + PORTF |= 0b00000011; + break; + case 12: + PORTB |= 0b01000000; + PORTC |= 0b10000000; + break; + case 13: + PORTB |= 0b01000000; + PORTF |= 0b00000001; + PORTC |= 0b10000000; + break; + case 14: + PORTB |= 0b01000000; + PORTF |= 0b00000010; + PORTC |= 0b10000000; + break; + case 15: + PORTB |= 0b01000000; + PORTF |= 0b00000011; + PORTC |= 0b10000000; + break; + case 16: + PORTB |= 0b00100000; + break; + } +} diff --git a/keyboards/duck/orion/v3/readme.md b/keyboards/duck/orion/v3/readme.md new file mode 100644 index 0000000000..50032e93ee --- /dev/null +++ b/keyboards/duck/orion/v3/readme.md @@ -0,0 +1,30 @@ +# Duck Orion V3 + +Non official firmware for custom TKL Korean keyboard made by Duck. +Group buy was run December 2018 via [geekhack](https://geekhack.org/index.php?topic=98581.0) with 100 keyboards total. + +Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin) +Hardware Supported: Duck Eagle/Viper PCB Ver 2.0, Atmega32u4 +Hardware Availability: Wait until GB of the next revision + +Make example for this keyboard (after setting up your build environment): + + make duck/orion/v3:default + +**Reset Key:** To put the Orion V3 into reset, hold Backspace key (`K4N`) while plugging in. + +**CAUTION:** At this time 10/03/19 lighting has not been tested fully and may not properly work. + +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). + +## Hardware Notes + +The Orion V3 PCB consists of: + +### Microchips +2 74HC237D 3-to-8 line decoders +1 Atmega32u4 microcontroller +2 WS2811 LED controller + +## Notes +Special thanks to Marcus aka Keebology for doing this remotely and mapping the matrix.
\ No newline at end of file diff --git a/keyboards/duck/orion/v3/rules.mk b/keyboards/duck/orion/v3/rules.mk new file mode 100644 index 0000000000..a57b3d60c9 --- /dev/null +++ b/keyboards/duck/orion/v3/rules.mk @@ -0,0 +1,39 @@ +# MCU name +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 = atmel-dfu + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = 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 = yes # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches +RGBLIGHT_ENABLE = yes + +CUSTOM_MATRIX = yes +SRC += indicator_leds.c \ + matrix.c duck_led/duck_led.c + +LAYOUTS = tkl_ansi
\ No newline at end of file diff --git a/keyboards/duck/orion/v3/v3.c b/keyboards/duck/orion/v3/v3.c new file mode 100644 index 0000000000..95da4b45b6 --- /dev/null +++ b/keyboards/duck/orion/v3/v3.c @@ -0,0 +1,65 @@ +/* Copyright 2019 MechMerlin <mechmerlin@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 "v3.h" +#include "indicator_leds.h" + +enum BACKLIGHT_AREAS { + BACKLIGHT_ALPHAS = 0b00000010, + BACKLIGHT_MODNUM = 0b00001000 +}; + +void backlight_set(uint8_t level) { + switch(level) { + case 0: + PORTB |= BACKLIGHT_ALPHAS; + PORTB |= BACKLIGHT_MODNUM; + break; + case 1: + PORTB &= ~BACKLIGHT_ALPHAS; + PORTB |= BACKLIGHT_MODNUM; + break; + case 2: + PORTB |= BACKLIGHT_ALPHAS; + PORTB &= ~BACKLIGHT_MODNUM; + break; + case 3: + PORTB &= ~BACKLIGHT_ALPHAS; + PORTB &= ~BACKLIGHT_MODNUM; + break; + } +} + +// Port from backlight_update_state +void led_set_kb(uint8_t usb_led) { + bool status[8] = { + IS_HOST_LED_ON(USB_LED_SCROLL_LOCK), /* LED 3 */ + IS_HOST_LED_ON(USB_LED_CAPS_LOCK), /* LED 2 */ + IS_HOST_LED_ON(USB_LED_NUM_LOCK), /* LED 1 */ + + layer_state & (1<<2), /* LED 6 */ + layer_state & (1<<1), /* LED 5 */ + layer_state & (1<<0) ? 0: 1, /* LED 4 */ + + layer_state & (1<<5), /* LED 8 */ + layer_state & (1<<4) /* LED 7 */ + }; + + indicator_leds_set(status); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + return process_record_user(keycode, record); +} diff --git a/keyboards/duck/orion/v3/v3.h b/keyboards/duck/orion/v3/v3.h new file mode 100644 index 0000000000..70591cf034 --- /dev/null +++ b/keyboards/duck/orion/v3/v3.h @@ -0,0 +1,36 @@ +/* Copyright 2019 MechMerlin <mechmerlin@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 ___ KC_NO + +#define LAYOUT_tkl_ansi( \ + K5A, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, \ + K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4R, K4O, K4P, K4Q, \ + K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3O, K3P, K3Q, \ + K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2N, \ + K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1N, K1P, \ + K0A, K0B, K0C, K0F, K0I, K0K, K0M, K0N, K0O, K0P, K0Q \ +) { \ + { K5A, ___, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, ___ }, \ + { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, ___, K4O, K4P, K4Q, K4R }, \ + { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3O, K3P, K3Q, ___ }, \ + { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, ___, K2N, ___, ___, ___, ___ }, \ + { K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, ___, ___, K1N, ___, K1P, ___, ___ }, \ + { K0A, K0B, K0C, ___, ___, K0F, ___, ___, K0I, ___, K0K, ___, K0M, K0N, K0O, K0P, K0Q, ___ } \ +} |