Skip to content

Instantly share code, notes, and snippets.

@StorySpooler
Created June 17, 2018 16:55
Show Gist options
  • Save StorySpooler/d945d62568dd56c6a0a4a0ad62431ba2 to your computer and use it in GitHub Desktop.
Save StorySpooler/d945d62568dd56c6a0a4a0ad62431ba2 to your computer and use it in GitHub Desktop.
WhiteFox Keymap (QMK)
/*
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
#define PREVENT_STUCK_MODIFIERS
/* USB Device descriptor parameter */
#define VENDOR_ID 0x1c11
#define PRODUCT_ID 0xb04d
#define DEVICE_VER 0x0001
#define MANUFACTURER Input Club
#define PRODUCT WhiteFox/QMK
/* key matrix size */
#define MATRIX_ROWS 9
#define MATRIX_COLS 8
/* number of backlight levels */
#define BACKLIGHT_LEVELS 3
#define LED_BRIGHTNESS_LO 100
#define LED_BRIGHTNESS_HI 255
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 6
/* 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)) \
)
// Ensuring good usage of Grave ESC
#define GRAVE_ESC_CTRL_OVERRIDE
#define GRAVE_ESC_GUI_OVERRIDE
// Tapping Delay
#define TAPPING_TERM 200
#define IGNORE_MOD_TAP_INTERRUPT
/* Keymap for Infinity prototype */
//#define INFINITY_PROTOTYPE
/* Keymap for Infinity 1.1a (first revision with LED support) */
//#define INFINITY_LED
/*
* 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
#include "whitefox.h"
#include "backlight.h"
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
//Tap Dance Declarations
enum {
TD_PGDOWN_UP = 0
};
qk_tap_dance_action_t tap_dance_actions[] = {
//Tap once for Esc, twice for Caps Lock
[TD_PGDOWN_UP] = ACTION_TAP_DANCE_DOUBLE(KC_PGDN, KC_PGUP)
// Other declarations would go here, separated by commas, if you have them
};
enum whitefox_layers {
_QWERTY_WIN_TXT,
_QWERTY_WIN_GAMING,
_QWERTY_OSX,
_COLEMAK,
_FUNC_WIN,
_FUNC_OSX,
};
enum whitefox_keycodes {
QWERTY_WIN_TXT = SAFE_RANGE,
QWERTY_WIN_GAMING,
QWERTY_OSX,
COLEMAK,
FUNC_WIN,
FUNC_OSX
};
const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Layer 0: Qwerty Windows Programming
* ,---------------------------------------------------------------.
* |Esc/`| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| `|Bac|Del|
* |---------------------------------------------------------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |PgD/U|
* |---------------------------------------------------------------|
* |Ctrl(Bac)| A| S| D| F| G| H| J| K| L| ;| '|Enter|Hme|
* |---------------------------------------------------------------|
* |Shift/(| Z| X| C| V| B| N| M| ,| .| /|Shift/)|Up |End|
* |---------------------------------------------------------------|
* |Ctrl|Gui |Alt | Space |Alt |Fn | |Lef|Dow|Rig|
* `---------------------------------------------------------------'
*/
[_QWERTY_WIN_TXT] = LAYOUT_truefox( \
KC_GESC, 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_GRV, KC_BSPC, KC_DEL, \
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, TD(TD_PGDOWN_UP), \
CTL_T(KC_BSPC), 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_HOME,\
KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSPC, KC_UP, KC_END,\
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, FUNC_WIN, KC_LEFT,KC_DOWN,KC_RGHT \
),
/* Layer 1: Qwerty Windows Gaming
* ,---------------------------------------------------------------.
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| `|Bac|Del|
* |---------------------------------------------------------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |PgD|
* |---------------------------------------------------------------|
* |Bac | A| S| D| F| G| H| J| K| L| ;| '|Enter |Hme|
* |---------------------------------------------------------------|
* |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Up |End|
* |---------------------------------------------------------------|
* |Ctrl|Gui |Alt | Space |Alt |Fn | |Lef|Dow|Rig|
* `---------------------------------------------------------------'
*/
[_QWERTY_WIN_GAMING] = LAYOUT_truefox( \
KC_ESC, 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_GRV, KC_BSPC, KC_DEL, \
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_PGDN, \
KC_BSPC, 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_HOME,\
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_END,\
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, FUNC_WIN, KC_LEFT,KC_DOWN,KC_RGHT \
),
/* Layer 2: Qwerty OSX
* ,---------------------------------------------------------------.
* |Esc/`| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|`|Bac|Del|
* |---------------------------------------------------------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |PgD/U|
* |---------------------------------------------------------------|
* |Gui(Bac)| A| S| D| F| G| H| J| K| L| ;| '|Enter |Hme|
* |---------------------------------------------------------------|
* |Shift/(| Z| X| C| V| B| N| M| ,| .| /|Shift/)|Up |End|
* |---------------------------------------------------------------|
* |Ctrl| Alt | Gui | Space |Alt |Fn | |Lef|Dow|Rig|
* `---------------------------------------------------------------'
*/
[_QWERTY_OSX] = LAYOUT_truefox( \
KC_GESC, 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_GRV, KC_BSPC, KC_DEL, \
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, TD(TD_PGDOWN_UP), \
GUI_T(KC_BSPC), 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_HOME,\
KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSPC, KC_UP, KC_END,\
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, FUNC_OSX, KC_LEFT,KC_DOWN,KC_RGHT \
),
/* Layer 3: Colemak
* ,---------------------------------------------------------------.
* |Esc/`| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|`|Bac|Del|
* |---------------------------------------------------------------|
* |Tab | Q| W| F| P| G| J| L| U| Y| ;| [| ]| \ |PgD/U|
* |---------------------------------------------------------------|
* |Ctrl(Bac)| A| R| S| T| D| H| N| E| I| O| '|Enter|Hme|
* |---------------------------------------------------------------|
* |Shift/(| Z| X| C| V| B| K| M| ,| .| /|Shift/)|Up |End|
* |---------------------------------------------------------------|
* |Ctrl|Gui |Alt | Space |Alt |Fn | |Lef|Dow|Rig|
* `---------------------------------------------------------------'
*/
[_COLEMAK] = LAYOUT_truefox( \
KC_GESC, 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_GRV, KC_BSPC, KC_DEL, \
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_RBRC, KC_BSLS, TD(TD_PGDOWN_UP), \
CTL_T(KC_BSPC), KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, KC_HOME,\
KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSPC, KC_UP, KC_END,\
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, FUNC_WIN, KC_LEFT,KC_DOWN,KC_RGHT \
),
/* Function Windows
* ,---------------------------------------------------------------.
* | ` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | | |
* |---------------------------------------------------------------|
* | |MB1|MsU|MB2| | | | | |BckL|BckB|BckD|BckU| |Ins|
* |---------------------------------------------------------------|
* |CLck| MsL|MsD|MsR| | | | | | | | | | |
* |---------------------------------------------------------------|
* | |Qrty_Txt|Qrty_Gmg|Qrty_OSX|Colemak| | | | | | | |Vol+|Mut|
* |---------------------------------------------------------------|
* | | | | Play/Pause | | | |Prv|Vol-|Nxt|
* `---------------------------------------------------------------'
*/
[_FUNC_WIN] = LAYOUT_truefox( \
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, \
_______, KC_BTN1, KC_MS_U, KC_BTN2, _______, _______, _______, _______, _______, BL_TOGG, BL_BRTG, BL_DEC, BL_INC, _______, KC_INS, \
KC_CAPS, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\
_______, QWERTY_WIN_TXT, QWERTY_WIN_GAMING, QWERTY_OSX, COLEMAK, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, KC_MUTE,\
_______, _______, _______, KC_MPLY, _______, _______, KC_MPRV,KC_VOLD,KC_MNXT \
),
/* Function OSX
* ,---------------------------------------------------------------.
* | ` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| |BckL| |
* |---------------------------------------------------------------|
* | |MB1|MsU|MB2| | | | | |BckL|BckB|BckD|BckU| |Ins|
* |---------------------------------------------------------------|
* | CLck |MsL|MsD|MsR| | | | | | | | | | |
* |---------------------------------------------------------------|
* | |Qrty_Txt|Qrty_Gmg|Qrty_OSX|Colemak| | | | | | | |Vol+|Mut|
* |---------------------------------------------------------------|
* | | | | Play/Pause | | | |Prv|Vol-|Nxt|
* `---------------------------------------------------------------'
*/
[_FUNC_OSX] = LAYOUT_truefox( \
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, \
_______, KC_BTN1, KC_MS_U, KC_BTN2, _______, _______, _______, _______, _______, BL_TOGG, BL_BRTG, BL_DEC, BL_INC, _______, KC_INS, \
KC_CAPS, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\
_______, QWERTY_WIN_TXT, QWERTY_WIN_GAMING, QWERTY_OSX, COLEMAK, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, KC_MUTE,\
_______, _______, _______, KC_MPLY, _______, _______, KC_MRWD,KC_VOLD,KC_MFFD \
),
};
// const uint16_t fn_actions[] = {
// [0] = ACTION_LAYER_MOMENTARY(1),
// };
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY_WIN_TXT:
if (record->event.pressed) {
set_single_persistent_default_layer(_QWERTY_WIN_TXT);
}
return false;
break;
case QWERTY_WIN_GAMING:
if (record->event.pressed) {
set_single_persistent_default_layer(_QWERTY_WIN_GAMING);
}
return false;
break;
case QWERTY_OSX:
if (record->event.pressed) {
set_single_persistent_default_layer(_QWERTY_OSX);
}
return false;
break;
case COLEMAK:
if (record->event.pressed) {
set_single_persistent_default_layer(_COLEMAK);
}
return false;
break;
case FUNC_WIN:
if (record->event.pressed) {
layer_on(_FUNC_WIN);
} else {
layer_off(_FUNC_WIN);
}
return false;
break;
case FUNC_OSX:
if (record->event.pressed) {
layer_on(_FUNC_OSX);
} else {
layer_off(_FUNC_OSX);
}
return false;
break;
}
return true;
}
/* Copyright 2017 Fred Sundvik
*
* 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 KEYBOARDS_WHITEFOX_SIMPLE_VISUALIZER_H_
#define KEYBOARDS_WHITEFOX_SIMPLE_VISUALIZER_H_
#include "visualizer.h"
#include "visualizer_keyframes.h"
#include "led.h"
#include "default_animations.h"
static bool initial_update = true;
// Feel free to modify the animations below, or even add new ones if needed
void initialize_user_visualizer(visualizer_state_t* state) {
// The brightness will be dynamically adjustable in the future
// But for now, change it here.
initial_update = true;
start_keyframe_animation(&default_startup_animation);
}
void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) {
// Add more tests, change the colors and layer texts here
// Usually you want to check the high bits (higher layers first)
// because that's the order layers are processed for keypresses
// You can for check for example:
// state->status.layer
// state->status.default_layer
// state->status.leds (see led.h for available statuses)
if (initial_update) { initial_update=false; start_keyframe_animation(&led_test_animation); }
if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) {
backlight_toggle();
}
}
void user_visualizer_suspend(visualizer_state_t* state) {
start_keyframe_animation(&default_suspend_animation);
}
void user_visualizer_resume(visualizer_state_t* state) {
initial_update = true;
start_keyframe_animation(&default_startup_animation);
}
#endif /* KEYBOARDS_WHITEFOX_SIMPLE_VISUALIZER_H_ */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment