diff options
author | Akshay <[email protected]> | 2022-04-10 12:13:40 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2022-04-10 12:13:40 +0100 |
commit | dc90387ce7d8ba7b607d9c48540bf6d8b560f14d (patch) | |
tree | 4ccb8fa5886b66fa9d480edef74236c27f035e16 /keyboards/duck/jetfire |
Diffstat (limited to 'keyboards/duck/jetfire')
-rw-r--r-- | keyboards/duck/jetfire/config.h | 96 | ||||
-rw-r--r-- | keyboards/duck/jetfire/indicator_leds.c | 116 | ||||
-rw-r--r-- | keyboards/duck/jetfire/indicator_leds.h | 11 | ||||
-rw-r--r-- | keyboards/duck/jetfire/info.json | 14 | ||||
-rw-r--r-- | keyboards/duck/jetfire/jetfire.c | 161 | ||||
-rw-r--r-- | keyboards/duck/jetfire/jetfire.h | 58 | ||||
-rw-r--r-- | keyboards/duck/jetfire/keymaps/default/keymap.c | 27 | ||||
-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 | 23 |
11 files changed, 802 insertions, 0 deletions
diff --git a/keyboards/duck/jetfire/config.h b/keyboards/duck/jetfire/config.h new file mode 100644 index 000000000..3b6c7d89f --- /dev/null +++ b/keyboards/duck/jetfire/config.h | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | Copyright 2018 MechMerlin | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along 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 0x444B // Duck ("DK") | ||
24 | #define PRODUCT_ID 0x4A46 // Jetfire ("JF") | ||
25 | #define DEVICE_VER 0x0001 | ||
26 | #define MANUFACTURER Duck | ||
27 | #define PRODUCT Jetfire | ||
28 | |||
29 | /* key matrix size */ | ||
30 | #define MATRIX_ROWS 6 | ||
31 | #define MATRIX_COLS 20 | ||
32 | |||
33 | /* COL2ROW, ROW2COL*/ | ||
34 | #define DIODE_DIRECTION COL2ROW | ||
35 | |||
36 | #define BACKLIGHT_LEVELS 1 | ||
37 | |||
38 | #define RGB_DI_PIN D6 | ||
39 | // #ifdef RGB_DI_PIN | ||
40 | #define RGBLIGHT_ANIMATIONS | ||
41 | #define RGBLED_NUM 23 | ||
42 | // #define RGBLIGHT_HUE_STEP 8 | ||
43 | // #define RGBLIGHT_SAT_STEP 8 | ||
44 | // #define RGBLIGHT_VAL_STEP 8 | ||
45 | // #endif | ||
46 | |||
47 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
48 | #define DEBOUNCE 5 | ||
49 | |||
50 | /* Set to top left most key */ | ||
51 | #define BOOTMAGIC_LITE_ROW 5 | ||
52 | #define BOOTMAGIC_LITE_COLUMN 10 | ||
53 | |||
54 | /* If defined, GRAVE_ESC will always act as ESC when CTRL is held. | ||
55 | * This is userful for the Windows task manager shortcut (ctrl+shift+esc). | ||
56 | */ | ||
57 | // #define GRAVE_ESC_CTRL_OVERRIDE | ||
58 | |||
59 | /* | ||
60 | * Force NKRO | ||
61 | * | ||
62 | * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved | ||
63 | * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the | ||
64 | * makefile for this to work.) | ||
65 | * | ||
66 | * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) | ||
67 | * until the next keyboard reset. | ||
68 | * | ||
69 | * NKRO may prevent your keystrokes from being detected in the BIOS, but it is | ||
70 | * fully operational during normal computer usage. | ||
71 | * | ||
72 | * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) | ||
73 | * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by | ||
74 | * bootmagic, NKRO mode will always be enabled until it is toggled again during a | ||
75 | * power-up. | ||
76 | * | ||
77 | */ | ||
78 | //#define FORCE_NKRO | ||
79 | |||
80 | /* | ||
81 | * Feature disable options | ||
82 | * These options are also useful to firmware size reduction. | ||
83 | */ | ||
84 | |||
85 | /* disable debug print */ | ||
86 | //#define NO_DEBUG | ||
87 | |||
88 | /* disable print */ | ||
89 | //#define NO_PRINT | ||
90 | |||
91 | /* disable action features */ | ||
92 | //#define NO_ACTION_LAYER | ||
93 | //#define NO_ACTION_TAPPING | ||
94 | //#define NO_ACTION_ONESHOT | ||
95 | //#define NO_ACTION_MACRO | ||
96 | //#define NO_ACTION_FUNCTION | ||
diff --git a/keyboards/duck/jetfire/indicator_leds.c b/keyboards/duck/jetfire/indicator_leds.c new file mode 100644 index 000000000..7dbdb1ff7 --- /dev/null +++ b/keyboards/duck/jetfire/indicator_leds.c | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | Copyright 2016 Ralf Schmitt <[email protected]> | ||
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 | This program is distributed in the hope that it will be useful, | ||
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | GNU General Public License for more details. | ||
11 | You should have received a copy of the GNU General Public License | ||
12 | along 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 "indicator_leds.h" | ||
21 | #include "quantum.h" | ||
22 | |||
23 | #define LED_T1H 900 | ||
24 | #define LED_T1L 600 | ||
25 | #define LED_T0H 400 | ||
26 | #define LED_T0L 900 | ||
27 | |||
28 | void send_bit_d4(bool bitVal) | ||
29 | { | ||
30 | if(bitVal) { | ||
31 | asm volatile ( | ||
32 | "sbi %[port], %[bit] \n\t" | ||
33 | ".rept %[onCycles] \n\t" | ||
34 | "nop \n\t" | ||
35 | ".endr \n\t" | ||
36 | "cbi %[port], %[bit] \n\t" | ||
37 | ".rept %[offCycles] \n\t" | ||
38 | "nop \n\t" | ||
39 | ".endr \n\t" | ||
40 | :: | ||
41 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
42 | [bit] "I" (4), | ||
43 | [onCycles] "I" (NS_TO_CYCLES(LED_T1H) - 2), | ||
44 | [offCycles] "I" (NS_TO_CYCLES(LED_T1L) - 2)); | ||
45 | } else { | ||
46 | asm volatile ( | ||
47 | "sbi %[port], %[bit] \n\t" | ||
48 | ".rept %[onCycles] \n\t" | ||
49 | "nop \n\t" | ||
50 | ".endr \n\t" | ||
51 | "cbi %[port], %[bit] \n\t" | ||
52 | ".rept %[offCycles] \n\t" | ||
53 | "nop \n\t" | ||
54 | ".endr \n\t" | ||
55 | :: | ||
56 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
57 | [bit] "I" (4), | ||
58 | [onCycles] "I" (NS_TO_CYCLES(LED_T0H) - 2), | ||
59 | [offCycles] "I" (NS_TO_CYCLES(LED_T0L) - 2)); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | void send_bit_d6(bool bitVal) | ||
64 | { | ||
65 | if(bitVal) { | ||
66 | asm volatile ( | ||
67 | "sbi %[port], %[bit] \n\t" | ||
68 | ".rept %[onCycles] \n\t" | ||
69 | "nop \n\t" | ||
70 | ".endr \n\t" | ||
71 | "cbi %[port], %[bit] \n\t" | ||
72 | ".rept %[offCycles] \n\t" | ||
73 | "nop \n\t" | ||
74 | ".endr \n\t" | ||
75 | :: | ||
76 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
77 | [bit] "I" (6), | ||
78 | [onCycles] "I" (NS_TO_CYCLES(LED_T1H) - 2), | ||
79 | [offCycles] "I" (NS_TO_CYCLES(LED_T1L) - 2)); | ||
80 | } else { | ||
81 | asm volatile ( | ||
82 | "sbi %[port], %[bit] \n\t" | ||
83 | ".rept %[onCycles] \n\t" | ||
84 | "nop \n\t" | ||
85 | ".endr \n\t" | ||
86 | "cbi %[port], %[bit] \n\t" | ||
87 | ".rept %[offCycles] \n\t" | ||
88 | "nop \n\t" | ||
89 | ".endr \n\t" | ||
90 | :: | ||
91 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
92 | [bit] "I" (6), | ||
93 | [onCycles] "I" (NS_TO_CYCLES(LED_T0H) - 2), | ||
94 | [offCycles] "I" (NS_TO_CYCLES(LED_T0L) - 2)); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | void send_value(uint8_t byte, enum Device device) | ||
99 | { | ||
100 | for(uint8_t b = 0; b < 8; b++) { | ||
101 | if(device == Device_STATUSLED) { | ||
102 | send_bit_d4(byte & 0b10000000); | ||
103 | } | ||
104 | if(device == Device_PCBRGB) { | ||
105 | send_bit_d6(byte & 0b10000000); | ||
106 | } | ||
107 | byte <<= 1; | ||
108 | } | ||
109 | } | ||
110 | |||
111 | void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device) | ||
112 | { | ||
113 | send_value(r, device); | ||
114 | send_value(g, device); | ||
115 | send_value(b, device); | ||
116 | } | ||
diff --git a/keyboards/duck/jetfire/indicator_leds.h b/keyboards/duck/jetfire/indicator_leds.h new file mode 100644 index 000000000..695e1db6d --- /dev/null +++ b/keyboards/duck/jetfire/indicator_leds.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #include "duck_led/duck_led.h" | ||
4 | |||
5 | void backlight_init_ports(void); | ||
6 | void backlight_set_state(bool cfg[7]); | ||
7 | void backlight_update_state(void); | ||
8 | void backlight_toggle_rgb(bool enabled); | ||
9 | void backlight_set_rgb(uint8_t cfg[17][3]); | ||
10 | void backlight_set(uint8_t level); | ||
11 | void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device); | ||
diff --git a/keyboards/duck/jetfire/info.json b/keyboards/duck/jetfire/info.json new file mode 100644 index 000000000..9325fffb7 --- /dev/null +++ b/keyboards/duck/jetfire/info.json | |||
@@ -0,0 +1,14 @@ | |||
1 | { | ||
2 | "keyboard_name": "Jetfire", | ||
3 | "url": "", | ||
4 | "maintainer": "qmk", | ||
5 | "layouts": { | ||
6 | "LAYOUT_all": { | ||
7 | "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":"Back Space", "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}, {"label":"ISO \\", "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":"\u2191", "x":15.25, "y":4.5}, {"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":"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":6.25}, {"label":"Alt", "x":10.25, "y":5.25, "w":1.25}, {"x":11.5, "y":5.25, "w":1.25}, {"label":"Ctrl", "x":12.75, "y":5.25, "w":1.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}, {"label":"0", "x":17.5, "y":5.25}, {"label":".", "x":18.5, "y":5.25}, {"x":19.5, "y":5.25}] | ||
8 | }, | ||
9 | |||
10 | "LAYOUT": { | ||
11 | "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":"\u2191", "x":15.25, "y":4.5}, {"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":"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":"Ctrl", "x":12.5, "y":5.25, "w":1.5}, {"label":"\u2190", "x":14.25, "y":5.5}, {"label":"\u2193", "x":15.25, "y":5.5}, {"label":"\u2192", "x":16.25, "y":5.5}, {"label":"0", "x":17.5, "y":5.25}, {"label":".", "x":18.5, "y":5.25}] | ||
12 | } | ||
13 | } | ||
14 | } | ||
diff --git a/keyboards/duck/jetfire/jetfire.c b/keyboards/duck/jetfire/jetfire.c new file mode 100644 index 000000000..9bb02ca22 --- /dev/null +++ b/keyboards/duck/jetfire/jetfire.c | |||
@@ -0,0 +1,161 @@ | |||
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 "indicator_leds.h" | ||
18 | |||
19 | enum BACKLIGHT_AREAS { | ||
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 | |||
28 | enum 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 | |||
39 | uint8_t backlight_rgb_r = 255; | ||
40 | uint8_t backlight_rgb_g = 0; | ||
41 | uint8_t backlight_rgb_b = 0; | ||
42 | uint8_t backlight_state_led = 1<<STATE_LED_LAYER_0; | ||
43 | |||
44 | |||
45 | void 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 | |||
104 | void 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 | |||
115 | void 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 | void backlight_update_state() | ||
125 | { | ||
126 | cli(); | ||
127 | send_color(backlight_state_led & (1<<STATE_LED_SCROLL_LOCK) ? 255 : 0, | ||
128 | backlight_state_led & (1<<STATE_LED_CAPS_LOCK) ? 255 : 0, | ||
129 | backlight_state_led & (1<<STATE_LED_NUM_LOCK) ? 255 : 0, | ||
130 | Device_STATUSLED); | ||
131 | send_color(backlight_state_led & (1<<STATE_LED_LAYER_1) ? 255 : 0, | ||
132 | backlight_state_led & (1<<STATE_LED_LAYER_2) ? 255 : 0, | ||
133 | backlight_state_led & (1<<STATE_LED_LAYER_0) ? 255 : 0, | ||
134 | Device_STATUSLED); | ||
135 | send_color(backlight_state_led & (1<<STATE_LED_LAYER_4) ? 255 : 0, | ||
136 | backlight_state_led & (1<<STATE_LED_LAYER_3) ? 255 : 0, | ||
137 | 0, | ||
138 | Device_STATUSLED); | ||
139 | sei(); | ||
140 | show(); | ||
141 | } | ||
142 | |||
143 | void led_set_kb(uint8_t usb_led) | ||
144 | { | ||
145 | if(usb_led & (1<<USB_LED_CAPS_LOCK)) { | ||
146 | backlight_state_led |= 1<<STATE_LED_CAPS_LOCK; | ||
147 | } else { | ||
148 | backlight_state_led &= ~(1<<STATE_LED_CAPS_LOCK); | ||
149 | } | ||
150 | if(usb_led & (1<<USB_LED_SCROLL_LOCK)) { | ||
151 | backlight_state_led |= 1<<STATE_LED_SCROLL_LOCK; | ||
152 | } else { | ||
153 | backlight_state_led &= ~(1<<STATE_LED_SCROLL_LOCK); | ||
154 | } | ||
155 | if(usb_led & (1<<USB_LED_NUM_LOCK)) { | ||
156 | backlight_state_led |= 1<<STATE_LED_NUM_LOCK; | ||
157 | } else { | ||
158 | backlight_state_led &= ~(1<<STATE_LED_NUM_LOCK); | ||
159 | } | ||
160 | backlight_update_state(); | ||
161 | } | ||
diff --git a/keyboards/duck/jetfire/jetfire.h b/keyboards/duck/jetfire/jetfire.h new file mode 100644 index 000000000..3c4834bce --- /dev/null +++ b/keyboards/duck/jetfire/jetfire.h | |||
@@ -0,0 +1,58 @@ | |||
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 | #pragma once | ||
17 | |||
18 | #include "quantum.h" | ||
19 | |||
20 | // This a shortcut to help you visually see your layout. | ||
21 | // The following is an example using the Planck MIT layout | ||
22 | // The first section contains all of the arguments representing the physical | ||
23 | // layout of the board and position of the keys | ||
24 | // The second converts the arguments into a two-dimensional array which | ||
25 | // represents the switch matrix. | ||
26 | |||
27 | #define LAYOUT_all( \ | ||
28 | K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T, \ | ||
29 | K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, K4R, K4S, K4T, \ | ||
30 | K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, K3P, K3Q, K3R, K3S, K3T, \ | ||
31 | K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2O, K2Q, K2R, K2S, K2T, \ | ||
32 | K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1O, K1P, K1Q, K1R, K1S, K1T, \ | ||
33 | K0A, K0B, K0C, K0I, K0L, K0M, K0N, K0O, K0P, K0Q, K0R, K0S, K0T \ | ||
34 | ) { \ | ||
35 | { K5A, KC_NO, K5C, K5D, K5E, K5F, KC_NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T }, \ | ||
36 | { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, K4R, K4S, K4T }, \ | ||
37 | { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, KC_NO, K3O, K3P, K3Q, K3R, K3S, K3T }, \ | ||
38 | { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, KC_NO, KC_NO, K2O, KC_NO, K2Q, K2R, K2S, K2T }, \ | ||
39 | { K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, KC_NO, K1M, K1N, K1O, K1P, K1Q, K1R, K1S, K1T }, \ | ||
40 | { 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 } \ | ||
41 | } | ||
42 | |||
43 | #define LAYOUT( \ | ||
44 | K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T, \ | ||
45 | K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, K4P, K4Q, K4R, K4S, K4T, \ | ||
46 | K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, K3P, K3Q, K3R, K3S, K3T, \ | ||
47 | K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2O, K2Q, K2R, K2S, \ | ||
48 | K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1P, K1Q, K1R, K1S, K1T, \ | ||
49 | K0A, K0B, K0C, K0I, K0M, K0N, K0O, K0P, K0Q, K0R, K0S \ | ||
50 | ) { \ | ||
51 | { K5A, KC_NO, K5C, K5D, K5E, K5F, KC_NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T }, \ | ||
52 | { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, KC_NO, K4O, K4P, K4Q, K4R, K4S, K4T }, \ | ||
53 | { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, KC_NO, K3O, K3P, K3Q, K3R, K3S, K3T }, \ | ||
54 | { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, KC_NO, KC_NO, K2O, KC_NO, K2Q, K2R, K2S, KC_NO }, \ | ||
55 | { K1A, KC_NO, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, KC_NO, K1M, K1N, KC_NO, K1P, K1Q, K1R, K1S, K1T }, \ | ||
56 | { 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 } \ | ||
57 | } | ||
58 | |||
diff --git a/keyboards/duck/jetfire/keymaps/default/keymap.c b/keyboards/duck/jetfire/keymaps/default/keymap.c new file mode 100644 index 000000000..05ffa7a93 --- /dev/null +++ b/keyboards/duck/jetfire/keymaps/default/keymap.c | |||
@@ -0,0 +1,27 @@ | |||
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 | |||
18 | const 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 | }; | ||
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..2dd94a72a --- /dev/null +++ b/keyboards/duck/jetfire/matrix.c | |||
@@ -0,0 +1,277 @@ | |||
1 | /* | ||
2 | Copyright 2016 Ralf Schmitt <[email protected]> | ||
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 | This program is distributed in the hope that it will be useful, | ||
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | GNU General Public License for more details. | ||
11 | You should have received a copy of the GNU General Public License | ||
12 | along 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 | |||
24 | static uint8_t debouncing = DEBOUNCE; | ||
25 | |||
26 | /* matrix state(1:on, 0:off) */ | ||
27 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
28 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
29 | |||
30 | static uint8_t read_rows(uint8_t col); | ||
31 | static void init_ports(void); | ||
32 | static void unselect_cols(void); | ||
33 | static void select_col(uint8_t col); | ||
34 | |||
35 | __attribute__ ((weak)) | ||
36 | void matrix_init_kb(void) { | ||
37 | matrix_init_user(); | ||
38 | } | ||
39 | |||
40 | __attribute__ ((weak)) | ||
41 | void matrix_scan_kb(void) { | ||
42 | matrix_scan_user(); | ||
43 | } | ||
44 | |||
45 | __attribute__ ((weak)) | ||
46 | void matrix_init_user(void) { | ||
47 | } | ||
48 | |||
49 | __attribute__ ((weak)) | ||
50 | void matrix_scan_user(void) { | ||
51 | } | ||
52 | |||
53 | inline | ||
54 | uint8_t matrix_rows(void) | ||
55 | { | ||
56 | return MATRIX_ROWS; | ||
57 | } | ||
58 | |||
59 | inline | ||
60 | uint8_t matrix_cols(void) | ||
61 | { | ||
62 | return MATRIX_COLS; | ||
63 | } | ||
64 | |||
65 | void 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 | |||
75 | void 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 | |||
86 | uint8_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 = DEBOUNCE; | ||
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 | |||
119 | bool matrix_is_modified(void) | ||
120 | { | ||
121 | if (debouncing) return false; | ||
122 | return true; | ||
123 | } | ||
124 | |||
125 | inline | ||
126 | bool matrix_is_on(uint8_t row, uint8_t col) | ||
127 | { | ||
128 | return (matrix[row] & ((matrix_row_t)1<<col)); | ||
129 | } | ||
130 | |||
131 | inline | ||
132 | matrix_row_t matrix_get_row(uint8_t row) | ||
133 | { | ||
134 | return matrix[row]; | ||
135 | } | ||
136 | |||
137 | void 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 | |||
145 | uint8_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 | |||
154 | static 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 | |||
168 | static 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 | |||
189 | static void unselect_cols(void) | ||
190 | { | ||
191 | PORTF &= 0b11111100; | ||
192 | PORTC &= 0b00111111; | ||
193 | PORTB &= 0b10001110; | ||
194 | PORTD &= 0b01111111; | ||
195 | } | ||
196 | |||
197 | static 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..8de2f5ced --- /dev/null +++ b/keyboards/duck/jetfire/readme.md | |||
@@ -0,0 +1,18 @@ | |||
1 | # Jetfire | ||
2 | |||
3 |  | ||
4 | |||
5 | The Duck Jetfire is a hybrid full size and 1800 layout keyboard that went on | ||
6 | Group Buy in November 2017. | ||
7 | |||
8 | Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin) | ||
9 | Hardware Supported: Duck Jetfire PCB | ||
10 | Hardware Availability: [Geekhack GB](https://geekhack.org/index.php?topic=92708.0) | ||
11 | |||
12 | **Reset Key:** To put the Jetfire into reset, hold top most key above the 2 navigation keys (`K5P`) while plugging in. | ||
13 | |||
14 | Make example for this keyboard (after setting up your build environment): | ||
15 | |||
16 | make duck/jetfire:default | ||
17 | |||
18 | See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. | ||
diff --git a/keyboards/duck/jetfire/rules.mk b/keyboards/duck/jetfire/rules.mk new file mode 100644 index 000000000..30c22841a --- /dev/null +++ b/keyboards/duck/jetfire/rules.mk | |||
@@ -0,0 +1,23 @@ | |||
1 | # MCU name | ||
2 | MCU = atmega32u4 | ||
3 | |||
4 | # Bootloader selection | ||
5 | BOOTLOADER = atmel-dfu | ||
6 | |||
7 | # Build Options | ||
8 | # change yes to no to disable | ||
9 | # | ||
10 | BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite | ||
11 | MOUSEKEY_ENABLE = no # Mouse keys | ||
12 | EXTRAKEY_ENABLE = no # Audio control and System control | ||
13 | CONSOLE_ENABLE = yes # Console for debug | ||
14 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
15 | NKRO_ENABLE = no # Enable N-Key Rollover | ||
16 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | ||
17 | BACKLIGHT_DRIVER = custom | ||
18 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow | ||
19 | AUDIO_ENABLE = no # Audio output | ||
20 | |||
21 | CUSTOM_MATRIX = yes | ||
22 | SRC += indicator_leds.c \ | ||
23 | matrix.c duck_led/duck_led.c | ||