satan-gh60

Configuration for my GH60 mechanical keyboard.
git clone https://noxz.tech/git/satan-gh60.git
Log | Files | README | LICENSE

commit: a3047d9803afe25a5060c596bd0961cbca7413f6
parent: 
author: Chris Noxz <chris@noxz.tech>
date:   Tue, 22 Jan 2019 19:48:08 +0100
Initial commit
AMakefile32+++++
AREADME35+++++
Aconfig.h5+
Aconfig.mk3+
Akeymap.c136++++++++++++++++++++
Arules.mk21+++
6 files changed, 232 insertions(+)
diff --git a/Makefile b/Makefile
@@ -0,0 +1,32 @@
+.POSIX:
+
+include config.mk
+
+options:
+	@echo satan-gh60 build options:
+	@echo "INSTALLATION DIRECTORY   = $(INSTALL_DIR)"
+	@echo "QMK REPOSITORY           = $(QMK_REPO)"
+	@echo "TKG REPOSITORY           = $(TKG_REPO)"
+
+all: clean
+	@echo [*] creating installation directory...
+	@mkdir -p "$(INSTALL_DIR)"
+	@echo
+	@echo [*] copying configuration...
+	@cp config.h keymap.c rules.mk "$(INSTALL_DIR)"
+	@echo
+	@echo [*] compiling firmware...
+	@sh -c 'cd "$(QMK_REPO)"; make clean; make satan:custom'
+	@echo
+
+flash: all
+	@echo [*] flashing firmware...
+	@sh -c 'cd "$(TKG_REPO)"; echo 'Y' | \
+		sudo ./reflash.sh "$(QMK_REPO)/.build/satan_custom.hex"'
+
+clean:
+	@echo cleaning installation directory...
+	@[ -d "$(INSTALL_DIR)" ] && rm -r "$(INSTALL_DIR)"
+	@echo
+
+.PHONY: all options clean flash
diff --git a/README b/README
@@ -0,0 +1,35 @@
+Satan GH60 (RevCHN)
+===================
+This tool is used for creating my configuration for a Satan GH60 RevCHN
+mechanical keyboard. There are three parts to this tool, the configuration
+(including keymap.c, config.h & rules.mk), the compilation and the flashing to
+AVR microcontroller.
+
+My keyboard consists of a 4 layer configuration, the base layer, function layer
+with some XF86 keys, arrow keys layer and a pseudo mouse layer. See `keymap.c`
+for specifics.
+
+Prerequisites
+-------------
+Before being able to compile the source code the QMK firmware is needed, which
+can be cloned using `git clone https://github.com/qmk/qmk_firmware`. The
+`avr-gcc` compiler is also needed together with some other prerequisites (read
+more on [qmk.fm](https://qmk.fm)).
+
+Before being able to flash the microcontroller the TKG toolkit is needed and
+configured. Clone using `git clone https://github.com/kairyu/tkg-toolkit`. `cd`
+into tkg-toolkit and run `./setup.sh`. For a Satan GH60, you'll choose:
+
+    2. GH60 RevCHN
+    Y (continue)
+    1. Default
+    1. atmel_dfu
+
+Installation
+------------
+When all is prepared the firmware with my config can be compiled and flashed
+using:
+
+    make flash
+
+get source [here](//git.noxz.tech/satan-gh60/).
diff --git a/config.h b/config.h
@@ -0,0 +1,5 @@
+/* tapping toggle requires 3 taps */
+#ifdef TAPPING_TOGGLE
+#undef TAPPING_TOGGLE
+#endif
+#define TAPPING_TOGGLE 3
diff --git a/config.mk b/config.mk
@@ -0,0 +1,3 @@
+QMK_REPO = $$HOME/.source/qmk_firmware
+TKG_REPO = $$HOME/.source/tkg-toolkit/linux
+INSTALL_DIR = $(QMK_REPO)/keyboards/satan/keymaps/custom
diff --git a/keymap.c b/keymap.c
@@ -0,0 +1,136 @@
+#include QMK_KEYBOARD_H
+
+/* Blank ANSI layer (template)
+ * .-------------------------------------------------------------------------.
+ * |    |    |    |    |    |    |    |    |    |    |    |    |    |        |
+ * |-------------------------------------------------------------------------|
+ * |       |    |    |    |    |    |    |    |    |    |    |    |    |     |
+ * |-------------------------------------------------------------------------|
+ * |        |    |    |    |    |    |    |    |    |    |    |    |         |
+ * |-------------------------------------------------------------------------|
+ * |          |    |    |    |    |    |    |    |    |    |    |            |
+ * |-------------------------------------------------------------------------|
+ * |      |     |     |                             |     |     |     |      |
+ * '-------------------------------------------------------------------------'
+ */
+
+/* layer indeces                                                            */
+#define _BL     0                   /* base layer: default qwerty           */
+#define _FL1    1                   /* function layer: media and extra      */
+#define _FL2    2                   /* function layer: arrow keys           */
+#define _FL3    3                   /* function layer: mouse movements      */
+
+/* key code definitions                                                     */
+#define ___X___ KC_NO               /* undefined key                        */
+#define ___T___ KC_TRNS             /* transparent key                      */
+#define KC_FL1  MO(_FL1)            /* function layer 1 key   (momentary)   */
+#define KC_FL2  TT(_FL2)            /* function layer 2 key  (tap toggle)   */
+#define KC_FL3  TO(_FL3)            /* function layer 3 key     (move to)   */
+#define KC_TBL  TO(_BL)             /* return to base layer                 */
+#define KC_ECPY LCTL(LSFT(KC_C))    /* extra copy  (st terminal emulator)   */
+#define KC_EPST LCTL(LSFT(KC_V))    /* extra paste (st terminal emulator)   */
+
+/* keymap definitions */
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* ================= Keymap _BL: (Base Layer) Default Layer ==================
+ * .-------------------------------------------------------------------------.
+ * | ~  | 1  | 2  | 3  | 4  | 5  | 6  | 7  | 8  | 9  | 0  | -  | =  | Backsp |
+ * |-------------------------------------------------------------------------|
+ * | Tab   | Q  | W  | E  | R  | T  | Y  | U  | I  | O  | P  | [  | ]  | \   |
+ * |-------------------------------------------------------------------------|
+ * | ESC    | A  | S  | D  | F  | G  | H  | J  | K  | L  | ;  | '  |  Return |
+ * |-------------------------------------------------------------------------|
+ * | Shift    | Z  | X  | C  | V  | B  | N  | M  | ,  | .  | /  |      Shift |
+ * |-------------------------------------------------------------------------|
+ * | Ctrl | GUI | Alt |            Space            | Alt | FL1 | FL2 | Ctrl |
+ * '-------------------------------------------------------------------------'
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ [_BL] = LAYOUT_60_ansi(
+ 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_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_ESC,  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_LSFT,          KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH,          KC_RSFT, \
+ \
+ KC_LCTL, KC_LGUI, KC_LALT,                            KC_SPC,                             KC_RALT, KC_FL1,  KC_FL2,  KC_RCTL  ),
+
+
+
+/* ====================== Keymap _FL1: Function Layer 1 ======================
+ * .-------------------------------------------------------------------------.
+ * |    | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10| F11| F12| Delete |
+ * |-------------------------------------------------------------------------|
+ * |       | VDN|MUTE| VUP|    |    |    |    |    |    |    |    | PRT| INS |
+ * |-------------------------------------------------------------------------|
+ * | CAPS   |    |    |    |    |    |HOME|PgDn|PgUp| END|    |    |         |
+ * |-------------------------------------------------------------------------|
+ * |          | REW|PLAY| FRW|    |    |    |    |PREV|NEXT|PAUS|            |
+ * |-------------------------------------------------------------------------|
+ * |      |     |     |                             |     |     |     |      |
+ * '-------------------------------------------------------------------------'
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ [_FL1] = LAYOUT_60_ansi(
+ ___X___, 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_DEL,  \
+ \
+ ___T___, KC_VOLD, KC_MUTE, KC_VOLU, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, KC_PSCR, KC_INS,  \
+ \
+ KC_CAPS, ___X___, ___X___, ___X___, ___X___, ___X___, KC_HOME, KC_PGDN, KC_PGUP, KC_END,  ___X___, ___X___,          ___T___, \
+ \
+ ___T___,          KC_MPRV, KC_MPLY, KC_MNXT, ___X___, ___X___, ___X___, ___X___, KC_MRWD, KC_MFFD, KC_PAUS,          ___T___, \
+ \
+ ___T___, ___T___, ___T___,                            ___X___,                            ___T___, ___T___, ___X___, ___T___  ),
+
+
+
+/* ====================== Keymap _FL2: Function Layer 2 ======================
+ * .-------------------------------------------------------------------------.
+ * |    |    |    |    |    |    |    |    |    |    |    |    |    |        |
+ * |-------------------------------------------------------------------------|
+ * |       |    | UP |    |    |    |    |    |    |    |    |    |    |     |
+ * |-------------------------------------------------------------------------|
+ * | TO_BL  |LEFT|DOWN|RGHT|    |    |LEFT|DOWN| UP |RGHT|    |    |         |
+ * |-------------------------------------------------------------------------|
+ * |          |    |    |COPY|PAST|    |    | FL3|    |    |    |            |
+ * |-------------------------------------------------------------------------|
+ * |      |     |     |                             |     |     |     |      |
+ * '-------------------------------------------------------------------------'
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ [_FL2] = LAYOUT_60_ansi(
+ ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, \
+ \
+ ___T___, ___X___, KC_UP,   ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, \
+ \
+ KC_TBL,  KC_LEFT, KC_DOWN, KC_RGHT, ___X___, ___X___, KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT, ___X___, ___X___,          ___T___, \
+ \
+ ___T___,          ___X___, ___X___, KC_ECPY, KC_EPST, ___X___, ___X___, KC_FL3,  ___X___, ___X___, ___X___,          ___T___, \
+ \
+ ___T___, ___T___, ___T___,                            ___T___,                            ___T___, ___X___, ___T___, ___T___  ),
+
+
+
+/* ====================== Keymap _FL3: Function Layer 3 ======================
+ * .-------------------------------------------------------------------------.
+ * |    | AC0| AC1| AC2|    |    |    |    |    |    |    |    |    |        |
+ * |-------------------------------------------------------------------------|
+ * |       |    | SU |    |    |    |    | LB | RB |    |    |    |    |     |
+ * |-------------------------------------------------------------------------|
+ * | TO_BL  | SL | SD | SR |    |    | CL | CD | CU | CR |    |    |   RB    |
+ * |-------------------------------------------------------------------------|
+ * |          |    |    |    |    |    |    |    |    |    |    |            |
+ * |-------------------------------------------------------------------------|
+ * |      |     |     |            LB               |     |     |     |      |
+ * '-------------------------------------------------------------------------'
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ [_FL3] = LAYOUT_60_ansi(
+ ___X___, KC_ACL0, KC_ACL1, KC_ACL2, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, \
+ \
+ ___T___, ___X___, KC_WH_U, ___X___, ___X___, ___X___, ___X___, KC_BTN1, KC_BTN2, ___X___, ___X___, ___X___, ___X___, ___X___, \
+ \
+ KC_TBL,  KC_WH_L, KC_WH_D, KC_WH_R, ___X___, ___X___, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, ___X___, ___X___,          KC_BTN2, \
+ \
+ ___T___,          ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___, ___X___,          ___T___, \
+ \
+ ___T___, ___T___, ___T___,                            KC_BTN1,                            ___T___, ___X___, ___T___, ___T___  )
+};
diff --git a/rules.mk b/rules.mk
@@ -0,0 +1,21 @@
+# 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 controls
+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