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) |
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 0000000000..1e42f13d4f --- /dev/null +++ b/keyboards/tanuki/config.h @@ -0,0 +1,82 @@ +/* +Copyright 2015 Jun Wako <wakojun@gmail.com> + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6464 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Seth +#define PRODUCT Tanuki PCB version +#define DESCRIPTION Handwired 40% keyboard + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 11 + +#define MATRIX_COL_PINS { B3 , B2 , B6 , B5 , B4 , E6 , D7 , C6 , F4 , F5 , F6 } +#define MATRIX_ROW_PINS { F7 , B1 , D4 , D0 } +#define UNUSED_PINS + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +#define RGB_DI_PIN D1 +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 5 +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 + + +#define TAPPING_TERM 200 +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +#endif diff --git a/keyboards/tanuki/keymaps/default/keymap.c b/keyboards/tanuki/keymaps/default/keymap.c new file mode 100644 index 0000000000..607b197f50 --- /dev/null +++ b/keyboards/tanuki/keymaps/default/keymap.c @@ -0,0 +1,141 @@ +#include QMK_KEYBOARD_H +#include "rgblight.h" + +//Layer definitions +#define _BL 0 +#define _DL 1 +#define _UL 2 +#define _GL 3 +#define _BK 4 + + +//other variables +int mCalled = 0; +bool blockToggle = false; +bool lRGB = true; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_BL] = LAYOUT( + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ + KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, TG(_GL), \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_QUOT, KC_SLSH, KC_ENT, \ + KC_TAB, KC_ESC, KC_LCTL, KC_LALT, KC_COMMA, LT(_DL,KC_SPC), LT(_UL,KC_SPC), KC_DOT, KC_LGUI), + +[_DL] = LAYOUT( + KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,\ + KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS,\ + KC_TRNS, KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_F1, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + +[_UL] = LAYOUT( + KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, KC_PIPE, KC_BSLS, KC_PLUS, KC_UNDS, KC_MINS, KC_EQL, KC_DEL,\ + KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_TRNS, \ + KC_TRNS, KC_FN0, RGB_TOG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_SAD, RGB_VAD, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_GRV, KC_TRNS, RGB_MOD, RGB_HUI, KC_TRNS, KC_TRNS, RGB_SAI, RGB_VAI), + +[_GL] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + +[_BK] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_FN1, KC_NO, KC_NO), + +}; + + +//KC_MPLY, KC_VOLU, KC_VOLD, KC_TRNS, KC_TRNS, KC_MNXT, KC_MPRV +//function to toggle the interactive rgb variable +bool toggleLayerRGB(void){ + if(lRGB == true){ + return false; + } + else{ + return true; + } +} + +void matrix_init_user(void){ + rgblight_enable(); + rgblight_mode(1); + rgblight_sethsv(0,10,255); +} + +//check for layer and if there was a keypress change underglow lighting +void matrix_scan_kb(void){ + if(lRGB == true) + { + + + + //base layer + if(layer_state == 0x00000000 && mCalled == 1 ){ + rgblight_sethsv(0,10,255); + mCalled = 0; + } + + //down layer + else if(layer_state == 0x00000002 && mCalled == 1){ + rgblight_sethsv(160,255,255); + mCalled = 0; + } + + + //up layer with rgb access blocked + else if(layer_state == 0x00000004 && mCalled == 1 && lRGB == true){ + //blockToggle = true; + layer_state = 0x00000014; + rgblight_sethsv(180,255,255); + mCalled = 0; + } + + //arrow cluster layer + else if(layer_state == 0x00000008 && mCalled == 1){ + rgblight_sethsv(0,180,255); + mCalled = 0; + } + + //if on blocked layer and the spacebar has been released reset to baselayer and set colours to white + else if(layer_state == 0x00000014 && blockToggle == true ) + { + blockToggle = false; + layer_state = 0x00000000; + rgblight_sethsv(0,10,255); + } + + } +} + +//set mCalled to 1 when a button is pressed to make sure the leds aren't continuesly updated. +bool process_record_user (uint16_t keycode, keyrecord_t *record) { + mCalled = 1; + + //uncommenting the line below causes the lights to flicker when typing on the keyboard. + //rgblight_sethsv(0,255,0); + + if(keycode == KC_FN0 && record->event.pressed){ + //set the toggle and make sure to set the colour back to white + lRGB = toggleLayerRGB(); + rgblight_enable(); + rgblight_mode(1); + rgblight_sethsv(0,255,255); + layer_state =0x00000000; + + return false; + } + + //check if spacebar is released when on a different layer + if(keycode == KC_FN1){ + if(record ->event.pressed){ + }else{ + blockToggle = true; + } + } + + return true; +} diff --git a/keyboards/tanuki/readme.md b/keyboards/tanuki/readme.md new file mode 100644 index 0000000000..331df5b2ea --- /dev/null +++ b/keyboards/tanuki/readme.md @@ -0,0 +1,15 @@ +# Tanuki + +![Tanuki](https://github.com/SethSenpai/Tanuki/blob/master/Img/glamour1.jpg?raw=true) + +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). + +Keyboard Maintainer: [SethSenpai](https://github.com/SethSenpai) +Hardware Supported: Tanuki pcb, pro micro +Hardware Availability: [Tanuki repo](https://github.com/SethSenpai/Tanuki) + +Make example for this keyboard (after setting up your build environment): + + make tanuki:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. diff --git a/keyboards/tanuki/rules.mk b/keyboards/tanuki/rules.mk new file mode 100644 index 0000000000..cc3734152f --- /dev/null +++ b/keyboards/tanuki/rules.mk @@ -0,0 +1,70 @@ + + +# MCU name +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +BOOTLOADER=caterina + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +RGBLIGHT_ENABLE =yes # Enable keyboard underlight functionality (+4870) +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality (+1150) +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +TAP_DANCE_ENABLE = no + +ifndef QUANTUM_DIR + include ../../Makefile +endif diff --git a/keyboards/tanuki/tanuki.c b/keyboards/tanuki/tanuki.c new file mode 100644 index 0000000000..573e200611 --- /dev/null +++ b/keyboards/tanuki/tanuki.c @@ -0,0 +1,10 @@ +#include "tanuki.h" +#include "rgblight.h" +#include "config.h" +#include "rgblight.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + +}; diff --git a/keyboards/tanuki/tanuki.h b/keyboards/tanuki/tanuki.h new file mode 100644 index 0000000000..6b686adafa --- /dev/null +++ b/keyboards/tanuki/tanuki.h @@ -0,0 +1,22 @@ +#include "quantum.h" + + +// readability +#define XXX KC_NO + +// The first section contains all of the arguments +// The second converts the arguments into a two-dimensional array +#define LAYOUT( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, \ + k30, k31, k32, k33, k34, k35, k36, k38, k39 \ +) \ +{ \ + {k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a}, \ + {k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a}, \ + {k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a}, \ + {k30, k31, k32, k33, k34, k35, k36, XXX, k38, k39, XXX} \ +} + + |