From 169d46ce83f2234216ac218ce588eefd7970b10b Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 24 Sep 2017 14:04:58 -0400 Subject: [PATCH] Add my gherkin keymap, and update readme and config --- keyboards/gherkin/README.md | 4 +- keyboards/gherkin/config.h | 6 +- keyboards/gherkin/keymaps/itsaferbie/config.h | 15 ++ keyboards/gherkin/keymaps/itsaferbie/keymap.c | 172 ++++++++++++++++++ keyboards/gherkin/keymaps/itsaferbie/rules.mk | 7 + 5 files changed, 199 insertions(+), 5 deletions(-) create mode 100644 keyboards/gherkin/keymaps/itsaferbie/config.h create mode 100644 keyboards/gherkin/keymaps/itsaferbie/keymap.c create mode 100644 keyboards/gherkin/keymaps/itsaferbie/rules.mk diff --git a/keyboards/gherkin/README.md b/keyboards/gherkin/README.md index 74093bbbee..210247af9a 100644 --- a/keyboards/gherkin/README.md +++ b/keyboards/gherkin/README.md @@ -5,8 +5,8 @@ A 30 key keyboard. * [The original TMK firmware](https://github.com/di0ib/tmk_keyboard/tree/master/keyboard/gherkin) -Keyboard Maintainer: QMK Community -Hardware Supported: Gherkin PCB +Keyboard Maintainer: QMK Community +Hardware Supported: Gherkin PCB Hardware Availability: [Gherkin project on 40% Keyboards](http://www.40percent.club/2016/11/gherkin.html) Make example for this keyboard (after setting up your build environment): diff --git a/keyboards/gherkin/config.h b/keyboards/gherkin/config.h index 27919efbbf..4607962d7c 100644 --- a/keyboards/gherkin/config.h +++ b/keyboards/gherkin/config.h @@ -7,9 +7,9 @@ #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x6060 #define DEVICE_VER 0x0001 -#define MANUFACTURER qmkbuilder -#define PRODUCT keyboard -#define DESCRIPTION Keyboard +#define MANUFACTURER 40 Percent Club +#define PRODUCT Gherkin +#define DESCRIPTION A 30 key ortholinear keyboard /* key matrix size */ #define MATRIX_ROWS 5 diff --git a/keyboards/gherkin/keymaps/itsaferbie/config.h b/keyboards/gherkin/keymaps/itsaferbie/config.h new file mode 100644 index 0000000000..71c0cb8b56 --- /dev/null +++ b/keyboards/gherkin/keymaps/itsaferbie/config.h @@ -0,0 +1,15 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#undef RGB_DI_PIN +#undef RGBLED_NUM +#define RGB_DI_PIN D2 +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 8 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +#endif \ No newline at end of file diff --git a/keyboards/gherkin/keymaps/itsaferbie/keymap.c b/keyboards/gherkin/keymaps/itsaferbie/keymap.c new file mode 100644 index 0000000000..155689bd3e --- /dev/null +++ b/keyboards/gherkin/keymaps/itsaferbie/keymap.c @@ -0,0 +1,172 @@ +#include "gherkin.h" +#include "action_layer.h" + +extern rgblight_config_t rgblight_config; +extern keymap_config_t keymap_config; + +#define _PS 0 // This is the Photoshop Layer +#define _AI 1 // This is the Illustrator Layer +#define _PR 2 // This is the Premier Layer + +enum custom_keycodes { + PS = SAFE_RANGE, + AI, + PR, +}; + +#define PS TO(0) +#define AI TO(1) +#define PR TO(2) + +// Mix of Photoshop, Illustrator, and Premiere shortcuts. +#define SAVE LCTL(KC_S) +#define OPEN LCTL(KC_O) +#define COPY LCTL(KC_C) +#define PAST LCTL(KC_V) +#define CUNDO LCTL(LALT(KC_Z)) +#define INVERT LCTL(LSFT(KC_I)) +#define NLAYER LSFT(LCTL(KC_N)) +#define UNDO LCTL(KC_Z) +#define TRANS LCTL(KC_T) +#define ALIGNL LCTL(LSFT(KC_L)) +#define ALIGNC LCTL(LSFT(KC_C)) +#define ALIGNR LCTL(LSFT(KC_R)) +#define BRINGF LCTL(KC_RBRC) +#define BRINGB LCTL(KC_LBRC) + +// Some illustrator only shortcuts. +#define SHAPE LSFT(KC_M) +#define RULER LCTL(LALT(KC_R)) + +// Premiere only shortcuts. +#define REDO LCTL(LSFT(KC_Z)) +#define EXPORT LCTL(KC_M) +#define IMPORT LCTL(KC_I) +#define PCOPY LCTL(KC_V) +#define PPASTE LCTL(LSFT(KC_V)) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + // Photoshop layer. + [_PS] = KEYMAP( + SAVE, KC_W, KC_E, KC_T, KC_U, KC_I, KC_P, INVERT, CUNDO, NLAYER, + UNDO, KC_H, KC_L, TRANS, ALIGNL, ALIGNC, ALIGNR, BRINGB, BRINGF, OPEN, + KC_LSFT, COPY, PAST, KC_Z, KC_C, KC_V, KC_B, KC_LBRC, KC_RBRC, AI), + + [_AI] = KEYMAP( + KC_TRNS, M(0), RULER, KC_TRNS, KC_G, KC_TRNS, KC_TRNS, KC_Q, KC_MINS, KC_PLUS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_E, KC_TRNS, KC_TRNS, KC_TRNS, SHAPE, KC_O, OPEN, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_M, KC_SLSH, PR), + + [_PR] = KEYMAP( + KC_TRNS, KC_Q, KC_W, KC_I, KC_O, KC_P, IMPORT, EXPORT, KC_MINS, KC_EQL, + KC_TRNS, REDO, KC_D, KC_F, KC_H, KC_M, KC_ENT, KC_LBRC, KC_RBRC, OPEN, + KC_TRNS, PCOPY, PPASTE, KC_SPC, KC_Z, KC_C, KC_V, KC_LEFT, KC_RIGHT, PS), + +}; + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +void matrix_init_user(void) { + rgblight_enable(); +} + +void matrix_scan_user(void) { + #ifdef RGBLIGHT_ENABLE + + static uint8_t old_layer = 255; + uint8_t new_layer = biton32(layer_state); + + // Color of the Icons. + if (old_layer != new_layer) { + switch (new_layer) { + case _PS: + rgblight_setrgb(49, 197, 240); + break; + case _AI: + rgblight_setrgb(255, 128, 17); + break; + case _PR: + rgblight_setrgb(231, 136, 255); + break; + } + old_layer = new_layer; + } + #endif +} + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + keyevent_t event = record->event; + (void)event; + + switch (id) { + case 0: + // Save for Web Macro. + return MACRO(D(LSFT), D(LALT), D(LCTL), T(S), U(LCTL), U(LALT), U(LSFT), END); + } + return MACRO_NONE; +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + // case PS: + // if (record->event.pressed) { + // layer_on(_PS); + + // RGB_current_mode = rgblight_config.mode; + // RGB_current_hue = rgblight_config.hue; + + // rgblight_mode(1); + // rgblight_setrgb(0,0,255); + // } + // // else { + // // layer_off(_PS); + + // // rgblight_mode(RGB_current_mode); + // // rgblight_sethsv(RGB_current_hue, rgblight_config.sat, rgblight_config.val); + // // } + // return false; + // break; + // case AI: + // if (record->event.pressed) { + // layer_on(_AI); + + // RGB_current_mode = rgblight_config.mode; + // RGB_current_hue = rgblight_config.hue; + + // // Set to orange. + // rgblight_mode(1); + // rgblight_setrgb(255, 0, 0); + // } + // // else { + // // layer_off(_AI); + + // // rgblight_mode(RGB_current_mode); + // // rgblight_sethsv(RGB_current_hue, rgblight_config.sat, rgblight_config.val); + // // } + // return false; + // break; + // case PR: + // if (record->event.pressed) { + // layer_on(_PR); + + // RGB_current_mode = rgblight_config.mode; + // RGB_current_hue = rgblight_config.hue; + + // // Set to purple. + // rgblight_mode(1); + // rgblight_setrgb(0, 255, 0); + // } else { + // layer_off(_PR); + + // rgblight_mode(RGB_current_mode); + // rgblight_sethsv(RGB_current_hue, rgblight_config.sat, rgblight_config.val); + // } + // return false; + // break; + } + return true; +} diff --git a/keyboards/gherkin/keymaps/itsaferbie/rules.mk b/keyboards/gherkin/keymaps/itsaferbie/rules.mk new file mode 100644 index 0000000000..ed0af7b8bd --- /dev/null +++ b/keyboards/gherkin/keymaps/itsaferbie/rules.mk @@ -0,0 +1,7 @@ +BACKLIGHT_ENABLE = yes +AUDIO_ENABLE = no +RGBLIGHT_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif \ No newline at end of file