diff options
author | Pim Ostendorf <pimwing@gmail.com> | 2018-05-05 19:47:32 +0200 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-05-05 10:47:32 -0700 |
commit | c9108f4b371bd39f728e5fdbc00407ab514aa8d6 (patch) | |
tree | eaf705fe2e6ddd660ae58a320e6a7ec4b7ee3753 | |
parent | 824e48f294a9de0a2c4816d294da5d93ec295bf1 (diff) | |
download | qmk_firmware-c9108f4b371bd39f728e5fdbc00407ab514aa8d6.tar.gz qmk_firmware-c9108f4b371bd39f728e5fdbc00407ab514aa8d6.zip |
Added Tanuki Keyboard (#2894)
* added tanuki
* updated definitions to new qmk standard
* complying with suggestions made by drashna
* update rulesfile
* used qmk template for readme file
-rw-r--r-- | keyboards/tanuki/config.h | 82 | ||||
-rw-r--r-- | keyboards/tanuki/keymaps/default/keymap.c | 141 | ||||
-rw-r--r-- | keyboards/tanuki/readme.md | 15 | ||||
-rw-r--r-- | keyboards/tanuki/rules.mk | 70 | ||||
-rw-r--r-- | keyboards/tanuki/tanuki.c | 10 | ||||
-rw-r--r-- | keyboards/tanuki/tanuki.h | 22 |
6 files changed, 340 insertions, 0 deletions
diff --git a/keyboards/tanuki/config.h b/keyboards/tanuki/config.h new file mode 100644 index 000000000..1e42f13d4 --- /dev/null +++ b/keyboards/tanuki/config.h | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | Copyright 2015 Jun Wako <wakojun@gmail.com> | ||
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 | #ifndef CONFIG_H | ||
19 | #define CONFIG_H | ||
20 | |||
21 | #include "config_common.h" | ||
22 | |||
23 | /* USB Device descriptor parameter */ | ||
24 | #define VENDOR_ID 0xFEED | ||
25 | #define PRODUCT_ID 0x6464 | ||
26 | #define DEVICE_VER 0x0001 | ||
27 | #define MANUFACTURER Seth | ||
28 | #define PRODUCT Tanuki PCB version | ||
29 | #define DESCRIPTION Handwired 40% keyboard | ||
30 | |||
31 | /* key matrix size */ | ||
32 | #define MATRIX_ROWS 4 | ||
33 | #define MATRIX_COLS 11 | ||
34 | |||
35 | #define MATRIX_COL_PINS { B3 , B2 , B6 , B5 , B4 , E6 , D7 , C6 , F4 , F5 , F6 } | ||
36 | #define MATRIX_ROW_PINS { F7 , B1 , D4 , D0 } | ||
37 | #define UNUSED_PINS | ||
38 | |||
39 | /* define if matrix has ghost */ | ||
40 | //#define MATRIX_HAS_GHOST | ||
41 | |||
42 | /* Set 0 if debouncing isn't needed */ | ||
43 | #define DEBOUNCE 5 | ||
44 | |||
45 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
46 | #define LOCKING_SUPPORT_ENABLE | ||
47 | /* Locking resynchronize hack */ | ||
48 | #define LOCKING_RESYNC_ENABLE | ||
49 | |||
50 | /* key combination for command */ | ||
51 | #define IS_COMMAND() ( \ | ||
52 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
53 | ) | ||
54 | |||
55 | #define RGB_DI_PIN D1 | ||
56 | #define RGBLIGHT_ANIMATIONS | ||
57 | #define RGBLED_NUM 5 | ||
58 | #define RGBLIGHT_HUE_STEP 10 | ||
59 | #define RGBLIGHT_SAT_STEP 17 | ||
60 | #define RGBLIGHT_VAL_STEP 17 | ||
61 | |||
62 | |||
63 | #define TAPPING_TERM 200 | ||
64 | /* | ||
65 | * Feature disable options | ||
66 | * These options are also useful to firmware size reduction. | ||
67 | */ | ||
68 | |||
69 | /* disable debug print */ | ||
70 | //#define NO_DEBUG | ||
71 | |||
72 | /* disable print */ | ||
73 | //#define NO_PRINT | ||
74 | |||
75 | /* disable action features */ | ||
76 | //#define NO_ACTION_LAYER | ||
77 | //#define NO_ACTION_TAPPING | ||
78 | //#define NO_ACTION_ONESHOT | ||
79 | //#define NO_ACTION_MACRO | ||
80 | //#define NO_ACTION_FUNCTION | ||
81 | |||
82 | #endif | ||
diff --git a/keyboards/tanuki/keymaps/default/keymap.c b/keyboards/tanuki/keymaps/default/keymap.c new file mode 100644 index 000000000..607b197f5 --- /dev/null +++ b/keyboards/tanuki/keymaps/default/keymap.c | |||
@@ -0,0 +1,141 @@ | |||
1 | #include QMK_KEYBOARD_H | ||
2 | #include "rgblight.h" | ||
3 | |||
4 | //Layer definitions | ||
5 | #define _BL 0 | ||
6 | #define _DL 1 | ||
7 | #define _UL 2 | ||
8 | #define _GL 3 | ||
9 | #define _BK 4 | ||
10 | |||
11 | |||
12 | //other variables | ||
13 | int mCalled = 0; | ||
14 | bool blockToggle = false; | ||
15 | bool lRGB = true; | ||
16 | |||
17 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
18 | |||
19 | [_BL] = LAYOUT( | ||
20 | KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ | ||
21 | KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, TG(_GL), \ | ||
22 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_QUOT, KC_SLSH, KC_ENT, \ | ||
23 | KC_TAB, KC_ESC, KC_LCTL, KC_LALT, KC_COMMA, LT(_DL,KC_SPC), LT(_UL,KC_SPC), KC_DOT, KC_LGUI), | ||
24 | |||
25 | [_DL] = LAYOUT( | ||
26 | KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,\ | ||
27 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS,\ | ||
28 | KC_TRNS, KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | ||
29 | KC_TRNS, KC_F1, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
30 | |||
31 | [_UL] = LAYOUT( | ||
32 | KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, KC_PIPE, KC_BSLS, KC_PLUS, KC_UNDS, KC_MINS, KC_EQL, KC_DEL,\ | ||
33 | KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_TRNS, \ | ||
34 | KC_TRNS, KC_FN0, RGB_TOG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_SAD, RGB_VAD, KC_TRNS, KC_TRNS, \ | ||
35 | KC_TRNS, KC_GRV, KC_TRNS, RGB_MOD, RGB_HUI, KC_TRNS, KC_TRNS, RGB_SAI, RGB_VAI), | ||
36 | |||
37 | [_GL] = LAYOUT( | ||
38 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, \ | ||
39 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, \ | ||
40 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | ||
41 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
42 | |||
43 | [_BK] = LAYOUT( | ||
44 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
45 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
46 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_TRNS, \ | ||
47 | KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_FN1, KC_NO, KC_NO), | ||
48 | |||
49 | }; | ||
50 | |||
51 | |||
52 | //KC_MPLY, KC_VOLU, KC_VOLD, KC_TRNS, KC_TRNS, KC_MNXT, KC_MPRV | ||
53 | //function to toggle the interactive rgb variable | ||
54 | bool toggleLayerRGB(void){ | ||
55 | if(lRGB == true){ | ||
56 | return false; | ||
57 | } | ||
58 | else{ | ||
59 | return true; | ||
60 | } | ||
61 | } | ||
62 | |||
63 | void matrix_init_user(void){ | ||
64 | rgblight_enable(); | ||
65 | rgblight_mode(1); | ||
66 | rgblight_sethsv(0,10,255); | ||
67 | } | ||
68 | |||
69 | //check for layer and if there was a keypress change underglow lighting | ||
70 | void matrix_scan_kb(void){ | ||
71 | if(lRGB == true) | ||
72 | { | ||
73 | |||
74 | |||
75 | |||
76 | //base layer | ||
77 | if(layer_state == 0x00000000 && mCalled == 1 ){ | ||
78 | rgblight_sethsv(0,10,255); | ||
79 | mCalled = 0; | ||
80 | } | ||
81 | |||
82 | //down layer | ||
83 | else if(layer_state == 0x00000002 && mCalled == 1){ | ||
84 | rgblight_sethsv(160,255,255); | ||
85 | mCalled = 0; | ||
86 | } | ||
87 | |||
88 | |||
89 | //up layer with rgb access blocked | ||
90 | else if(layer_state == 0x00000004 && mCalled == 1 && lRGB == true){ | ||
91 | //blockToggle = true; | ||
92 | layer_state = 0x00000014; | ||
93 | rgblight_sethsv(180,255,255); | ||
94 | mCalled = 0; | ||
95 | } | ||
96 | |||
97 | //arrow cluster layer | ||
98 | else if(layer_state == 0x00000008 && mCalled == 1){ | ||
99 | rgblight_sethsv(0,180,255); | ||
100 | mCalled = 0; | ||
101 | } | ||
102 | |||
103 | //if on blocked layer and the spacebar has been released reset to baselayer and set colours to white | ||
104 | else if(layer_state == 0x00000014 && blockToggle == true ) | ||
105 | { | ||
106 | blockToggle = false; | ||
107 | layer_state = 0x00000000; | ||
108 | rgblight_sethsv(0,10,255); | ||
109 | } | ||
110 | |||
111 | } | ||
112 | } | ||
113 | |||
114 | //set mCalled to 1 when a button is pressed to make sure the leds aren't continuesly updated. | ||
115 | bool process_record_user (uint16_t keycode, keyrecord_t *record) { | ||
116 | mCalled = 1; | ||
117 | |||
118 | //uncommenting the line below causes the lights to flicker when typing on the keyboard. | ||
119 | //rgblight_sethsv(0,255,0); | ||
120 | |||
121 | if(keycode == KC_FN0 && record->event.pressed){ | ||
122 | //set the toggle and make sure to set the colour back to white | ||
123 | lRGB = toggleLayerRGB(); | ||
124 | rgblight_enable(); | ||
125 | rgblight_mode(1); | ||
126 | rgblight_sethsv(0,255,255); | ||
127 | layer_state =0x00000000; | ||
128 | |||
129 | return false; | ||
130 | } | ||
131 | |||
132 | //check if spacebar is released when on a different layer | ||
133 | if(keycode == KC_FN1){ | ||
134 | if(record ->event.pressed){ | ||
135 | }else{ | ||
136 | blockToggle = true; | ||
137 | } | ||
138 | } | ||
139 | |||
140 | return true; | ||
141 | } | ||
diff --git a/keyboards/tanuki/readme.md b/keyboards/tanuki/readme.md new file mode 100644 index 000000000..331df5b2e --- /dev/null +++ b/keyboards/tanuki/readme.md | |||
@@ -0,0 +1,15 @@ | |||
1 | # Tanuki | ||
2 | |||
3 |  | ||
4 | |||
5 | The QMK firmware for the Tanuki 40% keyboard. The other files needed for construction can be found in the [Tanuki repo](https://github.com/SethSenpai/Tanuki). | ||
6 | |||
7 | Keyboard Maintainer: [SethSenpai](https://github.com/SethSenpai) | ||
8 | Hardware Supported: Tanuki pcb, pro micro | ||
9 | Hardware Availability: [Tanuki repo](https://github.com/SethSenpai/Tanuki) | ||
10 | |||
11 | Make example for this keyboard (after setting up your build environment): | ||
12 | |||
13 | make tanuki:default | ||
14 | |||
15 | 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/tanuki/rules.mk b/keyboards/tanuki/rules.mk new file mode 100644 index 000000000..cc3734152 --- /dev/null +++ b/keyboards/tanuki/rules.mk | |||
@@ -0,0 +1,70 @@ | |||
1 | |||
2 | |||
3 | # MCU name | ||
4 | MCU = atmega32u4 | ||
5 | |||
6 | # Processor frequency. | ||
7 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
8 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
9 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
10 | # automatically to create a 32-bit value in your source code. | ||
11 | # | ||
12 | # This will be an integer division of F_USB below, as it is sourced by | ||
13 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
14 | # does not *change* the processor frequency - it should merely be updated to | ||
15 | # reflect the processor speed set externally so that the code can use accurate | ||
16 | # software delays. | ||
17 | F_CPU = 16000000 | ||
18 | |||
19 | |||
20 | # | ||
21 | # LUFA specific | ||
22 | # | ||
23 | # Target architecture (see library "Board Types" documentation). | ||
24 | ARCH = AVR8 | ||
25 | |||
26 | # Input clock frequency. | ||
27 | # This will define a symbol, F_USB, in all source code files equal to the | ||
28 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
29 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
30 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
31 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
32 | # at the end, this will be done automatically to create a 32-bit value in your | ||
33 | # source code. | ||
34 | # | ||
35 | # If no clock division is performed on the input clock inside the AVR (via the | ||
36 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
37 | F_USB = $(F_CPU) | ||
38 | |||
39 | # Interrupt driven control endpoint task(+60) | ||
40 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
41 | |||
42 | |||
43 | # Boot Section Size in *bytes* | ||
44 | # Teensy halfKay 512 | ||
45 | # Teensy++ halfKay 1024 | ||
46 | # Atmel DFU loader 4096 | ||
47 | # LUFA bootloader 4096 | ||
48 | # USBaspLoader 2048 | ||
49 | BOOTLOADER=caterina | ||
50 | |||
51 | # Build Options | ||
52 | # comment out to disable the options. | ||
53 | # | ||
54 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
55 | MOUSEKEY_ENABLE = no # Mouse keys(+4700) | ||
56 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
57 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
58 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
59 | NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
60 | RGBLIGHT_ENABLE =yes # Enable keyboard underlight functionality (+4870) | ||
61 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality (+1150) | ||
62 | MIDI_ENABLE = no # MIDI controls | ||
63 | AUDIO_ENABLE = no | ||
64 | UNICODE_ENABLE = no # Unicode | ||
65 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
66 | TAP_DANCE_ENABLE = no | ||
67 | |||
68 | ifndef QUANTUM_DIR | ||
69 | include ../../Makefile | ||
70 | endif | ||
diff --git a/keyboards/tanuki/tanuki.c b/keyboards/tanuki/tanuki.c new file mode 100644 index 000000000..573e20061 --- /dev/null +++ b/keyboards/tanuki/tanuki.c | |||
@@ -0,0 +1,10 @@ | |||
1 | #include "tanuki.h" | ||
2 | #include "rgblight.h" | ||
3 | #include "config.h" | ||
4 | #include "rgblight.h" | ||
5 | |||
6 | void matrix_init_kb(void) { | ||
7 | // put your keyboard start-up code here | ||
8 | // runs once when the firmware starts up | ||
9 | |||
10 | }; | ||
diff --git a/keyboards/tanuki/tanuki.h b/keyboards/tanuki/tanuki.h new file mode 100644 index 000000000..6b686adaf --- /dev/null +++ b/keyboards/tanuki/tanuki.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #include "quantum.h" | ||
2 | |||
3 | |||
4 | // readability | ||
5 | #define XXX KC_NO | ||
6 | |||
7 | // The first section contains all of the arguments | ||
8 | // The second converts the arguments into a two-dimensional array | ||
9 | #define LAYOUT( \ | ||
10 | k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, \ | ||
11 | k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, \ | ||
12 | k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, \ | ||
13 | k30, k31, k32, k33, k34, k35, k36, k38, k39 \ | ||
14 | ) \ | ||
15 | { \ | ||
16 | {k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a}, \ | ||
17 | {k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a}, \ | ||
18 | {k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a}, \ | ||
19 | {k30, k31, k32, k33, k34, k35, k36, XXX, k38, k39, XXX} \ | ||
20 | } | ||
21 | |||
22 | |||