From 01f91bf6f40c4b5a1c06a942134402cec82a5d5d Mon Sep 17 00:00:00 2001 From: ajp10304 Date: Fri, 23 Feb 2018 18:21:56 +0000 Subject: JJ40 AJP10304 layout (#2407) * JJ40 AJP10304 layout Updated AJP10304 readme.md with formatting * Revert default JJ40 keymap --- keyboards/jj40/keymaps/ajp10304/config.h | 8 ++ keyboards/jj40/keymaps/ajp10304/jj40.h | 70 ++++++++++ keyboards/jj40/keymaps/ajp10304/keymap.c | 206 ++++++++++++++++++++++++++++++ keyboards/jj40/keymaps/ajp10304/readme.md | 91 +++++++++++++ keyboards/jj40/keymaps/ajp10304/rules.mk | 5 + 5 files changed, 380 insertions(+) create mode 100644 keyboards/jj40/keymaps/ajp10304/config.h create mode 100644 keyboards/jj40/keymaps/ajp10304/jj40.h create mode 100644 keyboards/jj40/keymaps/ajp10304/keymap.c create mode 100644 keyboards/jj40/keymaps/ajp10304/readme.md create mode 100644 keyboards/jj40/keymaps/ajp10304/rules.mk (limited to 'keyboards/jj40/keymaps') diff --git a/keyboards/jj40/keymaps/ajp10304/config.h b/keyboards/jj40/keymaps/ajp10304/config.h new file mode 100644 index 0000000000..11cafbefcb --- /dev/null +++ b/keyboards/jj40/keymaps/ajp10304/config.h @@ -0,0 +1,8 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#define PREVENT_STUCK_MODIFIERS + +#endif diff --git a/keyboards/jj40/keymaps/ajp10304/jj40.h b/keyboards/jj40/keymaps/ajp10304/jj40.h new file mode 100644 index 0000000000..a6162d9c08 --- /dev/null +++ b/keyboards/jj40/keymaps/ajp10304/jj40.h @@ -0,0 +1,70 @@ +/* +Copyright 2017 Luiz Ribeiro + +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 KEYMAP_COMMON_H +#define KEYMAP_COMMON_H + +#include "quantum.h" +// #include "keycode.h" +// #include "action.h" + +#define KEYMAP_GRID( \ + K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \ + K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \ + K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \ + K31, K32, K33, K34, K35, K36, K37, K38, K39, K310, K311, K312 \ +) \ +{ \ + { K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \ + { K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \ + { K312, K311, K310, K39, K35, K36, K37, K38, K34, K33, K32, K31 } \ +} + +#define KEYMAP_MIT( \ + K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \ + K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \ + K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \ + K31, K32, K33, K34, K35, K3X, K38, K39, K310, K311, K312 \ +) \ +{ \ + { K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \ + { K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \ + { K312, K311, K310, K39, K35, K3X, KC_NO, K38, K34, K33, K32, K31 } \ +} + +#define KEYMAP_OFFSET( \ + K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \ + K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \ + K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \ + K31, K32, K33, K34, K35, K36, K3X, K39, K310, K311, K312 \ +) \ +{ \ + { K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \ + { K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \ + { K312, K311, K310, K39, K35, K36, K3X, KC_NO, K34, K33, K32, K31 } \ +} + +#define KEYMAP KEYMAP_GRID +#define LAYOUT_ortho_4x12 LAYOUT_planck_grid + +#endif diff --git a/keyboards/jj40/keymaps/ajp10304/keymap.c b/keyboards/jj40/keymaps/ajp10304/keymap.c new file mode 100644 index 0000000000..e1c7e6b470 --- /dev/null +++ b/keyboards/jj40/keymaps/ajp10304/keymap.c @@ -0,0 +1,206 @@ +#include "jj40.h" +#include "action_layer.h" +#include "eeconfig.h" +#include "keymap_uk.h" + +extern keymap_config_t keymap_config; + +// 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 _QWERTY 0 +#define _LOWER 1 +#define _RAISE 2 +#define _FUNC 3 +#define _ADJUST 16 +#define _DYN 6 + +enum planck_keycodes { + QWERTY = SAFE_RANGE, + FUNC, + LOWER, + RAISE, + DYNAMIC_MACRO_RANGE +}; + +#include "dynamic_macro.h" + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Esc | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Tab | A | S | D | F | G | H | J | K | L | ;: | Enter| + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shft | Z | X | C | V | B | N | M | ,< | .> | /? | Shft | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Fn | Ctrl | Alt | GUI |Lower | Bksp |Space |Raise | Shift| MENU | Ctrl | Fn | + * `-----------------------------------------------------------------------------------' + */ +[_QWERTY] = KEYMAP(\ + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC ,\ + MT(MOD_LSFT, KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, MT(MOD_RSFT, KC_ENT) ,\ + KC_LSHIFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSHIFT ,\ + MO(_FUNC), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_BSPC, KC_SPC, RAISE, KC_LSHIFT, KC_BTN2, KC_RCTL, MO(_FUNC) \ +), + +/* Function + * ,-----------------------------------------------------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | 1! | 2" | 3£ | 4$ | 5% | 6^ | 7& | 8* | 9( | 0) | ~ |INSERT| + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| \| | `¬ | #~ | * | -_ | =+ | \| | [{ | ]} | '@ |Shift | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Fn | Ctrl | Alt | GUI |Lower | Bksp |Space |Raise | MENU | Alt | Ctrl | Fn | + * `-----------------------------------------------------------------------------------' + */ +[_FUNC] = KEYMAP(\ + 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_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, UK_TILD, KC_INSERT ,\ + KC_LSHIFT, KC_NONUS_BSLASH, KC_GRAVE, KC_NONUS_HASH, KC_PAST, KC_MINS, KC_EQL, KC_BSLASH, KC_LBRC, KC_RBRC, KC_QUOT, MT(MOD_RSFT, KC_ENT) ,\ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ +), + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | 1! | 2" | 3£ | 4$ | 5% | 6^ | 7& | 8* | 9( | 0) | DEL | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ! | " | £ | $ | % | ^ | & | * | ( | ) |WrdDel|WrdBks| + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| \| | `¬ | #~ | '@ | -_ | =+ | #~ | [{ | ]} | '@ |Shift | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | |Lower | Del |Space | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = KEYMAP(\ + KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, KC_BSPC ,\ + LSFT(KC_1), LSFT(KC_2), LSFT(KC_3), LSFT(KC_4), LSFT(KC_5), LSFT(KC_6), LSFT(KC_7), LSFT(KC_8), LSFT(KC_9), LSFT(KC_0), LCTL(KC_DEL), LCTL(KC_BSPC) ,\ + KC_LSPO, KC_NONUS_BSLASH, KC_GRAVE, KC_NONUS_HASH, KC_QUOT, KC_MINS, KC_EQL, KC_NONUS_HASH, KC_LBRC, KC_RBRC, KC_QUOT, MT(MOD_RSFT, KC_ENT) ,\ + _______, _______, _______, _______, _______, KC_DEL, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ +), + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | |WRDSEL| [ | ] | | | PGUP | HOME |PGDOWN| |PRNTSC| + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ` | | | ( | ) | | | HOME | UP | END | |ZOOM +| + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | { | } | | |< | LEFT | DOWN |RIGHT | >| |ZOOM -| + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | Alt | Enter|Raise | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = KEYMAP(\ + KC_GRV, XXXXXXX, M(1), KC_LBRC, KC_RBRC, XXXXXXX, XXXXXXX, KC_PGUP, KC_HOME, KC_PGDOWN, XXXXXXX, KC_PSCREEN ,\ + KC_GRV, XXXXXXX, XXXXXXX, LSFT(KC_9), LSFT(KC_0), XXXXXXX, XXXXXXX, KC_HOME, KC_UP, KC_END, XXXXXXX, LCTL(LSFT(KC_EQL)) ,\ + _______, XXXXXXX, XXXXXXX, LSFT(KC_LBRC), LSFT(KC_RBRC), XXXXXXX, LCTL(KC_LEFT), KC_LEFT, KC_DOWN, KC_RIGHT, LCTL(KC_RIGHT), LCTL(KC_MINS) ,\ + _______, _______, _______, _______, _______, KC_LALT, KC_ENT, _______, XXXXXXX, _______, _______, _______ \ +), + + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | ???? | Reset|Qwerty| | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | CAPS | | | | | | | Mute | Vol+ | Play | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | Prev | Vol- | Next | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | DYN | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = KEYMAP(\ + M(0), RESET, QWERTY, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL ,\ + KC_CAPS, _______, _______, _______, _______, _______, _______, KC_AUDIO_MUTE, KC_AUDIO_VOL_UP, KC_MEDIA_PLAY_PAUSE, _______, _______ ,\ + _______, _______, _______, _______, _______, _______, _______, KC_MEDIA_PREV_TRACK, KC_AUDIO_VOL_DOWN, KC_MEDIA_NEXT_TRACK, _______, _______ ,\ + _______, _______, _______, _______, _______, _______, _______, _______, MO(_DYN), _______, _______, _______ \ +), + +/* DYN: Macro Recording and Playback + * ,-----------------------------------------------------------------------------------. + * | | | | | | REC1 | REC2 | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | | | | PLAY1| PLAY2| | | | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | STOP | STOP | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_DYN]= KEYMAP(\ + _______, _______, _______, _______, _______, DYN_REC_START1, DYN_REC_START2, _______, _______, _______, _______, _______,\ + _______, _______, _______, _______, _______, DYN_MACRO_PLAY1, DYN_MACRO_PLAY2, _______, _______, _______, _______, _______,\ + _______, _______, _______, _______, _______, DYN_REC_STOP, DYN_REC_STOP, _______, _______, _______, _______, _______,\ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______\ +) + +}; + + +void persistant_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + + if (!process_record_dynamic_macro(keycode, record)) { + return false; + } + + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + persistant_default_layer_set(1UL<<_QWERTY); + } + return false; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + } + return true; +} + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + switch(id) { + // These would trigger when you hit a key mapped as M(0) + case 0: + if (record->event.pressed) { + return MACRO( + // SENSITIVE + END + ); + } + break; + case 1: // Word Select + if (record->event.pressed) { + return MACRO( + DOWN(KC_LCTL), DOWN(KC_RIGHT), UP(KC_RIGHT), DOWN(KC_LSFT), DOWN(KC_LEFT), UP(KC_LEFT), UP(KC_LSFT), UP(KC_LCTL), + END + ); + } + } + return MACRO_NONE; +}; diff --git a/keyboards/jj40/keymaps/ajp10304/readme.md b/keyboards/jj40/keymaps/ajp10304/readme.md new file mode 100644 index 0000000000..d35237c5d6 --- /dev/null +++ b/keyboards/jj40/keymaps/ajp10304/readme.md @@ -0,0 +1,91 @@ +# AJP10304 Custom JJ40 Layout +###Based on my Planck layout of the same name. + +**Note:** In the tables below where there are two characters on a key, +the second is the output when shift is applied. + +**Note:** The below tables assume a UK layout. + +##### Main Qwerty Layer + +* Tab: when held, operates as shift. +* Enter: when held, operates as shift. +* MENU: perform right-click + +| | | | | | | | | | | | | +| ---- |:----:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| ----:| +| Esc | Q | W | E | R | T | Y | U | I | O | P | Bksp | +| Tab | A | S | D | F | G | H | J | K | L | ;: | Enter| +| Shft | Z | X | C | V | B | N | M | ,< | .> | /? | Shft | +| Fn | Ctrl | Alt | GUI |Lower | Bksp |Space |Raise | Shift| MENU | Ctrl | Fn | + +##### Function Layer +Activated when `fn` held in the above `qwerty` layer. + +| | | | | | | | | | | | | +| :---: |:----:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| +| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | +| 1! | 2" | 3£ | 4$ | 5% | 6^ | 7& | 8* | 9( | 0) | ~ |INSERT| +| Shift | \| | `¬ | #~ | * | -_ | =+ | \| | [{ | ]} | '@ |Shift | +| Fn | Ctrl | Alt | GUI |Lower | Bksp |Space |Raise | MENU | Alt | Ctrl | Fn | + +##### Lower Layer +Activated when `Lower` is held in the above `qwerty` layer. + +* Numbers are along the top row, their shifted counterparts are on row 2. +* WrdBks: `backspace` with `ctrl` applied. I.e. delete a word. +* WrdDel: `delete` with `ctrl` applied. I.e. forward delete a word. + +| | | | | | | | | | | | | +| :---: |:----:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| +| 1! | 2" | 3£ | 4$ | 5% | 6^ | 7& | 8* | 9( | 0) | DEL | Bksp | +| ! | " | £ | $ | % | ^ | & | * | ( | ) |WrdDel|WrdBks| +| Shift | \| | `¬ | #~ | '@ | -_ | =+ | #~ | [{ | ]} | '@ |Shift | +| | | | |Lower | Del |Space | | Next | Vol- | Vol+ | Play | + + ##### Raise Layer + Activated when `Raise` is held in the above `qwerty` layer. + + * Preferred layer for typing brackets. + * Allows for cursor navigation to be used solely with the right hand. + * WRDSEL: Select the word where the cursor is. + * |< and >|: Apply `ctrl` to `left` and `right` respectively for word jumping. + +| | | | | | | | | | | | | +| :---: |:----:| :---:| :---:| :---:| :---:| :---: | :---:| :---:| :---:| :---: | :---:| +| ` | |WRDSEL| [ | ] | | | PGUP | HOME |PGDOWN| |PRNTSC| +| ` | | | ( | ) | | | HOME | UP | END | |ZOOM +| +| | | | { | } | ||<| LEFT | DOWN |RIGHT |>||ZOOM -| +| | | | | | Alt | Enter |Raise | | | | | + +##### Lower + Raise +Activated when `Lower` and `Raise` are held together the above `qwerty` layer. + +* Audio controls in the same position as cursor keys from the `Raise` layer. +* ????: Runs a macro for outputting a text string. Do not use this store passwords. +* Reset: Enter bootloader for flashing firmware to the keyboard. +* CAPS: Toggle caps lock. +* DYN: Enter `DYN` layer. + +| | | | | | | | | | | | | +| :---: |:----:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| +| ???? | Reset|Qwerty| | | | | | | | | Del | +| CAPS | | | | | | | Mute | Vol+ | Play | | | +| | | | | | | | Prev | Vol- | Next | | | +| | | | | | | | | DYN | | | | + +##### DYN +Activated when `DYN` held along with `Lower` and `Raise` +Allows recording of macros. To start recording the macro, press either REC1 or REC2. +To finish the recording, press STOP. To replay the macro, press either PLAY1 or PLAY2. + +| | | | | | | | | | | | | +| :---: | :---:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| :---:| +| | | | | | REC1 | REC2 | | | | | | +| | | | | | PLAY1| PLAY2| | | | | | +| | | | | | STOP | STOP | | | | | | +| | | | | | | | | | | | | + + +####Manual Flashing of hex file +`bootloadHID -r .build/jj40_ajp10304.hex` diff --git a/keyboards/jj40/keymaps/ajp10304/rules.mk b/keyboards/jj40/keymaps/ajp10304/rules.mk new file mode 100644 index 0000000000..76b36845c6 --- /dev/null +++ b/keyboards/jj40/keymaps/ajp10304/rules.mk @@ -0,0 +1,5 @@ +ifndef QUANTUM_DIR + include ../../../../Makefile +endif + +AUDIO_ENABLE = no \ No newline at end of file -- cgit v1.2.3