diff options
author | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2018-08-26 03:00:20 +0200 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-08-26 03:00:20 +0200 |
commit | e16b39f0c20c73348ae12af0e82e4b4c0d30b393 (patch) | |
tree | 74d33ae10f38fb4fbb39ab2eaa298f9ecdd272cf /keyboards/duck | |
parent | a68057852bbffc45f783523a86a6aa2e80a03d44 (diff) | |
download | qmk_firmware-e16b39f0c20c73348ae12af0e82e4b4c0d30b393.tar.gz qmk_firmware-e16b39f0c20c73348ae12af0e82e4b4c0d30b393.tar.xz |
Keyboard: Duck Jetfire QMK Support (#3752)
* Initial Commit
Port from xauser's jetfire code. Does not compile yet
* fix up keymap from uint8 to uin16
* update rules file to contain custom matrix
* Good stopping point
Still lots of compile errors but I'm getting there.
* fix a few more compile errors
* move a few functions around to help with compiling
* Finally got it all to compile
* Get rid of that old KEYMAP macro
* edit readme
* Put my name everywhere and some minor code clean ups
* start to remove that kc nonsense
* fix keymap compilation issues
* add reset key info
* better human readable formatting
* match the duck default layout
* add confgurator support
* clarify reset key
* might be a good idea to use the correct pin
* get the riight keycode for RGB
* include an ALL layout
* I tried to fix the formatting....sigh
* add functons to ensure Configurator compile-ability
* move jetfire to duck directory
* Moved and renamed things as per Drashna's PR comments as his back was hurting as he reviewed this
Diffstat (limited to 'keyboards/duck')
-rw-r--r-- | keyboards/duck/jetfire/backlight_led.c | 129 | ||||
-rw-r--r-- | keyboards/duck/jetfire/backlight_led.h | 18 | ||||
-rw-r--r-- | keyboards/duck/jetfire/config.h | 200 | ||||
-rw-r--r-- | keyboards/duck/jetfire/info.json | 16 | ||||
-rw-r--r-- | keyboards/duck/jetfire/jetfire.c | 171 | ||||
-rw-r--r-- | keyboards/duck/jetfire/jetfire.h | 60 | ||||
-rw-r--r-- | keyboards/duck/jetfire/keymaps/default/config.h | 19 | ||||
-rw-r--r-- | keyboards/duck/jetfire/keymaps/default/keymap.c | 59 | ||||
-rw-r--r-- | keyboards/duck/jetfire/keymaps/default/readme.md | 1 | ||||
-rw-r--r-- | keyboards/duck/jetfire/matrix.c | 277 | ||||
-rw-r--r-- | keyboards/duck/jetfire/readme.md | 18 | ||||
-rw-r--r-- | keyboards/duck/jetfire/rules.mk | 74 | ||||
-rw-r--r-- | keyboards/duck/readme.md | 16 |
13 files changed, 1058 insertions, 0 deletions
diff --git a/keyboards/duck/jetfire/backlight_led.c b/keyboards/duck/jetfire/backlight_led.c new file mode 100644 index 000000000..7e9dca6e9 --- /dev/null +++ b/keyboards/duck/jetfire/backlight_led.c @@ -0,0 +1,129 @@ +/* +Copyright 2016 Ralf Schmitt <ralf@bunkertor.net> +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 <stdint.h> +#include "backlight_led.h" +#include "quantum.h" +// #include "led.h" + + +#define T1H 900 +#define T1L 600 +#define T0H 400 +#define T0L 900 +#define RES 6000 + +#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(T1H) - 2), + [offCycles] "I" (NS_TO_CYCLES(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(T0H) - 2), + [offCycles] "I" (NS_TO_CYCLES(T0L) - 2)); + } +} + +void send_bit_d6(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" (6), + [onCycles] "I" (NS_TO_CYCLES(T1H) - 2), + [offCycles] "I" (NS_TO_CYCLES(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" (6), + [onCycles] "I" (NS_TO_CYCLES(T0H) - 2), + [offCycles] "I" (NS_TO_CYCLES(T0L) - 2)); + } +} + +void show(void) +{ + _delay_us((RES / 1000UL) + 1); +} + +void send_value(uint8_t byte, enum Device device) +{ + for(uint8_t b = 0; b < 8; b++) { + if(device == Device_STATELED) { + send_bit_d4(byte & 0b10000000); + } + if(device == Device_PCBRGB) { + send_bit_d6(byte & 0b10000000); + } + byte <<= 1; + } +} + +void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device) +{ + send_value(g, device); + send_value(r, device); + send_value(b, device); +} diff --git a/keyboards/duck/jetfire/backlight_led.h b/keyboards/duck/jetfire/backlight_led.h new file mode 100644 index 000000000..36d8d9aa9 --- /dev/null +++ b/keyboards/duck/jetfire/backlight_led.h @@ -0,0 +1,18 @@ +#ifndef BACKLIGHT_LED_H +#define BACKLIGHT_LED_H + +enum Device { + Device_PCBRGB, + Device_STATELED +}; + +void backlight_init_ports(void); +void backlight_set_state(bool cfg[7]); +void backlight_update_state(void); +void backlight_toggle_rgb(bool enabled); +void backlight_set_rgb(uint8_t cfg[17][3]); +void backlight_set(uint8_t level); +void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device); +void show(void); + +#endif diff --git a/keyboards/duck/jetfire/config.h b/keyboards/duck/jetfire/config.h new file mode 100644 index 000000000..80b531fd5 --- /dev/null +++ b/keyboards/duck/jetfire/config.h @@ -0,0 +1,200 @@ +/* +Copyright 2018 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 <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#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 Jetfire +#define DESCRIPTION A custom keyboard + +/* key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 20 + +/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ +#define DIODE_DIRECTION COL2ROW + + +#define BACKLIGHT_LEVELS 1 + +#define RGB_DI_PIN D6 +// #ifdef RGB_DI_PIN +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 23 +// #define RGBLIGHT_HUE_STEP 8 +// #define RGBLIGHT_SAT_STEP 8 +// #define RGBLIGHT_VAL_STEP 8 +// #endif + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + + +/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. + * This is userful for the Windows task manager shortcut (ctrl+shift+esc). + */ +// #define GRAVE_ESC_CTRL_OVERRIDE + +/* + * 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 + +/* + * Magic Key Options + * + * Magic keys are hotkey commands that allow control over firmware functions of + * the keyboard. They are best used in combination with the HID Listen program, + * found here: https://www.pjrc.com/teensy/hid_listen.html + * + * The options below allow the magic key functionality to be changed. This is + * useful if your keyboard/keypad is missing keys and you want magic key support. + * + */ + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* control how magic key switches layers */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false + +/* override magic key keymap */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM +//#define MAGIC_KEY_HELP1 H +//#define MAGIC_KEY_HELP2 SLASH +//#define MAGIC_KEY_DEBUG D +//#define MAGIC_KEY_DEBUG_MATRIX X +//#define MAGIC_KEY_DEBUG_KBD K +//#define MAGIC_KEY_DEBUG_MOUSE M +//#define MAGIC_KEY_VERSION V +//#define MAGIC_KEY_STATUS S +//#define MAGIC_KEY_CONSOLE C +//#define MAGIC_KEY_LAYER0_ALT1 ESC +//#define MAGIC_KEY_LAYER0_ALT2 GRAVE +//#define MAGIC_KEY_LAYER0 0 +//#define MAGIC_KEY_LAYER1 1 +//#define MAGIC_KEY_LAYER2 2 +//#define MAGIC_KEY_LAYER3 3 +//#define MAGIC_KEY_LAYER4 4 +//#define MAGIC_KEY_LAYER5 5 +//#define MAGIC_KEY_LAYER6 6 +//#define MAGIC_KEY_LAYER7 7 +//#define MAGIC_KEY_LAYER8 8 +//#define MAGIC_KEY_LAYER9 9 +//#define MAGIC_KEY_BOOTLOADER PAUSE +//#define MAGIC_KEY_LOCK CAPS +//#define MAGIC_KEY_EEPROM E +//#define MAGIC_KEY_NKRO N +//#define MAGIC_KEY_SLEEP_LED Z + +/* + * 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 + +/* + * HD44780 LCD Display Configuration + */ +/* +#define LCD_LINES 2 //< number of visible lines of the display +#define LCD_DISP_LENGTH 16 //< visibles characters per line of the display + +#define LCD_IO_MODE 1 //< 0: memory mapped mode, 1: IO port mode + +#if LCD_IO_MODE +#define LCD_PORT PORTB //< port for the LCD lines +#define LCD_DATA0_PORT LCD_PORT //< port for 4bit data bit 0 +#define LCD_DATA1_PORT LCD_PORT //< port for 4bit data bit 1 +#define LCD_DATA2_PORT LCD_PORT //< port for 4bit data bit 2 +#define LCD_DATA3_PORT LCD_PORT //< port for 4bit data bit 3 +#define LCD_DATA0_PIN 4 //< pin for 4bit data bit 0 +#define LCD_DATA1_PIN 5 //< pin for 4bit data bit 1 +#define LCD_DATA2_PIN 6 //< pin for 4bit data bit 2 +#define LCD_DATA3_PIN 7 //< pin for 4bit data bit 3 +#define LCD_RS_PORT LCD_PORT //< port for RS line +#define LCD_RS_PIN 3 //< pin for RS line +#define LCD_RW_PORT LCD_PORT //< port for RW line +#define LCD_RW_PIN 2 //< pin for RW line +#define LCD_E_PORT LCD_PORT //< port for Enable line +#define LCD_E_PIN 1 //< pin for Enable line +#endif +*/ + diff --git a/keyboards/duck/jetfire/info.json b/keyboards/duck/jetfire/info.json new file mode 100644 index 000000000..db39529ac --- /dev/null +++ b/keyboards/duck/jetfire/info.json @@ -0,0 +1,16 @@ +{ + "keyboard_name": "Jetfire", + "url": "", + "maintainer": "qmk", + "width": 20.5, + "height": 6.5, + "layouts": { + "LAYOUT_all": { + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":2, "y":0}, {"label":"F2", "x":3, "y":0}, {"label":"F3", "x":4, "y":0}, {"label":"F4", "x":5, "y":0}, {"label":"F5", "x":6.5, "y":0}, {"label":"F6", "x":7.5, "y":0}, {"label":"F7", "x":8.5, "y":0}, {"label":"F8", "x":9.5, "y":0}, {"label":"F9", "x":11, "y":0}, {"label":"F10", "x":12, "y":0}, {"label":"F11", "x":13, "y":0}, {"label":"F12", "x":14, "y":0}, {"x":15.25, "y":0}, {"label":"PrtSc", "x":16.5, "y":0}, {"label":"Scroll Lock", "x":17.5, "y":0}, {"label":"Pause", "x":18.5, "y":0}, {"x":19.5, "y":0}, {"label":"~", "x":0, "y":1.25}, {"label":"!", "x":1, "y":1.25}, {"label":"@", "x":2, "y":1.25}, {"label":"#", "x":3, "y":1.25}, {"label":"$", "x":4, "y":1.25}, {"label":"%", "x":5, "y":1.25}, {"label":"^", "x":6, "y":1.25}, {"label":"&", "x":7, "y":1.25}, {"label":"*", "x":8, "y":1.25}, {"label":"(", "x":9, "y":1.25}, {"label":")", "x":10, "y":1.25}, {"label":"_", "x":11, "y":1.25}, {"label":"+", "x":12, "y":1.25}, {"x":13, "y":1.25}, {"x":14, "y":1.25}, {"label":"Insert", "x":15.25, "y":1.25}, {"label":"Num Lock", "x":16.5, "y":1.25}, {"label":"/", "x":17.5, "y":1.25}, {"label":"*", "x":18.5, "y":1.25}, {"label":"-", "x":19.5, "y":1.25}, {"label":"Tab", "x":0, "y":2.25, "w":1.5}, {"label":"Q", "x":1.5, "y":2.25}, {"label":"W", "x":2.5, "y":2.25}, {"label":"E", "x":3.5, "y":2.25}, {"label":"R", "x":4.5, "y":2.25}, {"label":"T", "x":5.5, "y":2.25}, {"label":"Y", "x":6.5, "y":2.25}, {"label":"U", "x":7.5, "y":2.25}, {"label":"I", "x":8.5, "y":2.25}, {"label":"O", "x":9.5, "y":2.25}, {"label":"P", "x":10.5, "y":2.25}, {"label":"{", "x":11.5, "y":2.25}, {"label":"}", "x":12.5, "y":2.25}, {"label":"|", "x":13.5, "y":2.25, "w":1.5}, {"label":"Delete", "x":15.25, "y":2.25}, {"label":"7", "x":16.5, "y":2.25}, {"label":"8", "x":17.5, "y":2.25}, {"label":"9", "x":18.5, "y":2.25}, {"label":"+", "x":19.5, "y":2.25}, {"label":"Caps Lock", "x":0, "y":3.25, "w":1.75}, {"label":"A", "x":1.75, "y":3.25}, {"label":"S", "x":2.75, "y":3.25}, {"label":"D", "x":3.75, "y":3.25}, {"label":"F", "x":4.75, "y":3.25}, {"label":"G", "x":5.75, "y":3.25}, {"label":"H", "x":6.75, "y":3.25}, {"label":"J", "x":7.75, "y":3.25}, {"label":"K", "x":8.75, "y":3.25}, {"label":"L", "x":9.75, "y":3.25}, {"label":":", "x":10.75, "y":3.25}, {"label":"\"", "x":11.75, "y":3.25}, {"label":"Enter", "x":12.75, "y":3.25, "w":2.25}, {"label":"4", "x":16.5, "y":3.25}, {"label":"5", "x":17.5, "y":3.25}, {"label":"6", "x":18.5, "y":3.25}, {"x":19.5, "y":3.25}, {"label":"Shift", "x":0, "y":4.25, "w":1.25}, {"x":1.25, "y":4.25}, {"label":"Z", "x":2.25, "y":4.25}, {"label":"X", "x":3.25, "y":4.25}, {"label":"C", "x":4.25, "y":4.25}, {"label":"V", "x":5.25, "y":4.25}, {"label":"B", "x":6.25, "y":4.25}, {"label":"N", "x":7.25, "y":4.25}, {"label":"M", "x":8.25, "y":4.25}, {"label":"<", "x":9.25, "y":4.25}, {"label":">", "x":10.25, "y":4.25}, {"label":"?", "x":11.25, "y":4.25}, {"label":"Shift", "x":12.25, "y":4.25, "w":1.75}, {"x":14, "y":4.25}, {"label":"1", "x":16.5, "y":4.25}, {"label":"2", "x":17.5, "y":4.25}, {"label":"3", "x":18.5, "y":4.25}, {"label":"Enter", "x":19.5, "y":4.25}, {"label":"\u2191", "x":15.25, "y":4.5}, {"label":"Ctrl", "x":0, "y":5.25, "w":1.5}, {"label":"Win", "x":1.5, "y":5.25}, {"label":"Alt", "x":2.5, "y":5.25, "w":1.5}, {"x":4, "y":5.25, "w":7}, {"label":"Alt", "x":11, "y":5.25}, {"label":"Menu", "x":12, "y":5.25}, {"x":13, "y":5.25}, {"label":"0", "x":17.5, "y":5.25}, {"label":".", "x":18.5, "y":5.25}, {"x":19.5, "y":5.25}, {"label":"\u2190", "x":14.25, "y":5.5}, {"label":"\u2193", "x":15.25, "y":5.5}, {"label":"\u2192", "x":16.25, "y":5.5}] + }, + + "LAYOUT": { + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":2, "y":0}, {"label":"F2", "x":3, "y":0}, {"label":"F3", "x":4, "y":0}, {"label":"F4", "x":5, "y":0}, {"label":"F5", "x":6.5, "y":0}, {"label":"F6", "x":7.5, "y":0}, {"label":"F7", "x":8.5, "y":0}, {"label":"F8", "x":9.5, "y":0}, {"label":"F9", "x":11, "y":0}, {"label":"F10", "x":12, "y":0}, {"label":"F11", "x":13, "y":0}, {"label":"F12", "x":14, "y":0}, {"x":15.25, "y":0}, {"label":"PrtSc", "x":16.5, "y":0}, {"label":"Scroll Lock", "x":17.5, "y":0}, {"label":"Pause", "x":18.5, "y":0}, {"x":19.5, "y":0}, {"label":"~", "x":0, "y":1.25}, {"label":"!", "x":1, "y":1.25}, {"label":"@", "x":2, "y":1.25}, {"label":"#", "x":3, "y":1.25}, {"label":"$", "x":4, "y":1.25}, {"label":"%", "x":5, "y":1.25}, {"label":"^", "x":6, "y":1.25}, {"label":"&", "x":7, "y":1.25}, {"label":"*", "x":8, "y":1.25}, {"label":"(", "x":9, "y":1.25}, {"label":")", "x":10, "y":1.25}, {"label":"_", "x":11, "y":1.25}, {"label":"+", "x":12, "y":1.25}, {"label":"Backspace", "x":13, "y":1.25, "w":2}, {"label":"Insert", "x":15.25, "y":1.25}, {"label":"Num Lock", "x":16.5, "y":1.25}, {"label":"/", "x":17.5, "y":1.25}, {"label":"*", "x":18.5, "y":1.25}, {"label":"-", "x":19.5, "y":1.25}, {"label":"Tab", "x":0, "y":2.25, "w":1.5}, {"label":"Q", "x":1.5, "y":2.25}, {"label":"W", "x":2.5, "y":2.25}, {"label":"E", "x":3.5, "y":2.25}, {"label":"R", "x":4.5, "y":2.25}, {"label":"T", "x":5.5, "y":2.25}, {"label":"Y", "x":6.5, "y":2.25}, {"label":"U", "x":7.5, "y":2.25}, {"label":"I", "x":8.5, "y":2.25}, {"label":"O", "x":9.5, "y":2.25}, {"label":"P", "x":10.5, "y":2.25}, {"label":"{", "x":11.5, "y":2.25}, {"label":"}", "x":12.5, "y":2.25}, {"label":"|", "x":13.5, "y":2.25, "w":1.5}, {"label":"Delete", "x":15.25, "y":2.25}, {"label":"7", "x":16.5, "y":2.25}, {"label":"8", "x":17.5, "y":2.25}, {"label":"9", "x":18.5, "y":2.25}, {"label":"+", "x":19.5, "y":2.25, "h":2}, {"label":"Caps Lock", "x":0, "y":3.25, "w":1.75}, {"label":"A", "x":1.75, "y":3.25}, {"label":"S", "x":2.75, "y":3.25}, {"label":"D", "x":3.75, "y":3.25}, {"label":"F", "x":4.75, "y":3.25}, {"label":"G", "x":5.75, "y":3.25}, {"label":"H", "x":6.75, "y":3.25}, {"label":"J", "x":7.75, "y":3.25}, {"label":"K", "x":8.75, "y":3.25}, {"label":"L", "x":9.75, "y":3.25}, {"label":":", "x":10.75, "y":3.25}, {"label":"\"", "x":11.75, "y":3.25}, {"label":"Enter", "x":12.75, "y":3.25, "w":2.25}, {"label":"4", "x":16.5, "y":3.25}, {"label":"5", "x":17.5, "y":3.25}, {"label":"6", "x":18.5, "y":3.25}, {"label":"Shift", "x":0, "y":4.25, "w":2.25}, {"label":"Z", "x":2.25, "y":4.25}, {"label":"X", "x":3.25, "y":4.25}, {"label":"C", "x":4.25, "y":4.25}, {"label":"V", "x":5.25, "y":4.25}, {"label":"B", "x":6.25, "y":4.25}, {"label":"N", "x":7.25, "y":4.25}, {"label":"M", "x":8.25, "y":4.25}, {"label":"<", "x":9.25, "y":4.25}, {"label":">", "x":10.25, "y":4.25}, {"label":"?", "x":11.25, "y":4.25}, {"label":"Shift", "x":12.25, "y":4.25, "w":2.75}, {"label":"1", "x":16.5, "y":4.25}, {"label":"2", "x":17.5, "y":4.25}, {"label":"3", "x":18.5, "y":4.25}, {"label":"Enter", "x":19.5, "y":4.25, "h":2}, {"label":"\u2191", "x":15.25, "y":4.5}, {"label":"Ctrl", "x":0, "y":5.25, "w":1.5}, {"label":"Win", "x":1.5, "y":5.25}, {"label":"Alt", "x":2.5, "y":5.25, "w":1.5}, {"x":4, "y":5.25, "w":7}, {"label":"Alt", "x":11, "y":5.25, "w":1.5}, {"label":"Menu", "x":12.5, "y":5.25, "w":1.5}, {"label":"0", "x":17.5, "y":5.25}, {"label":".", "x":18.5, "y":5.25}, {"label":"\u2190", "x":14.25, "y":5.5}, {"label":"\u2193", "x":15.25, "y":5.5}, {"label":"\u2192", "x":16.25, "y":5.5}] + } + } +}
\ No newline at end of file diff --git a/keyboards/duck/jetfire/jetfire.c b/keyboards/duck/jetfire/jetfire.c new file mode 100644 index 000000000..81bdb95ba --- /dev/null +++ b/keyboards/duck/jetfire/jetfire.c @@ -0,0 +1,171 @@ +/* Copyright 2018 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 <http://www.gnu.org/licenses/>. + */ +#include "jetfire.h" +#include "backlight_led.h" + +enum backlight_level { + BACKLIGHT_ALPHA = 0b0000001, + BACKLIGHT_MOD = 0b0000010, + BACKLIGHT_FROW = 0b0000100, + BACKLIGHT_NUMBLOCK = 0b0001000, + BACKLIGHT_RGB = 0b0010000, + BACKLIGHT_SWITCH = 0b0001111 +}; + +enum StateLed { + STATE_LED_SCROLL_LOCK, + STATE_LED_CAPS_LOCK, + STATE_LED_NUM_LOCK, + STATE_LED_LAYER_0, + STATE_LED_LAYER_1, + STATE_LED_LAYER_2, + STATE_LED_LAYER_3, + STATE_LED_LAYER_4 +}; + +uint8_t backlight_rgb_r = 255; +uint8_t backlight_rgb_g = 0; +uint8_t backlight_rgb_b = 0; +uint8_t backlight_state_led = 1<<STATE_LED_LAYER_0; + + +void backlight_toggle_rgb(bool enabled) +{ + if(enabled) { + uint8_t rgb[RGBLED_NUM][3] = { + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, + {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b} + }; + backlight_set_rgb(rgb); + } else { + uint8_t rgb[RGBLED_NUM][3] = { + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }; + backlight_set_rgb(rgb); + } +} + +void backlight_set_rgb(uint8_t cfg[RGBLED_NUM][3]) +{ + cli(); + for(uint8_t i = 0; i < RGBLED_NUM; ++i) { + send_color(cfg[i][0], cfg[i][1], cfg[i][2], Device_PCBRGB); + } + sei(); + show(); +} + + +void backlight_set(uint8_t level) +{ + level & BACKLIGHT_ALPHA ? (PORTB |= 0b00000010) : (PORTB &= ~0b00000010); + level & BACKLIGHT_MOD ? (PORTB |= 0b00000100) : (PORTB &= ~0b00000100); + level & BACKLIGHT_FROW ? (PORTB |= 0b00001000) : (PORTB &= ~0b00001000); + level & BACKLIGHT_NUMBLOCK ? (PORTE |= 0b01000000) : (PORTE &= ~0b01000000); + backlight_toggle_rgb(level & BACKLIGHT_RGB); +} + + + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware + + return process_record_user(keycode, record); +} + + +void backlight_update_state() +{ + cli(); + send_color(backlight_state_led & (1<<STATE_LED_SCROLL_LOCK) ? 255 : 0, + backlight_state_led & (1<<STATE_LED_CAPS_LOCK) ? 255 : 0, + backlight_state_led & (1<<STATE_LED_NUM_LOCK) ? 255 : 0, + Device_STATELED); + send_color(backlight_state_led & (1<<STATE_LED_LAYER_1) ? 255 : 0, + backlight_state_led & (1<<STATE_LED_LAYER_2) ? 255 : 0, + backlight_state_led & (1<<STATE_LED_LAYER_0) ? 255 : 0, + Device_STATELED); + send_color(backlight_state_led & (1<<STATE_LED_LAYER_4) ? 255 : 0, + backlight_state_led & (1<<STATE_LED_LAYER_3) ? 255 : 0, + 0, + Device_STATELED); + sei(); + show(); +} + +void led_set_kb(uint8_t usb_led) +{ + if(usb_led & (1<<USB_LED_CAPS_LOCK)) { + backlight_state_led |= 1<<STATE_LED_CAPS_LOCK; + } else { + backlight_state_led &= ~(1<<STATE_LED_CAPS_LOCK); + } + if(usb_led & (1<<USB_LED_SCROLL_LOCK)) { + backlight_state_led |= 1<<STATE_LED_SCROLL_LOCK; + } else { + backlight_state_led &= ~(1<<STATE_LED_SCROLL_LOCK); + } + if(usb_led & (1<<USB_LED_NUM_LOCK)) { + backlight_state_led |= 1<<STATE_LED_NUM_LOCK; + } else { + backlight_state_led &= ~(1<<STATE_LED_NUM_LOCK); + } + backlight_update_state(); +} diff --git a/keyboards/duck/jetfire/jetfire.h b/keyboards/duck/jetfire/jetfire.h new file mode 100644 index 000000000..9ce1406f0 --- /dev/null +++ b/keyboards/duck/jetfire/jetfire.h @@ -0,0 +1,60 @@ +/* Copyright 2018 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 <http://www.gnu.org/licenses/>. + */ +#ifndef JETFIRE_H +#define JETFIRE_H + +#include "quantum.h" + +// This a shortcut to help you visually see your layout. +// The following is an example using the Planck MIT layout +// The first section contains all of the arguments representing the physical +// layout of the board and position of the keys +// The second converts the arguments into a two-dimensional array which +// represents the switch matrix. + +#define LAYOUT_all( \ + K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T, \ + K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, K4R, K4S, K4T, \ + K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, K3P, K3Q, K3R, K3S, K3T, \ + K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2O, K2Q, K2R, K2S, K2T, \ + K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1O, K1P, K1Q, K1R, K1S, K1T, \ + K0A, K0B, K0C, K0I, K0L, K0M, K0N, K0O, K0P, K0Q, K0R, K0S, K0T \ +) { \ + { K5A, KC_NO, K5C, K5D, K5E, K5F, KC_NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T }, \ + { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, K4R, K4S, K4T }, \ + { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, KC_NO, K3O, K3P, K3Q, K3R, K3S, K3T }, \ + { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, KC_NO, KC_NO, K2O, KC_NO, K2Q, K2R, K2S, K2T }, \ + { K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, KC_NO, K1M, K1N, K1O, K1P, K1Q, K1R, K1S, K1T }, \ + { K0A, K0B, K0C, KC_NO,KC_NO,KC_NO,KC_NO,KC_NO, K0I, KC_NO,KC_NO, K0L, K0M, K0N, K0O, K0P, K0Q, K0R, K0S, K0T } \ +} + +#define LAYOUT( \ + K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T, \ + K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, K4P, K4Q, K4R, K4S, K4T, \ + K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, K3P, K3Q, K3R, K3S, K3T, \ + K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2O, K2Q, K2R, K2S, \ + K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1P, K1Q, K1R, K1S, K1T, \ + K0A, K0B, K0C, K0I, K0M, K0N, K0O, K0P, K0Q, K0R, K0S \ +) { \ + { K5A, KC_NO, K5C, K5D, K5E, K5F, KC_NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T }, \ + { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, KC_NO, K4O, K4P, K4Q, K4R, K4S, K4T }, \ + { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, KC_NO, K3O, K3P, K3Q, K3R, K3S, K3T }, \ + { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, KC_NO, KC_NO, K2O, KC_NO, K2Q, K2R, K2S, KC_NO }, \ + { K1A, KC_NO, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, KC_NO, K1M, K1N, KC_NO, K1P, K1Q, K1R, K1S, K1T }, \ + { K0A, K0B, K0C, KC_NO,KC_NO,KC_NO,KC_NO,KC_NO, K0I, KC_NO,KC_NO,KC_NO, K0M, K0N, K0O, K0P, K0Q, K0R, K0S, KC_NO } \ +} + +#endif diff --git a/keyboards/duck/jetfire/keymaps/default/config.h b/keyboards/duck/jetfire/keymaps/default/config.h new file mode 100644 index 000000000..a3ed4f762 --- /dev/null +++ b/keyboards/duck/jetfire/keymaps/default/config.h @@ -0,0 +1,19 @@ +/* Copyright 2018 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 <http://www.gnu.org/licenses/>. + */ + +#pragma once + +// place overrides here diff --git a/keyboards/duck/jetfire/keymaps/default/keymap.c b/keyboards/duck/jetfire/keymaps/default/keymap.c new file mode 100644 index 000000000..da0081a75 --- /dev/null +++ b/keyboards/duck/jetfire/keymaps/default/keymap.c @@ -0,0 +1,59 @@ +/* Copyright 2018 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 <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + // layer 0: qwerty + [0] = LAYOUT(\ + 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, RGB_MOD, KC_PSCR, KC_SLCK, KC_PAUS, KC_PGUP, + 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_NLCK, KC_PSLS, KC_PAST, KC_PMNS, + 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_P7, KC_P8, KC_P9, KC_PPLS, + 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_P4, KC_P5, KC_P6, + 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_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_COMM), +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/duck/jetfire/keymaps/default/readme.md b/keyboards/duck/jetfire/keymaps/default/readme.md new file mode 100644 index 000000000..8b807694b --- /dev/null +++ b/keyboards/duck/jetfire/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for jetfire diff --git a/keyboards/duck/jetfire/matrix.c b/keyboards/duck/jetfire/matrix.c new file mode 100644 index 000000000..51202aeb6 --- /dev/null +++ b/keyboards/duck/jetfire/matrix.c @@ -0,0 +1,277 @@ +/* +Copyright 2016 Ralf Schmitt <ralf@bunkertor.net> +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 <avr/io.h> +#include <util/delay.h> +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.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_ports(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) { +} + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +void backlight_init_ports(void) +{ + DDRD |= 0b01010000; + PORTD &= 0b10101111; + DDRB |= 0b00001110; + PORTB &= 0b11110001; + DDRE |= 0b01000000; + PORTE &= 0b10111111; +} + +void matrix_init(void) +{ + backlight_init_ports(); + unselect_cols(); + init_ports(); + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } +} + +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 = DEBOUNCING_DELAY; + } + } + unselect_cols(); + } + + if (debouncing) { + if (--debouncing) { + _delay_ms(1); + } else { + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = matrix_debouncing[i]; + } + } + } + + return 1; +} + +bool matrix_is_modified(void) +{ + if (debouncing) return false; + return true; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1<<col)); +} + +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))); + } +} + +uint8_t matrix_key_count(void) +{ + uint8_t count = 0; + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + count += bitpop32(matrix[i]); + } + return count; +} + +static void init_ports(void) +{ + // Rows are inputs (inputs are 0) + DDRD &= 0b11010000; + DDRB &= 0b01111111; + DDRE &= 0b11111011; + + // Columns are outputs (outputs are high) + DDRF |= 0b00000011; + DDRC |= 0b11000000; + DDRB |= 0b01110001; + DDRD |= 0b10000000; +} + +static uint8_t read_rows(uint8_t col) +{ + if(col == 15) { + return (PINE&(1<<2) ? 0 : (1<<0)) | + (PIND&(1<<0) ? (1<<1) : 0) | + (PIND&(1<<1) ? (1<<2) : 0) | + (PIND&(1<<2) ? (1<<3) : 0) | + (PIND&(1<<3) ? (1<<4) : 0) | + (PIND&(1<<5) ? (1<<5) : 0); + + } else { + return (PINB&(1<<7) ? (1<<0) : 0) | + (PIND&(1<<0) ? (1<<1) : 0) | + (PIND&(1<<1) ? (1<<2) : 0) | + (PIND&(1<<2) ? (1<<3) : 0) | + (PIND&(1<<3) ? (1<<4) : 0) | + (PIND&(1<<5) ? (1<<5) : 0); + + } +} + +static void unselect_cols(void) +{ + PORTF &= 0b11111100; + PORTC &= 0b00111111; + PORTB &= 0b10001110; + PORTD &= 0b01111111; +} + +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; + case 17: + PORTB |= 0b00010000; + break; + case 18: + PORTD |= 0b10000000; + break; + case 19: + PORTB |= 0b00000001; + break; + } +}
\ No newline at end of file diff --git a/keyboards/duck/jetfire/readme.md b/keyboards/duck/jetfire/readme.md new file mode 100644 index 000000000..fb5baf975 --- /dev/null +++ b/keyboards/duck/jetfire/readme.md @@ -0,0 +1,18 @@ +# Jetfire + +![jetfire](imgur.com image replace me!) + +The Duck Jetfire is a hybrid full size and 1800 layout keyboard that went on +Group Buy in November 2017. + +Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin) +Hardware Supported: Duck Jetfire PCB +Hardware Availability: [Geekhack GB](https://geekhack.org/index.php?topic=92708.0) + +To get into bootloader mode, hold the top top most key above the 2 navigation keys while connecting the USB cable. + +Make example for this keyboard (after setting up your build environment): + + make jetfire:default + +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. diff --git a/keyboards/duck/jetfire/rules.mk b/keyboards/duck/jetfire/rules.mk new file mode 100644 index 000000000..8e05516df --- /dev/null +++ b/keyboards/duck/jetfire/rules.mk @@ -0,0 +1,74 @@ +# MCU name +#MCU = at90usb1286 +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) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = no # Audio control and System control(+450) +CONSOLE_ENABLE = yes # 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 = no # USB Nkey Rollover +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +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 +HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) + +CUSTOM_MATRIX = yes +SRC += backlight_led.c \ + matrix.c diff --git a/keyboards/duck/readme.md b/keyboards/duck/readme.md new file mode 100644 index 000000000..caf7e156d --- /dev/null +++ b/keyboards/duck/readme.md @@ -0,0 +1,16 @@ +# Duck Keyboards + +[Duck](http://duck0113.tistory.com/) is a popular Korean custom keyboard designer. +Duck boards can only be bought new during a Group Buy and are commonly on a first come, first serve basis. + +**QMK is not the official firmware for Duck Keyboards.** + +For the official firmware, please use [OTD](http://kbdlab.co.kr/index.php?document_srl=100301&mid=board_sw). + +## QMK Powered Duck Boards +Eagle V2 +Jetfire V1 +Lightsaver V3 +Octagon V1 +Octagon V2 +Viper V2
\ No newline at end of file |