From d28fb63fac9c10cdec3703b205c3f1a30643c771 Mon Sep 17 00:00:00 2001 From: drashna Date: Fri, 29 Sep 2017 14:52:37 -0700 Subject: updated drashna's keymaps (#1769) * Add woodpad * Cleanup * Remove misc layouts for woodpad * Move woodpad to handwired * Updated RGB Underglow info --- keyboards/handwired/woodpad/config.h | 185 +++++++++ .../handwired/woodpad/keymaps/default/config.h | 24 ++ .../handwired/woodpad/keymaps/default/keymap.c | 135 +++++++ .../handwired/woodpad/keymaps/default/readme.md | 1 + .../handwired/woodpad/keymaps/default/rules.mk | 37 ++ .../handwired/woodpad/keymaps/drashna/config.h | 42 ++ .../handwired/woodpad/keymaps/drashna/keymap.c | 440 +++++++++++++++++++++ .../handwired/woodpad/keymaps/drashna/rules.mk | 10 + keyboards/handwired/woodpad/readme.md | 28 ++ keyboards/handwired/woodpad/rules.mk | 81 ++++ keyboards/handwired/woodpad/woodpad.c | 43 ++ keyboards/handwired/woodpad/woodpad.h | 40 ++ 12 files changed, 1066 insertions(+) create mode 100644 keyboards/handwired/woodpad/config.h create mode 100644 keyboards/handwired/woodpad/keymaps/default/config.h create mode 100644 keyboards/handwired/woodpad/keymaps/default/keymap.c create mode 100644 keyboards/handwired/woodpad/keymaps/default/readme.md create mode 100644 keyboards/handwired/woodpad/keymaps/default/rules.mk create mode 100644 keyboards/handwired/woodpad/keymaps/drashna/config.h create mode 100644 keyboards/handwired/woodpad/keymaps/drashna/keymap.c create mode 100644 keyboards/handwired/woodpad/keymaps/drashna/rules.mk create mode 100644 keyboards/handwired/woodpad/readme.md create mode 100644 keyboards/handwired/woodpad/rules.mk create mode 100644 keyboards/handwired/woodpad/woodpad.c create mode 100644 keyboards/handwired/woodpad/woodpad.h (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/woodpad/config.h b/keyboards/handwired/woodpad/config.h new file mode 100644 index 000000000..2c8a8bef7 --- /dev/null +++ b/keyboards/handwired/woodpad/config.h @@ -0,0 +1,185 @@ +/* +Copyright 2017 REPLACE_WITH_YOUR_NAME + +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 . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6069 +#define DEVICE_VER 0x0001 +#define MANUFACTURER WoodKeys.click +#define PRODUCT woodpad +#define DESCRIPTION Basic numpad + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 4 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ +#define MATRIX_ROW_PINS { D1, D0, D4, C6, D7 } +#define MATRIX_COL_PINS { B1, B3, B2, B6 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ +#define DIODE_DIRECTION COL2ROW + +// #define BACKLIGHT_PIN B7 +// #define BACKLIGHT_BREATHING +// #define BACKLIGHT_LEVELS 3 + + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ + +/* 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 + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Magic Key Options + * + * Magic keys are hotkey commands that allow control over firmware functions of + * the keyboard. They are best used in combination with the HID Listen program, + * found here: https://www.pjrc.com/teensy/hid_listen.html + * + * The options below allow the magic key functionality to be changed. This is + * useful if your keyboard/keypad is missing keys and you want magic key support. + * + */ + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* control how magic key switches layers */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false + +/* override magic key keymap */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM +//#define MAGIC_KEY_HELP1 H +//#define MAGIC_KEY_HELP2 SLASH +//#define MAGIC_KEY_DEBUG D +//#define MAGIC_KEY_DEBUG_MATRIX X +//#define MAGIC_KEY_DEBUG_KBD K +//#define MAGIC_KEY_DEBUG_MOUSE M +//#define MAGIC_KEY_VERSION V +//#define MAGIC_KEY_STATUS S +//#define MAGIC_KEY_CONSOLE C +//#define MAGIC_KEY_LAYER0_ALT1 ESC +//#define MAGIC_KEY_LAYER0_ALT2 GRAVE +//#define MAGIC_KEY_LAYER0 0 +//#define MAGIC_KEY_LAYER1 1 +//#define MAGIC_KEY_LAYER2 2 +//#define MAGIC_KEY_LAYER3 3 +//#define MAGIC_KEY_LAYER4 4 +//#define MAGIC_KEY_LAYER5 5 +//#define MAGIC_KEY_LAYER6 6 +//#define MAGIC_KEY_LAYER7 7 +//#define MAGIC_KEY_LAYER8 8 +//#define MAGIC_KEY_LAYER9 9 +//#define MAGIC_KEY_BOOTLOADER PAUSE +//#define MAGIC_KEY_LOCK CAPS +//#define MAGIC_KEY_EEPROM E +//#define MAGIC_KEY_NKRO N +//#define MAGIC_KEY_SLEEP_LED Z + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +//#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 1 + +#endif diff --git a/keyboards/handwired/woodpad/keymaps/default/config.h b/keyboards/handwired/woodpad/keymaps/default/config.h new file mode 100644 index 000000000..f52a97bbc --- /dev/null +++ b/keyboards/handwired/woodpad/keymaps/default/config.h @@ -0,0 +1,24 @@ +/* Copyright 2017 REPLACE_WITH_YOUR_NAME + * + * 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 . + */ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +// place overrides here + +#endif diff --git a/keyboards/handwired/woodpad/keymaps/default/keymap.c b/keyboards/handwired/woodpad/keymaps/default/keymap.c new file mode 100644 index 000000000..1fa90ba91 --- /dev/null +++ b/keyboards/handwired/woodpad/keymaps/default/keymap.c @@ -0,0 +1,135 @@ +/* Copyright 2017 REPLACE_WITH_YOUR_NAME + * + * 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 . + */ +#include "woodpad.h" + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _NUMLOCK 0 +#define _NAV 1 +#define _ALT 2 +#define _ADJUST 3 + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[_NUMLOCK] = KEYMAP( /* Base */ + KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,\ + KC_P7, KC_P8, KC_P9, KC_PPLS, \ + KC_P4, KC_P5, KC_P6, KC_PEQL, \ + KC_P1, KC_P2, KC_P3, KC_COMM, \ + KC_LALT, KC_P0, KC_PDOT, KC_PENT \ +), +[_NAV] = KEYMAP( /* Base */ + _______, _______, _______, _______,\ + KC_HOME, KC_UP, KC_PGUP, _______, \ + KC_LEFT, XXXXXXX, KC_RIGHT, _______, \ + KC_END, KC_DOWN, KC_PGDN, _______, \ + _______, KC_INS, KC_DEL, _______ \ +), +[_ALT] = KEYMAP( /* Base */ + _______, KC_MUTE, KC_VOLD, KC_VOLU,\ + _______, _______, _______, _______, \ + _______, _______, _______, _______, \ + _______, _______, _______, _______, \ + _______, _______, _______, _______ \ +), +[_ADJUST] = KEYMAP( /* Base */ + _______, KC_A, _______, RESET,\ + _______, _______, _______, _______, \ + _______, _______, _______, _______, \ + _______, _______, _______, _______, \ + _______, _______, _______, _______ \ +), +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +void numlock_led_on(void) { + PORTF |= (1<<7); +} + +void numlock_led_off(void) { + PORTF &= ~(1<<7); +} + +static bool numlock_down = false; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_NLCK: + if (record->event.pressed) { + numlock_down = true; + if (IS_LAYER_ON(_ALT)) { + layer_on(_ADJUST); + } + } else{ + if(!IS_LAYER_ON(_ADJUST)) { + if (!IS_LAYER_ON(_NAV)){ + numlock_led_off(); + layer_on(_NAV); + } else { + numlock_led_on(); + layer_off(_NAV); + } + } else { + layer_off(_ADJUST); + } + numlock_down = false; + } + return false; + break; + case KC_LALT: + if (record->event.pressed) { + if (numlock_down) { + layer_on(_ADJUST); + } else { + layer_on(_ALT); + } + } else { + if(IS_LAYER_ON(_ADJUST)) { + layer_off(_ADJUST); + } else { + layer_off(_ALT); + } + } + // Allow normal processing of ALT? + return false; + break; + } + return true; +} + +void matrix_init_user(void) { + // set Numlock LED to output and low + DDRF |= (1<<7); + PORTF &= ~(1<<7); + +} + +void matrix_scan_user(void) { + +} + + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/handwired/woodpad/keymaps/default/readme.md b/keyboards/handwired/woodpad/keymaps/default/readme.md new file mode 100644 index 000000000..5f1740978 --- /dev/null +++ b/keyboards/handwired/woodpad/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for woodpad diff --git a/keyboards/handwired/woodpad/keymaps/default/rules.mk b/keyboards/handwired/woodpad/keymaps/default/rules.mk new file mode 100644 index 000000000..b8879076b --- /dev/null +++ b/keyboards/handwired/woodpad/keymaps/default/rules.mk @@ -0,0 +1,37 @@ +# Copyright 2013 Jun Wako +# +# 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 . + + +# QMK Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/handwired/woodpad/keymaps/drashna/config.h b/keyboards/handwired/woodpad/keymaps/drashna/config.h new file mode 100644 index 000000000..e25a10d0b --- /dev/null +++ b/keyboards/handwired/woodpad/keymaps/drashna/config.h @@ -0,0 +1,42 @@ +/* Copyright 2017 REPLACE_WITH_YOUR_NAME + * + * 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 . + */ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#ifdef TAP_DANCE_ENABLE +#define TAPPING_TERM 200 +#endif // TAP_DANCE_ENABLE + + + +#ifdef RGBLIGHT_ENABLE +#define RGB_DI_PIN D3 +#define RGBLED_NUM 7 // Number of LEDs +#define RGBLIGHT_ANIMATIONS +#define RGBLIGHT_HUE_STEP 12 +#define RGBLIGHT_SAT_STEP 12 +#define RGBLIGHT_VAL_STEP 12 +#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2 +#define RGBLIGHT_EFFECT_SNAKE_LENGTH 2 +#define RGBLIGHT_EFFECT_BREATHE_CENTER 1 +#endif // RGBLIGHT_ENABLE + + + +#endif diff --git a/keyboards/handwired/woodpad/keymaps/drashna/keymap.c b/keyboards/handwired/woodpad/keymaps/drashna/keymap.c new file mode 100644 index 000000000..a33a7ab46 --- /dev/null +++ b/keyboards/handwired/woodpad/keymaps/drashna/keymap.c @@ -0,0 +1,440 @@ +/* Copyright 2017 REPLACE_WITH_YOUR_NAME + * + * 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 . + */ +#include "woodpad.h" + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _NUMLOCK 0 +#define _NAV 1 +#define _DIABLO 2 +#define _MACROS 3 +#define _MEDIA 4 + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO + + +//define layer change stuff for underglow indicator +bool skip_leds = false; + +bool is_overwatch = false; + +//This is both for underglow, and Diablo 3 macros +bool has_layer_changed = false; +static uint8_t current_layer; + +#ifdef TAP_DANCE_ENABLE +//define diablo macro timer variables +static uint16_t diablo_timer[4]; +static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 }; +static uint8_t diablo_key_time[4]; + + +bool check_dtimer(uint8_t dtimer) { + // has the correct number of seconds elapsed (as defined by diablo_times) + return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true; +}; +#endif + + +enum custom_keycodes { + PLACEHOLDER = SAFE_RANGE, // can always be here + KC_DIABLO_CLEAR, + KC_OVERWATCH, + KC_SALT, + KC_MORESALT, + KC_SALTHARD, + KC_GOODGAME, + KC_SYMM, + KC_DOOMFIST, + KC_JUSTGAME, + KC_GLHF, + KC_TORB +}; + +#ifdef TAP_DANCE_ENABLE +enum { + TD_DIABLO_1 = 0, + TD_DIABLO_2, + TD_DIABLO_3, + TD_DIABLO_4 +}; + + +// Cycle through the times for the macro, starting at 0, for disabled. +// Max of six values, so don't exceed +void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) { + if (state->count >= 7) { + diablo_key_time[diablo_key] = diablo_times[0]; + reset_tap_dance(state); + } + else { + diablo_key_time[diablo_key] = diablo_times[state->count - 1]; + } +} + + +// Would rather have one function for all of this, but no idea how to do that... +void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) { + diablo_tapdance_master(state, user_data, 0); +} + +void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) { + diablo_tapdance_master(state, user_data, 1); +} + +void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) { + diablo_tapdance_master(state, user_data, 2); +} + +void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) { + diablo_tapdance_master(state, user_data, 3); +} + + + +//Tap Dance Definitions +qk_tap_dance_action_t tap_dance_actions[] = { + // tap once to disable, and more to enable timed micros + [TD_DIABLO_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1), + [TD_DIABLO_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2), + [TD_DIABLO_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3), + [TD_DIABLO_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4), + +}; +#endif + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[_NUMLOCK] = KEYMAP( /* Base */ + TG(_NAV), TG(_DIABLO), TG(_MACROS), KC_PSLS,\ + KC_P7, KC_P8, KC_P9, KC_PAST, \ + KC_P4, KC_P5, KC_P6, KC_PMNS, \ + KC_P1, KC_P2, KC_P3, KC_PPLS, \ + LT(_MEDIA,KC_P0), KC_PDOT, KC_COLN, KC_PENT \ +), +[_NAV] = KEYMAP( /* Base */ + _______, _______, _______, _______,\ + KC_HOME, KC_UP, KC_PGUP, _______, \ + KC_LEFT, XXXXXXX, KC_RIGHT, _______, \ + KC_END, KC_DOWN, KC_PGDN, _______, \ + KC_INS, KC_DEL, _______, _______ \ +), +#ifdef TAP_DANCE_ENABLE +[_DIABLO] = KEYMAP( /* Base */ + KC_ESC, _______, _______, _______,\ + KC_S, KC_F, KC_I, KC_M, \ + KC_1, KC_2, KC_3, KC_4, \ + TD(TD_DIABLO_1), TD(TD_DIABLO_2), TD(TD_DIABLO_3), TD(TD_DIABLO_4), \ + _______, KC_DIABLO_CLEAR, KC_Q, SFT_T(KC_SPACE) \ +), +#else +[_DIABLO] = KEYMAP( /* Base */ + KC_ESC, _______, _______, _______,\ + KC_S, KC_F, KC_I, KC_M, \ + KC_1, KC_2, KC_3, KC_4, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + _______, KC_DIABLO_CLEAR, KC_Q, SFT_T(KC_SPACE) \ +), + +#endif + +[_MACROS] = KEYMAP( /* Base */ + KC_OVERWATCH, _______, _______, XXXXXXX,\ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, KC_JUSTGAME, \ + KC_SYMM, KC_DOOMFIST, KC_TORB, KC_GOODGAME, \ + KC_SALT, KC_MORESALT, KC_SALTHARD, KC_GLHF \ +), +[_MEDIA] = KEYMAP( /* Base */ + _______, KC_MUTE, KC_VOLD, KC_VOLU,\ + _______, _______, RGB_HUI, RGB_HUD, \ + KC_MPLY, KC_MSTP, KC_MPRV, KC_MNXT, \ + RGB_TOG, RGB_MOD, RGB_SAI, RGB_VAI, \ + _______, _______, RGB_SAD, RGB_VAD \ +), + +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + switch (id) { + case 0: + if (record->event.pressed) { + // Output Keyboard Firmware info + SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP ); + return false; + } + } + return MACRO_NONE; +}; +void numlock_led_on(void) { + PORTF |= (1<<7); +} + +void numlock_led_off(void) { + PORTF &= ~(1<<7); +} + + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + uint16_t kc; + if (is_overwatch) { + kc = KC_BSPC; + } else { + kc = KC_ENTER; + } + switch (keycode) { +#ifdef TAP_DANCE_ENABLE + case KC_DIABLO_CLEAR: // reset all Diable timers, disabling them + if (record->event.pressed) { + uint8_t dtime; + + for (dtime = 0; dtime < 4; dtime++) { + diablo_key_time[dtime] = diablo_times[0]; + } + } + return false; + break; +#endif + case KC_OVERWATCH: // reset all Diable timers, disabling them + if (record->event.pressed) { + is_overwatch = !is_overwatch; + has_layer_changed = true; + } + return false; + break; + case KC_SALT: + if (!record->event.pressed) { + register_code(kc); + unregister_code(kc); + _delay_ms(50); + SEND_STRING("Salt, salt, salt..."); + register_code(KC_ENTER); + unregister_code(KC_ENTER); + } + return false; + break; + case KC_MORESALT: + if (!record->event.pressed) { + register_code(kc); + unregister_code(kc); + _delay_ms(50); + SEND_STRING("Please sir, can I have some more salt?!"); + register_code(KC_ENTER); + unregister_code(KC_ENTER); + } + return false; + break; + case KC_SALTHARD: + if (!record->event.pressed) { + register_code(kc); + unregister_code(kc); + _delay_ms(50); + SEND_STRING("Your salt only makes my penis that much harder, and even more aggressive!"); + register_code(KC_ENTER); + unregister_code(KC_ENTER); + } + return false; + break; + case KC_GOODGAME: + if (!record->event.pressed) { + register_code(kc); + unregister_code(kc); + _delay_ms(50); + SEND_STRING("Good game, everyone!"); + register_code(KC_ENTER); + unregister_code(KC_ENTER); + } + return false; + break; + case KC_GLHF: + if (!record->event.pressed) { + register_code(kc); + unregister_code(kc); + _delay_ms(50); + SEND_STRING("Good luck, have fun!!!"); + register_code(KC_ENTER); + unregister_code(KC_ENTER); + } + return false; + break; + case KC_SYMM: + if (!record->event.pressed) { + register_code(kc); + unregister_code(kc); + _delay_ms(50); + SEND_STRING("Left click to win!"); + register_code(KC_ENTER); + unregister_code(KC_ENTER); + } + return false; + break; + case KC_DOOMFIST: + if (!record->event.pressed) { + register_code(kc); + unregister_code(kc); + _delay_ms(50); + SEND_STRING("Hey, look at me. I'm Doomfist, and I'm overpowered! All I do is spam punches all day! I'm DPS, tank and defense, rolled into one! All I need is team healing to be complete!"); + register_code(KC_ENTER); + unregister_code(KC_ENTER); + } + return false; + break; + case KC_JUSTGAME: + + if (!record->event.pressed) { + register_code(kc); + unregister_code(kc); + _delay_ms(50); + SEND_STRING("It may be a game, but if you don't want to actually try, please go play AI, so that people that actually want to take the game seriously and \"get good\" have a place to do so without trolls like you throwing games."); + register_code(KC_ENTER); + unregister_code(KC_ENTER); + } + return false; + break; + case KC_TORB: + + if (!record->event.pressed) { + register_code(kc); + unregister_code(kc); + _delay_ms(50); + SEND_STRING("That was positively riveting!"); + register_code(KC_ENTER); + unregister_code(KC_ENTER); + } + return false; + break; + + } + return true; +} +#ifdef TAP_DANCE_ENABLE + +// Sends the key press to system, but only if on the Diablo layer +void send_diablo_keystroke(uint8_t diablo_key) { + if (current_layer == _DIABLO) { + switch (diablo_key) { + case 0: + SEND_STRING("1"); + break; + case 1: + SEND_STRING("2"); + break; + case 2: + SEND_STRING("3"); + break; + case 3: + SEND_STRING("4"); + break; + } + } +} + +// Checks each of the 4 timers/keys to see if enough time has elapsed +// Runs the "send string" command if enough time has passed, and resets the timer. +void run_diablo_macro_check(void) { + uint8_t dtime; + + for (dtime = 0; dtime < 4; dtime++) { + if (check_dtimer(dtime) && diablo_key_time[dtime]) { + diablo_timer[dtime] = timer_read(); + send_diablo_keystroke(dtime); + } + } + +} +#endif +void matrix_init_user(void) { + has_layer_changed = true; + // set Numlock LED to output and low + DDRF |= (1<<7); + PORTF &= ~(1<<7); +} + +void matrix_scan_user(void) { + uint8_t layer = biton32(layer_state); +#ifdef RGBLIGHT_ENABLE + + numlock_led_off(); + // Check layer, and apply color if its changed since last check + switch (layer) { + case _NAV: + if (has_layer_changed) { + rgblight_sethsv(240, 255, 255); + rgblight_mode(1); + } + break; + case _MACROS: + if (has_layer_changed) { + rgblight_sethsv(30, 255, 255); + if (is_overwatch) { + rgblight_mode(17); + } else { + rgblight_mode(18); + } + } + if (is_overwatch) { + numlock_led_on(); + } + break; + case _DIABLO: + if (has_layer_changed) { + rgblight_sethsv(0, 255, 255); + rgblight_mode(5); + } + break; + case _MEDIA: + if (has_layer_changed) { + rgblight_sethsv(120, 255, 255); + rgblight_mode(22); + } + break; + default: + if (has_layer_changed) { + rgblight_sethsv(195, 255, 255); + rgblight_mode(1); + } + break; + } + + #endif + // Update layer status at the end, so this sets the default color + // rather than relying on the init, which was unreliably... + // Probably due to a timing issue, but this requires no additional code + if (current_layer == layer) { + has_layer_changed = false; + } + else { + has_layer_changed = true; + current_layer = layer; + } + // Run Diablo 3 macro checking code. +#ifdef TAP_DANCE_ENABLE + run_diablo_macro_check(); +#endif +} + + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/handwired/woodpad/keymaps/drashna/rules.mk b/keyboards/handwired/woodpad/keymaps/drashna/rules.mk new file mode 100644 index 000000000..0aeb409a8 --- /dev/null +++ b/keyboards/handwired/woodpad/keymaps/drashna/rules.mk @@ -0,0 +1,10 @@ +TAP_DANCE_ENABLE = yes +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +COMMAND_ENABLE = no # Commands for debug and configuration +RGBLIGHT_ENABLE = yes +MIDI_ENABLE = no +CONSOLE_ENABLE = no + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/handwired/woodpad/readme.md b/keyboards/handwired/woodpad/readme.md new file mode 100644 index 000000000..2697398c9 --- /dev/null +++ b/keyboards/handwired/woodpad/readme.md @@ -0,0 +1,28 @@ +woodpad keyboard firmware +====================== + +## Quantum MK Firmware + +For the full Quantum feature list, see [the parent readme](/). + +## Building + +Download or clone the whole firmware and navigate to the keyboards/woodpad folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Teensy Loader to program your .hex file. + +Depending on which keymap you would like to use, you will have to compile slightly differently. + +### Default + +To build with the default keymap, simply run `make default`. + +### Other Keymaps + +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create a folder with the name of your keymap in the keymaps folder, and see keymap documentation (you can find in top readme.md) and existant keymap files. + +To build the firmware binary hex file with a keymap just do `make` with a keymap like this: + +``` +$ make [default|jack|] +``` + +Keymaps follow the format **__\.c__** and are stored in the `keymaps` folder. diff --git a/keyboards/handwired/woodpad/rules.mk b/keyboards/handwired/woodpad/rules.mk new file mode 100644 index 000000000..7612f4b49 --- /dev/null +++ b/keyboards/handwired/woodpad/rules.mk @@ -0,0 +1,81 @@ +# MCU name +#MCU = at90usb1286 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +CONSOLE_ENABLE ?= yes # Console for debug(+400) +COMMAND_ENABLE ?= yes # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE ?= no # USB Nkey Rollover +BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE ?= no # MIDI support (+2400 to 4200, depending on config) +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE ?= no # Audio output on port C6 +FAUXCLICKY_ENABLE ?= no # Use buzzer to emulate clicky switches +RGBLIGHT_ENABLE ?= no + +#avrdude: build +# ls /dev/tty* > /tmp/1; \ +# echo "Reset your Pro Micro now"; \ +# while [ -z $$USB ]; do \ +# sleep 1; \ +# ls /dev/tty* > /tmp/2; \ +# USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ +# done; \ +# avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex +# +#.PHONY: avrdude \ No newline at end of file diff --git a/keyboards/handwired/woodpad/woodpad.c b/keyboards/handwired/woodpad/woodpad.c new file mode 100644 index 000000000..15a87f2ea --- /dev/null +++ b/keyboards/handwired/woodpad/woodpad.c @@ -0,0 +1,43 @@ +/* Copyright 2017 REPLACE_WITH_YOUR_NAME + * + * 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 . + */ +#include "woodpad.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + matrix_init_user(); +} + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + + matrix_scan_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware + + return process_record_user(keycode, record); +} + +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + + led_set_user(usb_led); +} diff --git a/keyboards/handwired/woodpad/woodpad.h b/keyboards/handwired/woodpad/woodpad.h new file mode 100644 index 000000000..13ec0bfc2 --- /dev/null +++ b/keyboards/handwired/woodpad/woodpad.h @@ -0,0 +1,40 @@ +/* Copyright 2017 REPLACE_WITH_YOUR_NAME + * + * 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 . + */ +#ifndef WOODPAD_H +#define WOODPAD_H + +#include "quantum.h" + +// This a shortcut to help you visually see your layout. +// The following is an example using the Planck MIT layout +// The first section contains all of the arguments +// The second converts the arguments into a two-dimensional array +#define KEYMAP( \ + k00, k01, k02, k03, \ + k10, k11, k12, k13, \ + k20, k21, k22, k23, \ + k30, k31, k32, k33, \ + k40, k41, k42, k43 \ +) \ +{ \ + { k00, k01, k02, k03 }, \ + { k10, k11, k12, k13 }, \ + { k20, k21, k22, k23 }, \ + { k30, k31, k32, k33 }, \ + { k40, k41, k42, k43 }, \ +} + +#endif -- cgit v1.2.3