aboutsummaryrefslogtreecommitdiff
path: root/keyboards/duck
diff options
context:
space:
mode:
authorMechMerlin <30334081+mechmerlin@users.noreply.github.com>2018-08-25 18:00:20 -0700
committerDrashna Jaelre <drashna@live.com>2018-08-25 18:00:20 -0700
commite16b39f0c20c73348ae12af0e82e4b4c0d30b393 (patch)
tree74d33ae10f38fb4fbb39ab2eaa298f9ecdd272cf /keyboards/duck
parenta68057852bbffc45f783523a86a6aa2e80a03d44 (diff)
downloadqmk_firmware-e16b39f0c20c73348ae12af0e82e4b4c0d30b393.tar.gz
qmk_firmware-e16b39f0c20c73348ae12af0e82e4b4c0d30b393.zip
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.c129
-rw-r--r--keyboards/duck/jetfire/backlight_led.h18
-rw-r--r--keyboards/duck/jetfire/config.h200
-rw-r--r--keyboards/duck/jetfire/info.json16
-rw-r--r--keyboards/duck/jetfire/jetfire.c171
-rw-r--r--keyboards/duck/jetfire/jetfire.h60
-rw-r--r--keyboards/duck/jetfire/keymaps/default/config.h19
-rw-r--r--keyboards/duck/jetfire/keymaps/default/keymap.c59
-rw-r--r--keyboards/duck/jetfire/keymaps/default/readme.md1
-rw-r--r--keyboards/duck/jetfire/matrix.c277
-rw-r--r--keyboards/duck/jetfire/readme.md18
-rw-r--r--keyboards/duck/jetfire/rules.mk74
-rw-r--r--keyboards/duck/readme.md16
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 @@
1/*
2Copyright 2016 Ralf Schmitt <ralf@bunkertor.net>
3This program is free software: you can redistribute it and/or modify
4it under the terms of the GNU General Public License as published by
5the Free Software Foundation, either version 2 of the License, or
6(at your option) any later version.
7This program is distributed in the hope that it will be useful,
8but WITHOUT ANY WARRANTY; without even the implied warranty of
9MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10GNU General Public License for more details.
11You should have received a copy of the GNU General Public License
12along with this program. If not, see <http://www.gnu.org/licenses/>.
13*/
14
15#include <avr/interrupt.h>
16#include <avr/io.h>
17#include <stdbool.h>
18#include <util/delay.h>
19#include <stdint.h>
20#include "backlight_led.h"
21#include "quantum.h"
22// #include "led.h"
23
24
25#define T1H 900
26#define T1L 600
27#define T0H 400
28#define T0L 900
29#define RES 6000
30
31#define NS_PER_SEC (1000000000L)
32#define CYCLES_PER_SEC (F_CPU)
33#define NS_PER_CYCLE (NS_PER_SEC / CYCLES_PER_SEC)
34#define NS_TO_CYCLES(n) ((n) / NS_PER_CYCLE)
35
36void send_bit_d4(bool bitVal)
37{
38 if(bitVal) {
39 asm volatile (
40 "sbi %[port], %[bit] \n\t"
41 ".rept %[onCycles] \n\t"
42 "nop \n\t"
43 ".endr \n\t"
44 "cbi %[port], %[bit] \n\t"
45 ".rept %[offCycles] \n\t"
46 "nop \n\t"
47 ".endr \n\t"
48 ::
49 [port] "I" (_SFR_IO_ADDR(PORTD)),
50 [bit] "I" (4),
51 [onCycles] "I" (NS_TO_CYCLES(T1H) - 2),
52 [offCycles] "I" (NS_TO_CYCLES(T1L) - 2));
53 } else {
54 asm volatile (
55 "sbi %[port], %[bit] \n\t"
56 ".rept %[onCycles] \n\t"
57 "nop \n\t"
58 ".endr \n\t"
59 "cbi %[port], %[bit] \n\t"
60 ".rept %[offCycles] \n\t"
61 "nop \n\t"
62 ".endr \n\t"
63 ::
64 [port] "I" (_SFR_IO_ADDR(PORTD)),
65 [bit] "I" (4),
66 [onCycles] "I" (NS_TO_CYCLES(T0H) - 2),
67 [offCycles] "I" (NS_TO_CYCLES(T0L) - 2));
68 }
69}
70
71void send_bit_d6(bool bitVal)
72{
73 if(bitVal) {
74 asm volatile (
75 "sbi %[port], %[bit] \n\t"
76 ".rept %[onCycles] \n\t"
77 "nop \n\t"
78 ".endr \n\t"
79 "cbi %[port], %[bit] \n\t"
80 ".rept %[offCycles] \n\t"
81 "nop \n\t"
82 ".endr \n\t"
83 ::
84 [port] "I" (_SFR_IO_ADDR(PORTD)),
85 [bit] "I" (6),
86 [onCycles] "I" (NS_TO_CYCLES(T1H) - 2),
87 [offCycles] "I" (NS_TO_CYCLES(T1L) - 2));
88 } else {
89 asm volatile (
90 "sbi %[port], %[bit] \n\t"
91 ".rept %[onCycles] \n\t"
92 "nop \n\t"
93 ".endr \n\t"
94 "cbi %[port], %[bit] \n\t"
95 ".rept %[offCycles] \n\t"
96 "nop \n\t"
97 ".endr \n\t"
98 ::
99 [port] "I" (_SFR_IO_ADDR(PORTD)),
100 [bit] "I" (6),
101 [onCycles] "I" (NS_TO_CYCLES(T0H) - 2),
102 [offCycles] "I" (NS_TO_CYCLES(T0L) - 2));
103 }
104}
105
106void show(void)
107{
108 _delay_us((RES / 1000UL) + 1);
109}
110
111void send_value(uint8_t byte, enum Device device)
112{
113 for(uint8_t b = 0; b < 8; b++) {
114 if(device == Device_STATELED) {
115 send_bit_d4(byte & 0b10000000);
116 }
117 if(device == Device_PCBRGB) {
118 send_bit_d6(byte & 0b10000000);
119 }
120 byte <<= 1;
121 }
122}
123
124void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device)
125{
126 send_value(g, device);
127 send_value(r, device);
128 send_value(b, device);
129}
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 @@
1#ifndef BACKLIGHT_LED_H
2#define BACKLIGHT_LED_H
3
4enum Device {
5 Device_PCBRGB,
6 Device_STATELED
7};
8
9void backlight_init_ports(void);
10void backlight_set_state(bool cfg[7]);
11void backlight_update_state(void);
12void backlight_toggle_rgb(bool enabled);
13void backlight_set_rgb(uint8_t cfg[17][3]);
14void backlight_set(uint8_t level);
15void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device);
16void show(void);
17
18#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 @@
1/*
2Copyright 2018 MechMerlin
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#include "config_common.h"
21
22/* USB Device descriptor parameter */
23#define VENDOR_ID 0xFEED
24#define PRODUCT_ID 0x6050
25#define DEVICE_VER 0x0104
26#define MANUFACTURER Duck
27#define PRODUCT Jetfire
28#define DESCRIPTION A custom keyboard
29
30/* key matrix size */
31#define MATRIX_ROWS 6
32#define MATRIX_COLS 20
33
34/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
35#define DIODE_DIRECTION COL2ROW
36
37
38#define BACKLIGHT_LEVELS 1
39
40#define RGB_DI_PIN D6
41// #ifdef RGB_DI_PIN
42#define RGBLIGHT_ANIMATIONS
43#define RGBLED_NUM 23
44// #define RGBLIGHT_HUE_STEP 8
45// #define RGBLIGHT_SAT_STEP 8
46// #define RGBLIGHT_VAL_STEP 8
47// #endif
48
49/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
50#define DEBOUNCING_DELAY 5
51
52
53/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
54 * This is userful for the Windows task manager shortcut (ctrl+shift+esc).
55 */
56// #define GRAVE_ESC_CTRL_OVERRIDE
57
58/*
59 * Force NKRO
60 *
61 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
62 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
63 * makefile for this to work.)
64 *
65 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
66 * until the next keyboard reset.
67 *
68 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
69 * fully operational during normal computer usage.
70 *
71 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
72 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
73 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
74 * power-up.
75 *
76 */
77//#define FORCE_NKRO
78
79/*
80 * Magic Key Options
81 *
82 * Magic keys are hotkey commands that allow control over firmware functions of
83 * the keyboard. They are best used in combination with the HID Listen program,
84 * found here: https://www.pjrc.com/teensy/hid_listen.html
85 *
86 * The options below allow the magic key functionality to be changed. This is
87 * useful if your keyboard/keypad is missing keys and you want magic key support.
88 *
89 */
90
91/* key combination for magic key command */
92#define IS_COMMAND() ( \
93 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
94)
95
96/* control how magic key switches layers */
97//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
98//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
99//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
100
101/* override magic key keymap */
102//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
103//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
104//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
105//#define MAGIC_KEY_HELP1 H
106//#define MAGIC_KEY_HELP2 SLASH
107//#define MAGIC_KEY_DEBUG D
108//#define MAGIC_KEY_DEBUG_MATRIX X
109//#define MAGIC_KEY_DEBUG_KBD K
110//#define MAGIC_KEY_DEBUG_MOUSE M
111//#define MAGIC_KEY_VERSION V
112//#define MAGIC_KEY_STATUS S
113//#define MAGIC_KEY_CONSOLE C
114//#define MAGIC_KEY_LAYER0_ALT1 ESC
115//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
116//#define MAGIC_KEY_LAYER0 0
117//#define MAGIC_KEY_LAYER1 1
118//#define MAGIC_KEY_LAYER2 2
119//#define MAGIC_KEY_LAYER3 3
120//#define MAGIC_KEY_LAYER4 4
121//#define MAGIC_KEY_LAYER5 5
122//#define MAGIC_KEY_LAYER6 6
123//#define MAGIC_KEY_LAYER7 7
124//#define MAGIC_KEY_LAYER8 8
125//#define MAGIC_KEY_LAYER9 9
126//#define MAGIC_KEY_BOOTLOADER PAUSE
127//#define MAGIC_KEY_LOCK CAPS
128//#define MAGIC_KEY_EEPROM E
129//#define MAGIC_KEY_NKRO N
130//#define MAGIC_KEY_SLEEP_LED Z
131
132/*
133 * Feature disable options
134 * These options are also useful to firmware size reduction.
135 */
136
137/* disable debug print */
138//#define NO_DEBUG
139
140/* disable print */
141//#define NO_PRINT
142
143/* disable action features */
144//#define NO_ACTION_LAYER
145//#define NO_ACTION_TAPPING
146//#define NO_ACTION_ONESHOT
147//#define NO_ACTION_MACRO
148//#define NO_ACTION_FUNCTION
149
150/*
151 * MIDI options
152 */
153
154/* Prevent use of disabled MIDI features in the keymap */
155//#define MIDI_ENABLE_STRICT 1
156
157/* enable basic MIDI features:
158 - MIDI notes can be sent when in Music mode is on
159*/
160//#define MIDI_BASIC
161
162/* enable advanced MIDI features:
163 - MIDI notes can be added to the keymap
164 - Octave shift and transpose
165 - Virtual sustain, portamento, and modulation wheel
166 - etc.
167*/
168//#define MIDI_ADVANCED
169
170/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
171//#define MIDI_TONE_KEYCODE_OCTAVES 1
172
173/*
174 * HD44780 LCD Display Configuration
175 */
176/*
177#define LCD_LINES 2 //< number of visible lines of the display
178#define LCD_DISP_LENGTH 16 //< visibles characters per line of the display
179
180#define LCD_IO_MODE 1 //< 0: memory mapped mode, 1: IO port mode
181
182#if LCD_IO_MODE
183#define LCD_PORT PORTB //< port for the LCD lines
184#define LCD_DATA0_PORT LCD_PORT //< port for 4bit data bit 0
185#define LCD_DATA1_PORT LCD_PORT //< port for 4bit data bit 1
186#define LCD_DATA2_PORT LCD_PORT //< port for 4bit data bit 2
187#define LCD_DATA3_PORT LCD_PORT //< port for 4bit data bit 3
188#define LCD_DATA0_PIN 4 //< pin for 4bit data bit 0
189#define LCD_DATA1_PIN 5 //< pin for 4bit data bit 1
190#define LCD_DATA2_PIN 6 //< pin for 4bit data bit 2
191#define LCD_DATA3_PIN 7 //< pin for 4bit data bit 3
192#define LCD_RS_PORT LCD_PORT //< port for RS line
193#define LCD_RS_PIN 3 //< pin for RS line
194#define LCD_RW_PORT LCD_PORT //< port for RW line
195#define LCD_RW_PIN 2 //< pin for RW line
196#define LCD_E_PORT LCD_PORT //< port for Enable line
197#define LCD_E_PIN 1 //< pin for Enable line
198#endif
199*/
200
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 @@
1{
2 "keyboard_name": "Jetfire",
3 "url": "",
4 "maintainer": "qmk",
5 "width": 20.5,
6 "height": 6.5,
7 "layouts": {
8 "LAYOUT_all": {
9 "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}]
10 },
11
12 "LAYOUT": {
13 "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}]
14 }
15 }
16} \ 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 @@
1/* Copyright 2018 MechMerlin
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include "jetfire.h"
17#include "backlight_led.h"
18
19enum backlight_level {
20 BACKLIGHT_ALPHA = 0b0000001,
21 BACKLIGHT_MOD = 0b0000010,
22 BACKLIGHT_FROW = 0b0000100,
23 BACKLIGHT_NUMBLOCK = 0b0001000,
24 BACKLIGHT_RGB = 0b0010000,
25 BACKLIGHT_SWITCH = 0b0001111
26};
27
28enum StateLed {
29 STATE_LED_SCROLL_LOCK,
30 STATE_LED_CAPS_LOCK,
31 STATE_LED_NUM_LOCK,
32 STATE_LED_LAYER_0,
33 STATE_LED_LAYER_1,
34 STATE_LED_LAYER_2,
35 STATE_LED_LAYER_3,
36 STATE_LED_LAYER_4
37};
38
39uint8_t backlight_rgb_r = 255;
40uint8_t backlight_rgb_g = 0;
41uint8_t backlight_rgb_b = 0;
42uint8_t backlight_state_led = 1<<STATE_LED_LAYER_0;
43
44
45void backlight_toggle_rgb(bool enabled)
46{
47 if(enabled) {
48 uint8_t rgb[RGBLED_NUM][3] = {
49 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
50 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
51 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
52 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
53 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
54 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
55 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
56 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
57 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
58 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
59 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
60 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
61 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
62 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
63 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
64 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
65 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
66 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
67 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
68 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
69 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
70 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
71 {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}
72 };
73 backlight_set_rgb(rgb);
74 } else {
75 uint8_t rgb[RGBLED_NUM][3] = {
76 {0, 0, 0},
77 {0, 0, 0},
78 {0, 0, 0},
79 {0, 0, 0},
80 {0, 0, 0},
81 {0, 0, 0},
82 {0, 0, 0},
83 {0, 0, 0},
84 {0, 0, 0},
85 {0, 0, 0},
86 {0, 0, 0},
87 {0, 0, 0},
88 {0, 0, 0},
89 {0, 0, 0},
90 {0, 0, 0},
91 {0, 0, 0},
92 {0, 0, 0},
93 {0, 0, 0},
94 {0, 0, 0},
95 {0, 0, 0},
96 {0, 0, 0},
97 {0, 0, 0},
98 {0, 0, 0}
99 };
100 backlight_set_rgb(rgb);
101 }
102}
103
104void backlight_set_rgb(uint8_t cfg[RGBLED_NUM][3])
105{
106 cli();
107 for(uint8_t i = 0; i < RGBLED_NUM; ++i) {
108 send_color(cfg[i][0], cfg[i][1], cfg[i][2], Device_PCBRGB);
109 }
110 sei();
111 show();
112}
113
114
115void backlight_set(uint8_t level)
116{
117 level & BACKLIGHT_ALPHA ? (PORTB |= 0b00000010) : (PORTB &= ~0b00000010);
118 level & BACKLIGHT_MOD ? (PORTB |= 0b00000100) : (PORTB &= ~0b00000100);
119 level & BACKLIGHT_FROW ? (PORTB |= 0b00001000) : (PORTB &= ~0b00001000);
120 level & BACKLIGHT_NUMBLOCK ? (PORTE |= 0b01000000) : (PORTE &= ~0b01000000);
121 backlight_toggle_rgb(level & BACKLIGHT_RGB);
122}
123
124
125
126bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
127 // put your per-action keyboard code here
128 // runs for every action, just before processing by the firmware
129
130 return process_record_user(keycode, record);
131}
132
133
134void backlight_update_state()
135{
136 cli();
137 send_color(backlight_state_led & (1<<STATE_LED_SCROLL_LOCK) ? 255 : 0,
138 backlight_state_led & (1<<STATE_LED_CAPS_LOCK) ? 255 : 0,
139 backlight_state_led & (1<<STATE_LED_NUM_LOCK) ? 255 : 0,
140 Device_STATELED);
141 send_color(backlight_state_led & (1<<STATE_LED_LAYER_1) ? 255 : 0,
142 backlight_state_led & (1<<STATE_LED_LAYER_2) ? 255 : 0,
143 backlight_state_led & (1<<STATE_LED_LAYER_0) ? 255 : 0,
144 Device_STATELED);
145 send_color(backlight_state_led & (1<<STATE_LED_LAYER_4) ? 255 : 0,
146 backlight_state_led & (1<<STATE_LED_LAYER_3) ? 255 : 0,
147 0,
148 Device_STATELED);
149 sei();
150 show();
151}
152
153void led_set_kb(uint8_t usb_led)
154{
155 if(usb_led & (1<<USB_LED_CAPS_LOCK)) {
156 backlight_state_led |= 1<<STATE_LED_CAPS_LOCK;
157 } else {
158 backlight_state_led &= ~(1<<STATE_LED_CAPS_LOCK);
159 }
160 if(usb_led & (1<<USB_LED_SCROLL_LOCK)) {
161 backlight_state_led |= 1<<STATE_LED_SCROLL_LOCK;
162 } else {
163 backlight_state_led &= ~(1<<STATE_LED_SCROLL_LOCK);
164 }
165 if(usb_led & (1<<USB_LED_NUM_LOCK)) {
166 backlight_state_led |= 1<<STATE_LED_NUM_LOCK;
167 } else {
168 backlight_state_led &= ~(1<<STATE_LED_NUM_LOCK);
169 }
170 backlight_update_state();
171}
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 @@
1/* Copyright 2018 MechMerlin
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#ifndef JETFIRE_H
17#define JETFIRE_H
18
19#include "quantum.h"
20
21// This a shortcut to help you visually see your layout.
22// The following is an example using the Planck MIT layout
23// The first section contains all of the arguments representing the physical
24// layout of the board and position of the keys
25// The second converts the arguments into a two-dimensional array which
26// represents the switch matrix.
27
28#define LAYOUT_all( \
29 K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T, \
30 K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, K4R, K4S, K4T, \
31 K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, K3P, K3Q, K3R, K3S, K3T, \
32 K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2O, K2Q, K2R, K2S, K2T, \
33 K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1O, K1P, K1Q, K1R, K1S, K1T, \
34 K0A, K0B, K0C, K0I, K0L, K0M, K0N, K0O, K0P, K0Q, K0R, K0S, K0T \
35) { \
36 { K5A, KC_NO, K5C, K5D, K5E, K5F, KC_NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T }, \
37 { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, K4R, K4S, K4T }, \
38 { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, KC_NO, K3O, K3P, K3Q, K3R, K3S, K3T }, \
39 { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, KC_NO, KC_NO, K2O, KC_NO, K2Q, K2R, K2S, K2T }, \
40 { K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, KC_NO, K1M, K1N, K1O, K1P, K1Q, K1R, K1S, K1T }, \
41 { 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 } \
42}
43
44#define LAYOUT( \
45 K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T, \
46 K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, K4P, K4Q, K4R, K4S, K4T, \
47 K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, K3P, K3Q, K3R, K3S, K3T, \
48 K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2O, K2Q, K2R, K2S, \
49 K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1P, K1Q, K1R, K1S, K1T, \
50 K0A, K0B, K0C, K0I, K0M, K0N, K0O, K0P, K0Q, K0R, K0S \
51) { \
52 { K5A, KC_NO, K5C, K5D, K5E, K5F, KC_NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T }, \
53 { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, KC_NO, K4O, K4P, K4Q, K4R, K4S, K4T }, \
54 { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, KC_NO, K3O, K3P, K3Q, K3R, K3S, K3T }, \
55 { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, KC_NO, KC_NO, K2O, KC_NO, K2Q, K2R, K2S, KC_NO }, \
56 { K1A, KC_NO, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, KC_NO, K1M, K1N, KC_NO, K1P, K1Q, K1R, K1S, K1T }, \
57 { 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 } \
58}
59
60#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 @@
1/* Copyright 2018 MechMerlin
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19// 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 @@
1/* Copyright 2018 MechMerlin
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include QMK_KEYBOARD_H
17
18const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
19 // layer 0: qwerty
20 [0] = LAYOUT(\
21 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,
22 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,
23 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,
24 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,
25 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,
26 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_COMM),
27};
28
29const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
30{
31 // MACRODOWN only works in this function
32 switch(id) {
33 case 0:
34 if (record->event.pressed) {
35 register_code(KC_RSFT);
36 } else {
37 unregister_code(KC_RSFT);
38 }
39 break;
40 }
41 return MACRO_NONE;
42};
43
44
45void matrix_init_user(void) {
46
47}
48
49void matrix_scan_user(void) {
50
51}
52
53bool process_record_user(uint16_t keycode, keyrecord_t *record) {
54 return true;
55}
56
57void led_set_user(uint8_t usb_led) {
58
59}
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 @@
1/*
2Copyright 2016 Ralf Schmitt <ralf@bunkertor.net>
3This program is free software: you can redistribute it and/or modify
4it under the terms of the GNU General Public License as published by
5the Free Software Foundation, either version 2 of the License, or
6(at your option) any later version.
7This program is distributed in the hope that it will be useful,
8but WITHOUT ANY WARRANTY; without even the implied warranty of
9MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10GNU General Public License for more details.
11You should have received a copy of the GNU General Public License
12along with this program. If not, see <http://www.gnu.org/licenses/>.
13*/
14
15#include <stdint.h>
16#include <stdbool.h>
17#include <avr/io.h>
18#include <util/delay.h>
19#include "print.h"
20#include "debug.h"
21#include "util.h"
22#include "matrix.h"
23
24static uint8_t debouncing = DEBOUNCING_DELAY;
25
26/* matrix state(1:on, 0:off) */
27static matrix_row_t matrix[MATRIX_ROWS];
28static matrix_row_t matrix_debouncing[MATRIX_ROWS];
29
30static uint8_t read_rows(uint8_t col);
31static void init_ports(void);
32static void unselect_cols(void);
33static void select_col(uint8_t col);
34
35__attribute__ ((weak))
36void matrix_init_kb(void) {
37 matrix_init_user();
38}
39
40__attribute__ ((weak))
41void matrix_scan_kb(void) {
42 matrix_scan_user();
43}
44
45__attribute__ ((weak))
46void matrix_init_user(void) {
47}
48
49__attribute__ ((weak))
50void matrix_scan_user(void) {
51}
52
53inline
54uint8_t matrix_rows(void)
55{
56 return MATRIX_ROWS;
57}
58
59inline
60uint8_t matrix_cols(void)
61{
62 return MATRIX_COLS;
63}
64
65void backlight_init_ports(void)
66{
67 DDRD |= 0b01010000;
68 PORTD &= 0b10101111;
69 DDRB |= 0b00001110;
70 PORTB &= 0b11110001;
71 DDRE |= 0b01000000;
72 PORTE &= 0b10111111;
73}
74
75void matrix_init(void)
76{
77 backlight_init_ports();
78 unselect_cols();
79 init_ports();
80 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
81 matrix[i] = 0;
82 matrix_debouncing[i] = 0;
83 }
84}
85
86uint8_t matrix_scan(void)
87{
88 for (uint8_t col = 0; col < MATRIX_COLS; col++) {
89 select_col(col);
90 _delay_us(3);
91 uint8_t rows = read_rows(col);
92 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
93 bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col);
94 bool curr_bit = rows & (1<<row);
95 if (prev_bit != curr_bit) {
96 matrix_debouncing[row] ^= ((matrix_row_t)1<<col);
97 if (debouncing) {
98 dprint("bounce!: "); dprintf("%02X", debouncing); dprintln();
99 }
100 debouncing = DEBOUNCING_DELAY;
101 }
102 }
103 unselect_cols();
104 }
105
106 if (debouncing) {
107 if (--debouncing) {
108 _delay_ms(1);
109 } else {
110 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
111 matrix[i] = matrix_debouncing[i];
112 }
113 }
114 }
115
116 return 1;
117}
118
119bool matrix_is_modified(void)
120{
121 if (debouncing) return false;
122 return true;
123}
124
125inline
126bool matrix_is_on(uint8_t row, uint8_t col)
127{
128 return (matrix[row] & ((matrix_row_t)1<<col));
129}
130
131inline
132matrix_row_t matrix_get_row(uint8_t row)
133{
134 return matrix[row];
135}
136
137void matrix_print(void)
138{
139 print("\nr/c 0123456789ABCDEF\n");
140 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
141 xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row)));
142 }
143}
144
145uint8_t matrix_key_count(void)
146{
147 uint8_t count = 0;
148 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
149 count += bitpop32(matrix[i]);
150 }
151 return count;
152}
153
154static void init_ports(void)
155{
156 // Rows are inputs (inputs are 0)
157 DDRD &= 0b11010000;
158 DDRB &= 0b01111111;
159 DDRE &= 0b11111011;
160
161 // Columns are outputs (outputs are high)
162 DDRF |= 0b00000011;
163 DDRC |= 0b11000000;
164 DDRB |= 0b01110001;
165 DDRD |= 0b10000000;
166}
167
168static uint8_t read_rows(uint8_t col)
169{
170 if(col == 15) {
171 return (PINE&(1<<2) ? 0 : (1<<0)) |
172 (PIND&(1<<0) ? (1<<1) : 0) |
173 (PIND&(1<<1) ? (1<<2) : 0) |
174 (PIND&(1<<2) ? (1<<3) : 0) |
175 (PIND&(1<<3) ? (1<<4) : 0) |
176 (PIND&(1<<5) ? (1<<5) : 0);
177
178 } else {
179 return (PINB&(1<<7) ? (1<<0) : 0) |
180 (PIND&(1<<0) ? (1<<1) : 0) |
181 (PIND&(1<<1) ? (1<<2) : 0) |
182 (PIND&(1<<2) ? (1<<3) : 0) |
183 (PIND&(1<<3) ? (1<<4) : 0) |
184 (PIND&(1<<5) ? (1<<5) : 0);
185
186 }
187}
188
189static void unselect_cols(void)
190{
191 PORTF &= 0b11111100;
192 PORTC &= 0b00111111;
193 PORTB &= 0b10001110;
194 PORTD &= 0b01111111;
195}
196
197static void select_col(uint8_t col)
198{
199 switch (col) {
200 case 0:
201 PORTC |= 0b01000000;
202 break;
203 case 1:
204 PORTC |= 0b01000000;
205 PORTF |= 0b00000001;
206 break;
207 case 2:
208 PORTC |= 0b01000000;
209 PORTF |= 0b00000010;
210 break;
211 case 3:
212 PORTC |= 0b01000000;
213 PORTF |= 0b00000011;
214 break;
215 case 4:
216 PORTC |= 0b11000000;
217 break;
218 case 5:
219 PORTC |= 0b11000000;
220 PORTF |= 0b00000001;
221 break;
222 case 6:
223 PORTC |= 0b11000000;
224 PORTF |= 0b00000010;
225 break;
226 case 7:
227 PORTC |= 0b11000000;
228 PORTF |= 0b00000011;
229 break;
230 case 8:
231 PORTB |= 0b01000000;
232 break;
233 case 9:
234 PORTB |= 0b01000000;
235 PORTF |= 0b00000001;
236 break;
237 case 10:
238 PORTB |= 0b01000000;
239 PORTF |= 0b00000010;
240 break;
241 case 11:
242 PORTB |= 0b01000000;
243 PORTF |= 0b00000011;
244 break;
245 case 12:
246 PORTB |= 0b01000000;
247 PORTC |= 0b10000000;
248 break;
249 case 13:
250 PORTB |= 0b01000000;
251 PORTF |= 0b00000001;
252 PORTC |= 0b10000000;
253 break;
254 case 14:
255 PORTB |= 0b01000000;
256 PORTF |= 0b00000010;
257 PORTC |= 0b10000000;
258 break;
259 case 15:
260 PORTB |= 0b01000000;
261 PORTF |= 0b00000011;
262 PORTC |= 0b10000000;
263 break;
264 case 16:
265 PORTB |= 0b00100000;
266 break;
267 case 17:
268 PORTB |= 0b00010000;
269 break;
270 case 18:
271 PORTD |= 0b10000000;
272 break;
273 case 19:
274 PORTB |= 0b00000001;
275 break;
276 }
277} \ 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 @@
1# Jetfire
2
3![jetfire](imgur.com image replace me!)
4
5The Duck Jetfire is a hybrid full size and 1800 layout keyboard that went on
6Group Buy in November 2017.
7
8Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin)
9Hardware Supported: Duck Jetfire PCB
10Hardware Availability: [Geekhack GB](https://geekhack.org/index.php?topic=92708.0)
11
12To get into bootloader mode, hold the top top most key above the 2 navigation keys while connecting the USB cable.
13
14Make example for this keyboard (after setting up your build environment):
15
16 make jetfire:default
17
18See [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 @@
1# MCU name
2#MCU = at90usb1286
3MCU = atmega32u4
4
5# Processor frequency.
6# This will define a symbol, F_CPU, in all source code files equal to the
7# processor frequency in Hz. You can then use this symbol in your source code to
8# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
9# automatically to create a 32-bit value in your source code.
10#
11# This will be an integer division of F_USB below, as it is sourced by
12# F_USB after it has run through any CPU prescalers. Note that this value
13# does not *change* the processor frequency - it should merely be updated to
14# reflect the processor speed set externally so that the code can use accurate
15# software delays.
16F_CPU = 16000000
17
18
19#
20# LUFA specific
21#
22# Target architecture (see library "Board Types" documentation).
23ARCH = AVR8
24
25# Input clock frequency.
26# This will define a symbol, F_USB, in all source code files equal to the
27# input clock frequency (before any prescaling is performed) in Hz. This value may
28# differ from F_CPU if prescaling is used on the latter, and is required as the
29# raw input clock is fed directly to the PLL sections of the AVR for high speed
30# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
31# at the end, this will be done automatically to create a 32-bit value in your
32# source code.
33#
34# If no clock division is performed on the input clock inside the AVR (via the
35# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
36F_USB = $(F_CPU)
37
38# Interrupt driven control endpoint task(+60)
39OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
40
41
42# Boot Section Size in *bytes*
43# Teensy halfKay 512
44# Teensy++ halfKay 1024
45# Atmel DFU loader 4096
46# LUFA bootloader 4096
47# USBaspLoader 2048
48OPT_DEFS += -DBOOTLOADER_SIZE=4096
49
50
51# Build Options
52# change yes to no to disable
53#
54BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
55MOUSEKEY_ENABLE = no # Mouse keys(+4700)
56EXTRAKEY_ENABLE = no # Audio control and System control(+450)
57CONSOLE_ENABLE = yes # Console for debug(+400)
58COMMAND_ENABLE = yes # Commands for debug and configuration
59# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
60SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
61# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
62NKRO_ENABLE = no # USB Nkey Rollover
63BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default
64RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
65MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
66UNICODE_ENABLE = no # Unicode
67BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
68AUDIO_ENABLE = no # Audio output on port C6
69FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
70HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)
71
72CUSTOM_MATRIX = yes
73SRC += backlight_led.c \
74 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 @@
1# Duck Keyboards
2
3[Duck](http://duck0113.tistory.com/) is a popular Korean custom keyboard designer.
4Duck boards can only be bought new during a Group Buy and are commonly on a first come, first serve basis.
5
6**QMK is not the official firmware for Duck Keyboards.**
7
8For the official firmware, please use [OTD](http://kbdlab.co.kr/index.php?document_srl=100301&mid=board_sw).
9
10## QMK Powered Duck Boards
11Eagle V2
12Jetfire V1
13Lightsaver V3
14Octagon V1
15Octagon V2
16Viper V2 \ No newline at end of file