| Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 118 KiB | 
| Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 121 KiB | 
| Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 88 KiB | 
| @ -0,0 +1,44 @@ | ||||
| Priyadi Keymap for Planck-like Keyboards | ||||
| ======================================== | ||||
| 
 | ||||
| Main layer modifications from default Planck layout: | ||||
| 
 | ||||
| * Enter moved to quotes position | ||||
| * Quotes moved to semicolon position. | ||||
| * QWERTZ style colon & semicolon. shift-. = :  shift-, = ;  This is done in hardware, no layout switching needed in software. | ||||
| * < & > occupied precious real estate, and so they are moved down to punctuation layer. | ||||
| * Right-shift on Enter position. | ||||
| * Removed arrow keys, they are on another layer now. | ||||
| * Put Ctrl-Alt-Super and Super-AltGr-Ctrl in left & right corners. | ||||
| * Lower & Raise is now called Num and Fun. | ||||
| * OS & Left keys become another thumb modifier: Empty & Greek (Empty because I used this for another use and my muscle memory is not adapted to it yet) | ||||
| 
 | ||||
| On Promethium, Trackpoint is enabled on PD2 and PD2. We impersonate a Thinkpad keyboard to be able to use Thinkpad driver on Windows (still needs verification). | ||||
| 
 | ||||
| AltGr & Compose dual use key. Tap for Compose (mapped to Scroll Lock in hardware) and press for AltGr. | ||||
| 
 | ||||
| Supported layouts: QWERTY, DVORAK, Colemak, Workman, Norman. Switchable from SYS layer. In DVORAK, semicolon is replaced by /? key. | ||||
| 
 | ||||
| Num activates NUM layer: hexkeypad on the right side and most punctuation on the left side. Hexkeypad is optimized for C-style hex, IPv6, HTML RGB triplets, etc. | ||||
| 
 | ||||
| Fun activates FUN layer: arrow cluster on right home row, F-numbers on left side. | ||||
| 
 | ||||
| Pressing Num+Fun activates PUNC layer: same punctuations as NUM layer on the left side, parens on the right side. | ||||
| 
 | ||||
| Greek activates either GREEKU or GREEKL layer, depending whether shift is pressed or not. Shift state changes are also taken into account when the layer is active. | ||||
| 
 | ||||
| Greek+Empty activates EMOJI layer. The whole keyboard now outputs emojis! | ||||
| 
 | ||||
| Pressing both spacebars (spacekeys, actually) activates GUI layer. QWERTYUIOP switches to a virtual desktop. J & L switches virtual desktop to the left or right. S & F behaves like Alt-Tab and Alt-Shift-Tab. This works by sending Alt press when entering the layer, and Alt release when other than S or F keys are pressed. | ||||
| 
 | ||||
| Pressing both Ctrls activates SYS layer for configuring the keyboard. | ||||
| 
 | ||||
| On Promethium, USB or Bluetooth output is detected on startup. If USB is connected, then USB is used initially. SYS-U and SYS-B switch output to USB or Bluetooth at runtime. Current active output is indicated with LEDs. | ||||
| 
 | ||||
| SYS-W, SYS-L, SYS-M switch Unicode input method. SYS-Q, SYS-D, SYS-C, SYS-K, SYS-N switch to QWERTY, DVORAK, Colemak, Workman and Norman, respectively. | ||||
| 
 | ||||
| On Planck, SYS-A (mnemonic: audio) toggles faux clicky: use buzzer to emit clicks on key presses and releases. | ||||
| 
 | ||||
| On Promethium there are 6 indicator LEDs, and under switch LEDs on each switches, including Trackpoint buttons. Totaling 57 LEDs. Output is limited to 0xF for each LEDs to conserve power. SYS-G (mnemonic: glow) toggles various backlighting modes. | ||||
| 
 | ||||
| On Promethium, there's a LED to indicate battery level. Hue indicates level: green is full, red is empty. | ||||
| @ -1,108 +1,10 @@ | ||||
| #ifndef PROMETHIUM_H | ||||
| #define PROMETHIUM_H | ||||
| 
 | ||||
| #include "quantum.h" | ||||
| #include "stdint.h" | ||||
| 
 | ||||
| #define PS2_INIT_DELAY 2000 | ||||
| #define UNICODE_TYPE_DELAY 0 | ||||
| #define BATTERY_PIN 9 | ||||
| #define BATTERY_POLL 30000 | ||||
| #define MAX_VOLTAGE 4.2 | ||||
| #define MIN_VOLTAGE 3.2 | ||||
| 
 | ||||
| #define KEYMAP( \ | ||||
|     k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \ | ||||
|     k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \ | ||||
|     k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \ | ||||
|     k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c \ | ||||
| ) \ | ||||
| { \ | ||||
|     {k11, k12, k13, k14, k15, k16}, \ | ||||
|     {k21, k22, k23, k24, k25, k26}, \ | ||||
|     {k31, k32, k33, k34, k35, k36}, \ | ||||
|     {k41, k42, k43, k44, k45, k46}, \ | ||||
|     {k17, k18, k19, k1a, k1b, k1c}, \ | ||||
|     {k27, k28, k29, k2a, k2b, k2c}, \ | ||||
|     {k37, k38, k39, k3a, k3b, k3c}, \ | ||||
|     {k47, k48, k49, k4a, k4b, k4c} \ | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| enum led_sequence { | ||||
|   LED_IND_BLUETOOTH, | ||||
|   LED_IND_USB, | ||||
|   LED_IND_BATTERY, | ||||
| 
 | ||||
|   LED_IND_FUNC, | ||||
|   LED_IND_NUM, | ||||
|   LED_IND_EMOJI, | ||||
| 
 | ||||
|   LED_BKSP, | ||||
|   LED_ENT, | ||||
|   LED_RSFT, | ||||
|   LED_RCTL, | ||||
| 
 | ||||
|   LED_RGUI, | ||||
|   LED_SLSH, | ||||
|   LED_SCLN, | ||||
|   LED_P, | ||||
| 
 | ||||
|   LED_O, | ||||
|   LED_L, | ||||
|   LED_DOT, | ||||
|   LED_RALT, | ||||
| 
 | ||||
|   LED_EMOJI, | ||||
|   LED_COMM, | ||||
|   LED_K, | ||||
|   LED_I, | ||||
| 
 | ||||
|   LED_U, | ||||
|   LED_J, | ||||
|   LED_M, | ||||
|   LED_FUNC, | ||||
| 
 | ||||
|   LED_RSPC, | ||||
|   LED_N, | ||||
|   LED_HH, | ||||
|   LED_Y, | ||||
| 
 | ||||
|   LED_TRACKPOINT3, | ||||
|   LED_TRACKPOINT2, | ||||
|   LED_TRACKPOINT1, | ||||
| 
 | ||||
|   LED_LSPC, | ||||
|   LED_B, | ||||
|   LED_G, | ||||
|   LED_T, | ||||
| 
 | ||||
|   LED_R, | ||||
|   LED_F, | ||||
|   LED_V, | ||||
|   LED_NUM, | ||||
| 
 | ||||
|   LED_PUNC, | ||||
|   LED_C, | ||||
|   LED_D, | ||||
|   LED_E, | ||||
| 
 | ||||
|   LED_W, | ||||
|   LED_S, | ||||
|   LED_X, | ||||
|   LED_LALT, | ||||
| 
 | ||||
|   LED_LGUI, | ||||
|   LED_Z, | ||||
|   LED_A, | ||||
|   LED_Q, | ||||
| 
 | ||||
|   LED_TAB, | ||||
|   LED_ESC, | ||||
|   LED_LSFT, | ||||
|   LED_LCTL, | ||||
| }; | ||||
| void battery_poll(uint8_t level); | ||||
| void led_set_kb(uint8_t usb_led); | ||||
| void led_set_user(uint8_t usb_led); | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
| void battery_poll(uint8_t level); | ||||
| @ -0,0 +1,39 @@ | ||||
| #ifndef CONFIG_USER_H | ||||
| #define CONFIG_USER_H | ||||
| 
 | ||||
| #include "../../config.h" | ||||
| 
 | ||||
| #define PRIYADI_PLANCK | ||||
| 
 | ||||
| /* bootmagic salt key */ | ||||
| #define BOOTMAGIC_KEY_SALT              KC_ESC | ||||
| 
 | ||||
| /* skip bootmagic and eeconfig */ | ||||
| #define BOOTMAGIC_KEY_SKIP              KC_SPACE | ||||
| 
 | ||||
| #define PREVENT_STUCK_MODIFIERS | ||||
| 
 | ||||
| #define UNICODE_TYPE_DELAY 0 | ||||
| 
 | ||||
| #define LAYOUT_DVORAK | ||||
| #define LAYOUT_COLEMAK | ||||
| #define LAYOUT_NORMAN | ||||
| #define LAYOUT_WORKMAN | ||||
| 
 | ||||
| #define DOUBLESPACE_LAYER_ENABLE | ||||
|     // #define TOLELOT_ENABLE
 | ||||
| 
 | ||||
| #define KEYMAP( \ | ||||
|     k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \ | ||||
|     k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \ | ||||
|     k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \ | ||||
|     k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c \ | ||||
| ) \ | ||||
| { \ | ||||
|     {k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c}, \ | ||||
|     {k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c}, \ | ||||
|     {k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c}, \ | ||||
|     {k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c} \ | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
| @ -1,680 +1 @@ | ||||
| // This is the canonical layout file for the Quantum project. If you want to add another keyboard,
 | ||||
| // this is the style you want to emulate.
 | ||||
| 
 | ||||
| #include "planck.h" | ||||
| #include "action_layer.h" | ||||
| #ifdef AUDIO_ENABLE | ||||
|   #include "audio.h" | ||||
|   #include "musical_notes.h" | ||||
| #endif | ||||
| #include "eeconfig.h" | ||||
| #include "process_unicode.h" | ||||
| #include "quantum.h" | ||||
| 
 | ||||
| // #define TOLELOT_ENABLE
 | ||||
| 
 | ||||
| extern keymap_config_t keymap_config; | ||||
| 
 | ||||
| enum layers { | ||||
|   _QWERTY, | ||||
|   _COLEMAK, | ||||
|   _WORKMAN, | ||||
|   _PUNC, | ||||
|   _NUM, | ||||
|   _FUNC, | ||||
|   _EMOJI, | ||||
|   _GREEKU, | ||||
|   _GREEKL, | ||||
|   _GUI, | ||||
| }; | ||||
| 
 | ||||
| enum planck_keycodes { | ||||
|   // layouts
 | ||||
|   QWERTY = SAFE_RANGE, | ||||
|   COLEMAK, | ||||
|   WORKMAN, | ||||
| 
 | ||||
|   // layer switchers
 | ||||
|   PUNC, | ||||
|   NUM, | ||||
|   FUNC, | ||||
|   EMOJI, | ||||
|   GUI, | ||||
|   GREEK, | ||||
| 
 | ||||
|   // os switchers
 | ||||
|   LINUX, | ||||
|   WIN, | ||||
|   OSX, | ||||
| }; | ||||
| 
 | ||||
| // Fillers to make layering clearer
 | ||||
| 
 | ||||
| #define _______ KC_TRNS | ||||
| #define XXXXXXX KC_NO | ||||
| 
 | ||||
| // unicode map
 | ||||
| 
 | ||||
| enum unicode_name { | ||||
|   GRIN, // grinning face 😊
 | ||||
|   TJOY, // tears of joy 😂
 | ||||
|   SMILE, // grining face with smiling eyes 😁
 | ||||
|   HEART, // heart ❤
 | ||||
|   EYERT, // smiling face with heart shaped eyes 😍
 | ||||
|   CRY, // crying face 😭
 | ||||
|   SMEYE, // smiling face with smiling eyes 😊
 | ||||
|   UNAMU, // unamused 😒
 | ||||
|   KISS, // kiss 😘
 | ||||
|   HART2, // two hearts 💕
 | ||||
|   WEARY, // weary 😩
 | ||||
|   OKHND, // ok hand sign 👌
 | ||||
|   PENSV, // pensive 😔
 | ||||
|   SMIRK, // smirk 😏
 | ||||
|   RECYC, // recycle ♻
 | ||||
|   WINK, // wink 😉
 | ||||
|   THMUP, // thumb up 👍
 | ||||
|   THMDN, // thumb down 👎
 | ||||
|   PRAY, // pray 🙏
 | ||||
|   PHEW, // relieved 😌
 | ||||
|   MUSIC, // musical notes
 | ||||
|   FLUSH, // flushed 😳
 | ||||
|   CELEB, // celebration 🙌
 | ||||
|   CRY2, // crying face 😢
 | ||||
|   COOL, // smile with sunglasses 😎
 | ||||
|   NOEVS, // see no evil
 | ||||
|   NOEVH, // hear no evil
 | ||||
|   NOEVK, // speak no evil
 | ||||
|   POO, // pile of poo
 | ||||
|   EYES, // eyes
 | ||||
|   VIC, // victory hand
 | ||||
|   BHART, // broken heart
 | ||||
|   SLEEP, // sleeping face
 | ||||
|   SMIL2, // smiling face with open mouth & sweat
 | ||||
|   HUNRD, // 100
 | ||||
|   CONFU, // confused
 | ||||
|   TONGU, // face with tongue & winking eye
 | ||||
|   DISAP, // disappointed
 | ||||
|   YUMMY, // face savoring delicious food
 | ||||
|   CLAP, // hand clapping
 | ||||
|   FEAR, // face screaming in fear
 | ||||
|   HORNS, // smiling face with horns
 | ||||
|   HALO, // smiling face with halo
 | ||||
|   BYE, // waving hand
 | ||||
|   SUN, // sun
 | ||||
|   MOON, // moon
 | ||||
|   SKULL, // skull
 | ||||
| 
 | ||||
|   // greek letters
 | ||||
|   UALPH, | ||||
|   UBETA, | ||||
|   UGAMM, | ||||
|   UDELT, | ||||
|   UEPSI, | ||||
|   UZETA, | ||||
|   UETA, | ||||
|   UTHET, | ||||
|   UIOTA, | ||||
|   UKAPP, | ||||
|   ULAMB, | ||||
|   UMU, | ||||
|   UNU, | ||||
|   UXI, | ||||
|   UOMIC, | ||||
|   UPI, | ||||
|   URHO, | ||||
|   USIGM, | ||||
|   UTAU, | ||||
|   UUPSI, | ||||
|   UPHI, | ||||
|   UCHI, | ||||
|   UPSI, | ||||
|   UOMEG, | ||||
| 
 | ||||
|   LALPH, | ||||
|   LBETA, | ||||
|   LGAMM, | ||||
|   LDELT, | ||||
|   LEPSI, | ||||
|   LZETA, | ||||
|   LETA, | ||||
|   LTHET, | ||||
|   LIOTA, | ||||
|   LKAPP, | ||||
|   LLAMB, | ||||
|   LMU, | ||||
|   LNU, | ||||
|   LXI, | ||||
|   LOMIC, | ||||
|   LPI, | ||||
|   LRHO, | ||||
|   LSIGM, | ||||
|   LTAU, | ||||
|   LUPSI, | ||||
|   LPHI, | ||||
|   LCHI, | ||||
|   LPSI, | ||||
|   LOMEG, | ||||
| 
 | ||||
|   FSIGM, | ||||
| }; | ||||
| 
 | ||||
| const uint32_t PROGMEM unicode_map[] = { | ||||
|   [GRIN] = 0x1F600, | ||||
|   [TJOY] = 0x1F602, | ||||
|   [SMILE] = 0x1F601, | ||||
|   [HEART] = 0x2764, | ||||
|   [EYERT] = 0x1f60d, | ||||
|   [CRY] = 0x1f62d, | ||||
|   [SMEYE] = 0x1F60A, | ||||
|   [UNAMU] = 0x1F612, | ||||
|   [KISS] = 0x1F618, | ||||
|   [HART2] = 0x1F495, | ||||
|   [WEARY] = 0x1F629, | ||||
|   [OKHND] = 0x1F44C, | ||||
|   [PENSV] = 0x1F614, | ||||
|   [SMIRK] = 0x1F60F, | ||||
|   [RECYC] = 0x267B, | ||||
|   [WINK] = 0x1F609, | ||||
|   [THMUP] = 0x1F44D, | ||||
|   [THMDN] = 0x1F44E, | ||||
|   [PRAY] = 0x1F64F, | ||||
|   [PHEW] = 0x1F60C, | ||||
|   [MUSIC] = 0x1F3B6, | ||||
|   [FLUSH] = 0x1F633, | ||||
|   [CELEB] = 0x1F64C, | ||||
|   [CRY2] = 0x1F622, | ||||
|   [COOL] = 0x1F60E, | ||||
|   [NOEVS] = 0x1F648, | ||||
|   [NOEVH] = 0x1F649, | ||||
|   [NOEVK] = 0x1F64A, | ||||
|   [POO] = 0x1F4A9, | ||||
|   [EYES] = 0x1F440, | ||||
|   [VIC] = 0x270C, | ||||
|   [BHART] = 0x1F494, | ||||
|   [SLEEP] = 0x1F634, | ||||
|   [SMIL2] = 0x1F605, | ||||
|   [HUNRD] = 0x1F4AF, | ||||
|   [CONFU] = 0x1F615, | ||||
|   [TONGU] = 0x1F61C, | ||||
|   [DISAP] = 0x1F61E, | ||||
|   [YUMMY] = 0x1F60B, | ||||
|   [CLAP] = 0x1F44F, | ||||
|   [FEAR] = 0x1F631, | ||||
|   [HORNS] = 0x1F608, | ||||
|   [HALO] = 0x1F607, | ||||
|   [BYE] = 0x1F44B, | ||||
|   [SUN] = 0x2600, | ||||
|   [MOON] = 0x1F314, | ||||
|   [SKULL] = 0x1F480, | ||||
| 
 | ||||
|   // greek letters
 | ||||
|   [UALPH] = 0x0391, | ||||
|   [UBETA] = 0x0392, | ||||
|   [UGAMM] = 0x0393, | ||||
|   [UDELT] = 0x0394, | ||||
|   [UEPSI] = 0x0395, | ||||
|   [UZETA] = 0x0396, | ||||
|   [UETA] = 0x0397, | ||||
|   [UTHET] = 0x0398, | ||||
|   [UIOTA] = 0x0399, | ||||
|   [UKAPP] = 0x039A, | ||||
|   [ULAMB] = 0x039B, | ||||
|   [UMU] = 0x039C, | ||||
|   [UNU] = 0x039D, | ||||
|   [UXI] = 0x039E, | ||||
|   [UOMIC] = 0x039F, | ||||
|   [UPI] = 0x03A0, | ||||
|   [URHO] = 0x03A1, | ||||
|   [USIGM] = 0x03A3, | ||||
|   [UTAU] = 0x03A4, | ||||
|   [UUPSI] = 0x03A5, | ||||
|   [UPHI] = 0x03A6, | ||||
|   [UCHI] = 0x03A7, | ||||
|   [UPSI] = 0x03A8, | ||||
|   [UOMEG] = 0x03A9, | ||||
|   [LALPH] = 0x03B1, | ||||
|   [LBETA] = 0x03B2, | ||||
|   [LGAMM] = 0x03B3, | ||||
|   [LDELT] = 0x03B4, | ||||
|   [LEPSI] = 0x03B5, | ||||
|   [LZETA] = 0x03B6, | ||||
|   [LETA] = 0x03B7, | ||||
|   [LTHET] = 0x03B8, | ||||
|   [LIOTA] = 0x03B9, | ||||
|   [LKAPP] = 0x03BA, | ||||
|   [LLAMB] = 0x03BB, | ||||
|   [LMU] = 0x03BC, | ||||
|   [LNU] = 0x03BD, | ||||
|   [LXI] = 0x03BE, | ||||
|   [LOMIC] = 0x03BF, | ||||
|   [LPI] = 0x03C0, | ||||
|   [LRHO] = 0x03C1, | ||||
|   [LSIGM] = 0x03C3, | ||||
|   [LTAU] = 0x03C4, | ||||
|   [LUPSI] = 0x03C5, | ||||
|   [LPHI] = 0x03C6, | ||||
|   [LCHI] = 0x03C7, | ||||
|   [LPSI] = 0x03C8, | ||||
|   [LOMEG] = 0x03C9, | ||||
|   [FSIGM] = 0x03C2, | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| // hybrid shift - =
 | ||||
| // #undef KC_LSFT
 | ||||
| // #define KC_LSFT MT(MOD_LSFT, KC_MINS)
 | ||||
| // #undef KC_RSFT
 | ||||
| // #define KC_RSFT MT(MOD_LSFT, KC_EQL)
 | ||||
| 
 | ||||
| 
 | ||||
| // hybrid right-gui & scroll lock (mapped to Compose in OS)
 | ||||
| #undef KC_RCTL | ||||
| #define KC_RCTL MT(MOD_LCTL, KC_SLCK) | ||||
| 
 | ||||
| // keymaps
 | ||||
| 
 | ||||
| const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||||
| 
 | ||||
| /* Qwerty
 | ||||
|  * ,-----------------------------------------------------------------------------------. | ||||
|  * | Tab  |   Q  |   W  |   E  |   R  |   T  |   Y  |   U  |   I  |   O  |   P  | Bksp | | ||||
|  * |------+------+------+------+------+-------------+------+------+------+------+------| | ||||
|  * | Esc  |   A  |   S  |   D  |   F  |   G  |   H  |   J  |   K  |   L  |   ;  |Enter | | ||||
|  * |------+------+------+------+------+------|------+------+------+------+------+------| | ||||
|  * | Shift|   Z  |   X  |   C  |   V  |   B  |   N  |   M  |   ,  |   .  |   /  |Shift | | ||||
|  * |------+------+------+------+------+------+------+------+------+------+------+------| | ||||
|  * | Ctrl | GUI  | Alt  | Punc | Num  |    Space    | Func |Emoji |Greek |AltGr | Ctrl | | ||||
|  * `-----------------------------------------------------------------------------------' | ||||
|  */ | ||||
| [_QWERTY] = { | ||||
|   {KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_BSPC}, | ||||
|   {KC_ESC,  KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    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_LALT, KC_LGUI, PUNC,    NUM,     KC_SPC,  KC_SPC,  FUNC,    EMOJI,   GREEK,   KC_RALT, KC_RCTL} | ||||
| }, | ||||
| 
 | ||||
| /* Colemak
 | ||||
|  * ,-----------------------------------------------------------------------------------. | ||||
|  * | Tab  |   Q  |   W  |   F  |   P  |   G  |   J  |   L  |   U  |   Y  |   ;  | Bksp | | ||||
|  * |------+------+------+------+------+-------------+------+------+------+------+------| | ||||
|  * | Esc  |   A  |   R  |   S  |   T  |   D  |   H  |   N  |   E  |   I  |   O  |Enter | | ||||
|  * |------+------+------+------+------+------|------+------+------+------+------+------| | ||||
|  * | Shift|   Z  |   X  |   C  |   V  |   B  |   K  |   M  |   ,  |   .  |   /  |Shift | | ||||
|  * |------+------+------+------+------+------+------+------+------+------+------+------| | ||||
|  * | Ctrl | GUI  | Alt  | Punc | Num  |    Space    | Func |Emoji |AltGr | GUI  | Ctrl | | ||||
|  * `-----------------------------------------------------------------------------------' | ||||
|  */ | ||||
| [_COLEMAK] = { | ||||
|   {_______, KC_Q,    KC_W,    KC_F,    KC_P,    KC_G,    KC_J,    KC_L,    KC_U,    KC_Y,    KC_QUOT, _______}, | ||||
|   {_______, KC_A,    KC_R,    KC_S,    KC_T,    KC_D,    KC_H,    KC_N,    KC_E,    KC_I,    KC_O,    _______}, | ||||
|   {_______, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_K,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, _______}, | ||||
|   {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} | ||||
| }, | ||||
| 
 | ||||
| /* Workman
 | ||||
|  * ,-----------------------------------------------------------------------------------. | ||||
|  * | Tab  |   Q  |   D  |   R  |   W  |   B  |   J  |   F  |   U  |   P  |   ;  | Bksp | | ||||
|  * |------+------+------+------+------+-------------+------+------+------+------+------| | ||||
|  * | Esc  |   A  |   S  |   H  |   T  |   G  |   Y  |   N  |   E  |   O  |   I  |Enter | | ||||
|  * |------+------+------+------+------+------|------+------+------+------+------+------| | ||||
|  * | Shift|   Z  |   X  |   M  |   C  |   V  |   K  |   K  |   ,  |   .  |   /  |Shift | | ||||
|  * |------+------+------+------+------+------+------+------+------+------+------+------| | ||||
|  * | Ctrl | GUI  | Alt  | Punc | Num  |    Space    | Func |Emoji |AltGr | GUI  | Ctrl | | ||||
|  * `-----------------------------------------------------------------------------------' | ||||
|  */ | ||||
| [_WORKMAN] = { | ||||
|   {_______, KC_Q,    KC_D,    KC_R,    KC_W,    KC_B,    KC_J,    KC_F,    KC_U,    KC_P,    KC_QUOT, _______}, | ||||
|   {_______, KC_A,    KC_S,    KC_H,    KC_T,    KC_G,    KC_Y,    KC_N,    KC_E,    KC_O,    KC_I,    _______}, | ||||
|   {_______, KC_Z,    KC_X,    KC_M,    KC_C,    KC_V,    KC_K,    KC_L,    KC_COMM, KC_DOT,  KC_SLSH, _______}, | ||||
|   {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} | ||||
| }, | ||||
| 
 | ||||
| /* Uppercase Greek
 | ||||
|  * ,-----------------------------------------------------------------------------------. | ||||
|  * |      |      |      |      |      |      |      |      |      |      |      |      | | ||||
|  * |------+------+------+------+------+-------------+------+------+------+------+------| | ||||
|  * |      |      |      |      |      |      |      |      |      |      |      |      | | ||||
|  * |------+------+------+------+------+------+------+------+------+------+------+------| | ||||
|  * |      |      |      |      |      |      |      |      |      |      |      |      | | ||||
|  * |------+------+------+------+------+------+------+------+------+------+------+------| | ||||
|  * |      |      |      |      |      |      |      |      |      |      |      |      | | ||||
|  * `-----------------------------------------------------------------------------------' | ||||
|  */ | ||||
| [_GREEKU] = { | ||||
|   {_______, _______, _______,X(UEPSI), X(URHO), X(UTAU),X(UUPSI),X(UTHET),X(UIOTA),X(UOMIC),  X(UPI), _______}, | ||||
|   {_______,X(UALPH),X(USIGM),X(UDELT), X(UPHI),X(UGAMM), X(UETA),  X(UXI),X(UKAPP),X(ULAMB), _______, _______}, | ||||
|   {_______,X(UZETA), X(UCHI), X(UPSI),X(UOMEG),X(UBETA),  X(UNU),  X(UMU), _______, _______, _______, _______}, | ||||
|   {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} | ||||
| }, | ||||
| 
 | ||||
| /* Lowercase Greek
 | ||||
|  * ,-----------------------------------------------------------------------------------. | ||||
|  * |      |      |      |      |      |      |      |      |      |      |      |      | | ||||
|  * |------+------+------+------+------+-------------+------+------+------+------+------| | ||||
|  * |      |      |      |      |      |      |      |      |      |      |      |      | | ||||
|  * |------+------+------+------+------+------+------+------+------+------+------+------| | ||||
|  * |      |      |      |      |      |      |      |      |      |      |      |      | | ||||
|  * |------+------+------+------+------+------+------+------+------+------+------+------| | ||||
|  * |      |      |      |      |      |      |      |      |      |      |      |      | | ||||
|  * `-----------------------------------------------------------------------------------' | ||||
|  */ | ||||
| [_GREEKL] = { | ||||
|   {_______, _______,X(FSIGM),X(LEPSI), X(LRHO), X(LTAU),X(LUPSI),X(LTHET),X(LIOTA),X(LOMIC),  X(LPI), _______}, | ||||
|   {_______,X(LALPH),X(LSIGM),X(LDELT), X(LPHI),X(LGAMM), X(LETA),  X(LXI),X(LKAPP),X(LLAMB), _______, _______}, | ||||
|   {_______,X(LZETA), X(LCHI), X(LPSI),X(LOMEG),X(LBETA),  X(LNU),  X(LMU), _______, _______, _______, _______}, | ||||
|   {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} | ||||
| }, | ||||
| 
 | ||||
| /* Punc
 | ||||
|  * ,-----------------------------------------------------------------------------------. | ||||
|  * |   ~  |   !  |   @  |   #  |   $  |   %  |   ^  |   &  |   *  |   (  |   )  |   `  | | ||||
|  * |------+------+------+------+------+-------------+------+------+------+------+------| | ||||
|  * |      |      |   \  |   -  |   =  |   <  |   >  |   (  |   )  |   '  |      |      | | ||||
|  * |------+------+------+------+------+------|------+------+------+------+------+------| | ||||
|  * |      |      |   |  |   _  |   +  |   {  |   }  |   [  |   ]  |   "  |      |      | | ||||
|  * |------+------+------+------+------+------+------+------+------+------+------+------| | ||||
|  * |      |      |      |      |      |             |      |      |      |      |      | | ||||
|  * `-----------------------------------------------------------------------------------' | ||||
|  */ | ||||
| [_PUNC] = { | ||||
|   {KC_TILD, KC_EXLM, KC_AT,   KC_HASH, KC_DLR,  KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_GRV }, | ||||
|   {XXXXXXX, XXXXXXX, KC_BSLS, KC_MINS,  KC_EQL, KC_LABK, KC_RABK, KC_LPRN, KC_RPRN, KC_QUOT, XXXXXXX, XXXXXXX}, | ||||
|   {XXXXXXX, XXXXXXX, KC_PIPE, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_LBRC, KC_RBRC, KC_DQUO, XXXXXXX, XXXXXXX}, | ||||
|   {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} | ||||
| }, | ||||
| 
 | ||||
| /* Num
 | ||||
|  * ,-----------------------------------------------------------------------------------. | ||||
|  * |  ^   |   1  |   2  |   3  |   4  |   5  |   6  |   7  |   8  |   9  |   0  | Bksp | | ||||
|  * |------+------+------+------+------+-------------+------+------+------+------+------| | ||||
|  * | Esc  |  @   |  A   |  B   |  C   |  (   |  )   |   4  |   5  |   6  |   :  |Enter | | ||||
|  * |------+------+------+------+------+------|------+------+------+------+------+------| | ||||
|  * |  &   |  #   |  D   |  E   |  F   |  [   |  ]   |   1  |   2  |   3  |   /  |  *   | | ||||
|  * |------+------+------+------+------+------+------+------+------+------+------+------| | ||||
|  * |      |      |      |  x   |      |             |   0  |   ,  |   .  |   +  |  -   | | ||||
|  * `-----------------------------------------------------------------------------------' | ||||
|  */ | ||||
| [_NUM] = { | ||||
|   {KC_CIRC,    KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0, KC_BSPC}, | ||||
|   { KC_ESC,   KC_AT, S(KC_A), S(KC_B), S(KC_C), KC_LPRN, KC_RPRN,    KC_4,    KC_5,    KC_6, KC_COLN,  KC_ENT}, | ||||
|   {KC_AMPR, KC_HASH, S(KC_D), S(KC_E), S(KC_F), KC_LBRC, KC_RBRC,    KC_1,    KC_2,    KC_3, KC_SLSH, KC_ASTR}, | ||||
|   {_______, _______, _______,    KC_X, _______,  KC_SPC,  KC_SPC,    KC_0, KC_COMM,  KC_DOT, KC_PLUS, KC_MINS} | ||||
| }, | ||||
| 
 | ||||
| /* Func
 | ||||
|  * ,-----------------------------------------------------------------------------------. | ||||
|  * |      |  F1  |  F2  |  F3  |  F4  |      |      | PgUp |  Up  | PgDn | PgUp | Del  | | ||||
|  * |------+------+------+------+------+-------------+------+------+------+------+------| | ||||
|  * |      |  F5  |  F6  |  F7  |  F8  |PrtSc |      | Left | Down | Right| PgDn | Ins  | | ||||
|  * |------+------+------+------+------+------|------+------+------+------+------+------| | ||||
|  * |      |  F9  |  F10 |  F11 |  F12 |      |      |      | Home |  End |      |      | | ||||
|  * |------+------+------+------+------+------+------+------+------+------+------+------| | ||||
|  * |      |      |      |      |      |             |      |      |      |      |      | | ||||
|  * `-----------------------------------------------------------------------------------' | ||||
|  */ | ||||
| [_FUNC] = { | ||||
|   {XXXXXXX,   KC_F1,   KC_F2,   KC_F3,   KC_F4, XXXXXXX, XXXXXXX, KC_PGUP,   KC_UP, KC_PGDN, KC_PGUP,  KC_DEL}, | ||||
|   {XXXXXXX,   KC_F5,   KC_F6,   KC_F7,  KC_F8,KC_PSCREEN,XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN,  KC_INS}, | ||||
|   {_______,   KC_F9,  KC_F10,  KC_F11,  KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME,  KC_END, XXXXXXX, _______}, | ||||
|   {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} | ||||
| }, | ||||
| 
 | ||||
| /* Emoji
 | ||||
|  * ,-----------------------------------------------------------------------------------. | ||||
|  * |      |      |      |      |      |      |      |      |      |      |      |      | | ||||
|  * |------+------+------+------+------+-------------+------+------+------+------+------| | ||||
|  * |      |      |      |      |      |      |      |      |      |      |      |      | | ||||
|  * |------+------+------+------+------+------+------+------+------+------+------+------| | ||||
|  * |      |      |      |      |      |      |      |      |      |      |      |      | | ||||
|  * |------+------+------+------+------+------+------+------+------+------+------+------| | ||||
|  * |      |      |      |      |      |      |      |      |      |      |      |      | | ||||
|  * `-----------------------------------------------------------------------------------' | ||||
|  */ | ||||
| [_EMOJI] = { | ||||
|   {X(HART2), X(CRY2),X(WEARY),X(EYERT),X(SMIRK), X(TJOY),X(RECYC),X(UNAMU),X(MUSIC),X(OKHND),X(PENSV), X(PHEW)}, | ||||
|   {X(THMUP), X(PRAY),X(SMILE),X(SMIL2),X(FLUSH), X(GRIN),X(HEART),  X(BYE), X(KISS),X(CELEB), X(COOL),X(NOEVS)}, | ||||
|   {X(THMDN),X(SLEEP), X(CLAP),  X(CRY),  X(VIC),X(BHART),  X(SUN),X(SMEYE), X(WINK), X(MOON),X(CONFU),X(NOEVH)}, | ||||
|   {  X(POO), X(EYES),X(HUNRD), _______,X(SKULL),X(HORNS), X(HALO), X(FEAR), _______,X(YUMMY),X(DISAP),X(NOEVK)} | ||||
| }, | ||||
| 
 | ||||
| /* GUI
 | ||||
|  * ,-----------------------------------------------------------------------------------. | ||||
|  * |      |  D1  |  D2  |  D3  |  D4  |  D5  |  D6  |  D7  |  D8  |  D9  |  D10 |      | | ||||
|  * |------+------+------+------+------+-------------+------+------+------+------+------| | ||||
|  * |Linux |      | Vol- | Mute | Vol+ |      |      |  D-  |      |  D+  |      |Qwerty| | ||||
|  * |------+------+------+------+------+------+------+------+------+------+------+------| | ||||
|  * | Win  |      | Prev | Play | Next |      |      |      |      |      |      |Colmak| | ||||
|  * |------+------+------+------+------+------+------+------+------+------+------+------| | ||||
|  * | OSX  |      |      |      |      |  BL- |  BL+ |      |      |      |      |Workmn| | ||||
|  * `-----------------------------------------------------------------------------------' | ||||
|  */ | ||||
| [_GUI] = { | ||||
|   {_______, LGUI(KC_1),LGUI(KC_2),LGUI(KC_3),LGUI(KC_4),LGUI(KC_5),LGUI(KC_6),LGUI(KC_7),LGUI(KC_8),LGUI(KC_9),LGUI(KC_0), _______}, | ||||
|   {  LINUX, _______, KC_VOLD, KC_MUTE, KC_VOLU,_______,_______,KC_WWW_BACK,_______,KC_WWW_FORWARD,_______, QWERTY}, | ||||
|   {    WIN, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, _______, _______, _______, COLEMAK}, | ||||
|   {    OSX, _______, _______, _______, _______,  BL_DEC,  BL_INC, _______, _______, _______, _______, WORKMAN} | ||||
| }, | ||||
| 
 | ||||
| }; | ||||
| 
 | ||||
| #ifdef AUDIO_ENABLE | ||||
| float tone_startup[][2]    = SONG(STARTUP_SOUND); | ||||
| float tone_qwerty[][2]     = SONG(QWERTY_SOUND); | ||||
| float tone_colemak[][2]    = SONG(COLEMAK_SOUND); | ||||
| float tone_workman[][2]    = SONG(DVORAK_SOUND); | ||||
| float tone_goodbye[][2] = SONG(GOODBYE_SOUND); | ||||
| float tone_linux[][2] = SONG(CAPS_LOCK_ON_SOUND); | ||||
| float tone_windows[][2] = SONG(SCROLL_LOCK_ON_SOUND); | ||||
| float tone_osx[][2] = SONG(NUM_LOCK_ON_SOUND); | ||||
| float tone_click[][2] = SONG(MUSICAL_NOTE(_F3, 2)); | ||||
| float tone_release[][2] = SONG(MUSICAL_NOTE(_A3, 2)); | ||||
| float tone_tolelot[][2] = SONG(Q__NOTE(_E5), Q__NOTE(_C5), Q__NOTE(_D5)); | ||||
| #endif | ||||
| 
 | ||||
| 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) { | ||||
|   // faux clicky
 | ||||
|   // if (record->event.pressed) PLAY_NOTE_ARRAY(tone_click, false, 0);
 | ||||
|   #ifdef AUDIO_ENABLE | ||||
|   #ifdef TOLELOT_ENABLE | ||||
|   if (record->event.pressed) { | ||||
|     PLAY_NOTE_ARRAY(tone_tolelot, false, 0); | ||||
|   } | ||||
|   #else | ||||
|   if (record->event.pressed) { | ||||
|     PLAY_NOTE_ARRAY(tone_click, false, 0); | ||||
|   } else { | ||||
|     PLAY_NOTE_ARRAY(tone_release, false, 0); | ||||
|   } | ||||
|   #endif | ||||
|   #endif | ||||
| 
 | ||||
|   bool lshifted = keyboard_report->mods & MOD_BIT(KC_LSFT); | ||||
|   bool rshifted = keyboard_report->mods & MOD_BIT(KC_RSFT); | ||||
| 
 | ||||
|   switch (keycode) { | ||||
|     // Greek layer handling
 | ||||
|     case GREEK: | ||||
|       if (record->event.pressed) { | ||||
|         if (lshifted || rshifted) { | ||||
|           layer_on(_GREEKU); | ||||
|           layer_off(_GREEKL); | ||||
|         } else { | ||||
|           layer_on(_GREEKL); | ||||
|           layer_off(_GREEKU); | ||||
|         } | ||||
|       } else { | ||||
|         layer_off(_GREEKU); | ||||
|         layer_off(_GREEKL); | ||||
|       } | ||||
|       return false; | ||||
|       break; | ||||
| 
 | ||||
|     case KC_LSFT: | ||||
|     case KC_RSFT: | ||||
|       ; | ||||
|       uint8_t layer = biton32(layer_state); | ||||
|       if (layer == _GREEKU || layer == _GREEKL) { | ||||
|         if (record->event.pressed) { | ||||
|           layer_on(_GREEKU); | ||||
|           layer_off(_GREEKL); | ||||
|         } else { | ||||
|           if (lshifted ^ rshifted) { // if only one shift is pressed
 | ||||
|             layer_on(_GREEKL); | ||||
|             layer_off(_GREEKU); | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|       return true; | ||||
|       break; | ||||
| 
 | ||||
|     // QWERTZ style comma and dot: semicolon and colon when shifted
 | ||||
|     case KC_COMM: | ||||
|       if (record->event.pressed) { | ||||
|         if (lshifted || rshifted) { | ||||
|           if (lshifted) unregister_code(KC_LSFT); | ||||
|           if (rshifted) unregister_code(KC_RSFT); | ||||
|           register_code(KC_SCLN); | ||||
|           unregister_code(KC_SCLN); | ||||
|           if (lshifted) register_code(KC_LSFT); | ||||
|           if (rshifted) register_code(KC_RSFT); | ||||
|         } else { | ||||
|           register_code(KC_COMM); | ||||
|           unregister_code(KC_COMM); | ||||
|         } | ||||
|       } | ||||
|       return false; | ||||
|       break; | ||||
|     case KC_DOT: | ||||
|       if (record->event.pressed) { | ||||
|         if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT))) { | ||||
|           register_code(KC_SCLN); | ||||
|           unregister_code(KC_SCLN); | ||||
|         } else { | ||||
|           register_code(KC_DOT); | ||||
|           unregister_code(KC_DOT); | ||||
|         } | ||||
|       } | ||||
|       return false; | ||||
|       break; | ||||
| 
 | ||||
|     // layout switcher
 | ||||
|     case QWERTY: | ||||
|       if (record->event.pressed) { | ||||
|         #ifdef AUDIO_ENABLE | ||||
|           PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | ||||
|         #endif | ||||
|         persistant_default_layer_set(1UL<<_QWERTY); | ||||
|       } | ||||
|       return false; | ||||
|       break; | ||||
|     case COLEMAK: | ||||
|       if (record->event.pressed) { | ||||
|         #ifdef AUDIO_ENABLE | ||||
|           PLAY_NOTE_ARRAY(tone_colemak, false, 0); | ||||
|         #endif | ||||
|         persistant_default_layer_set(1UL<<_COLEMAK); | ||||
|       } | ||||
|       return false; | ||||
|       break; | ||||
|     case WORKMAN: | ||||
|       if (record->event.pressed) { | ||||
|         #ifdef AUDIO_ENABLE | ||||
|           PLAY_NOTE_ARRAY(tone_workman, false, 0); | ||||
|         #endif | ||||
|         persistant_default_layer_set(1UL<<_WORKMAN); | ||||
|       } | ||||
|       return false; | ||||
|       break; | ||||
| 
 | ||||
|     // layer switchers
 | ||||
|     case PUNC: | ||||
|       if (record->event.pressed) { | ||||
|         layer_on(_PUNC); | ||||
|         update_tri_layer(_PUNC, _EMOJI, _GUI); | ||||
|       } else { | ||||
|         layer_off(_PUNC); | ||||
|         update_tri_layer(_PUNC, _EMOJI, _GUI); | ||||
|       } | ||||
|       return false; | ||||
|       break; | ||||
|     case EMOJI: | ||||
|       if (record->event.pressed) { | ||||
|         layer_on(_EMOJI); | ||||
|         update_tri_layer(_PUNC, _EMOJI, _GUI); | ||||
|       } else { | ||||
|         layer_off(_EMOJI); | ||||
|         update_tri_layer(_PUNC, _EMOJI, _GUI); | ||||
|       } | ||||
|       return false; | ||||
|       break; | ||||
|     case NUM: | ||||
|       if (record->event.pressed) { | ||||
|         layer_on(_NUM); | ||||
|       } else { | ||||
|         layer_off(_NUM); | ||||
|       } | ||||
|       return false; | ||||
|       break; | ||||
|     case FUNC: | ||||
|       if (record->event.pressed) { | ||||
|         layer_on(_FUNC); | ||||
|       } else { | ||||
|         layer_off(_FUNC); | ||||
|       } | ||||
|       return false; | ||||
|       break; | ||||
| 
 | ||||
|     // OS switchers
 | ||||
|     case LINUX: | ||||
|       set_unicode_input_mode(UC_LNX); | ||||
|       #ifdef AUDIO_ENABLE | ||||
|         PLAY_NOTE_ARRAY(tone_linux, false, 0); | ||||
|       #endif | ||||
|       return false; | ||||
|       break; | ||||
|     case WIN: | ||||
|       set_unicode_input_mode(UC_WINC); | ||||
|       #ifdef AUDIO_ENABLE | ||||
|         PLAY_NOTE_ARRAY(tone_windows, false, 0); | ||||
|       #endif | ||||
|       return false; | ||||
|       break; | ||||
|     case OSX: | ||||
|       set_unicode_input_mode(UC_OSX); | ||||
|       #ifdef AUDIO_ENABLE | ||||
|         PLAY_NOTE_ARRAY(tone_osx, false, 0); | ||||
|       #endif | ||||
|       return false; | ||||
|       break; | ||||
|   } | ||||
|   return true; | ||||
| } | ||||
| 
 | ||||
| void matrix_init_user(void) { | ||||
|   #ifdef AUDIO_ENABLE | ||||
|       startup_user(); | ||||
|   #endif | ||||
|   set_unicode_input_mode(UC_LNX); | ||||
| } | ||||
| 
 | ||||
| #ifdef AUDIO_ENABLE | ||||
| 
 | ||||
| void startup_user() | ||||
| { | ||||
|     _delay_ms(20); // gets rid of tick
 | ||||
|     PLAY_NOTE_ARRAY(tone_startup, false, 0); | ||||
| } | ||||
| 
 | ||||
| void shutdown_user() | ||||
| { | ||||
|     PLAY_NOTE_ARRAY(tone_goodbye, false, 0); | ||||
|     _delay_ms(150); | ||||
|     stop_all_notes(); | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
| #include "../../../handwired/promethium/keymaps/priyadi/keymap.c" | ||||
| @ -0,0 +1,3 @@ | ||||
| ifndef MAKEFILE_INCLUDED | ||||
| 	include ../../../Makefile | ||||
| endif | ||||
| @ -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 | ||||
| @ -0,0 +1,36 @@ | ||||
| #ifndef CONFIG_USER_H | ||||
| #define CONFIG_USER_H | ||||
| 
 | ||||
| #include "../../config.h" | ||||
| 
 | ||||
| /**
 | ||||
|  *TV44 keymap definition macro | ||||
|  */ | ||||
| #define KEYMAP_TV44( \ | ||||
|     K01, K02, K03, K04, K05, K06, K07, K08, K09, K10, K11, K12, \ | ||||
|     K13, K14, K15, K16, K17, K18, K19, K20, K21, K22, K23, K24, \ | ||||
|     K25, K26, K27, K28, K29, K30, K31, K32, K33, K34, K35, K36, \ | ||||
|     K37,   K38,   K39,     K40,     K41,     K42,   K43,   K44  \ | ||||
| ) { \ | ||||
|     { K01,   K02,   K03,   K04,   K05,   K06,   K07,   K08,   K09,   K10,   K11,   K12, }, \ | ||||
|     { K13,   K14,   K15,   K16,   K17,   K18,   K19,   K20,   K21,   K22,   K23,   K24, }, \ | ||||
|     { K25,   K26,   K27,   K28,   K29,   K30,   K31,   K32,   K33,   K34,   K35,   K36, }, \ | ||||
|     { K37,   K38,   K39,   K40, KC_NO, KC_NO,  KC_NO,  K41,   K42,   K43, KC_NO,   K44  }  \ | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *TV45 keymap definition macro (arrows layout) | ||||
|  */ | ||||
| #define KEYMAP_TV45( \ | ||||
|     K01, K02, K03, K04, K05, K06, K07, K08, K09, K10, K11, K12, \ | ||||
|     K13, K14, K15, K16, K17, K18, K19, K20, K21, K22, K23, K24, \ | ||||
|     K25, K26, K27, K28, K29, K30, K31, K32, K33, K34, K35, K36, \ | ||||
|     K37,   K38,   K39,     K40,     K41,    K42, K43, K44, K45  \ | ||||
| ) { \ | ||||
|     { K01,   K02,   K03,   K04,   K05,   K06,   K07,   K08,   K09,   K10,   K11,   K12, }, \ | ||||
|     { K13,   K14,   K15,   K16,   K17,   K18,   K19,   K20,   K21,   K22,   K23,   K24, }, \ | ||||
|     { K25,   K26,   K27,   K28,   K29,   K30,   K31,   K32,   K33,   K34,   K35,   K36, }, \ | ||||
|     { K37,   K38,   K39,   K40, KC_NO, KC_NO,  KC_NO,  K41,   K42,   K43,   K44,   K45  }  \ | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
| After Width: | Height: | Size: 65 KiB | 
| @ -0,0 +1,232 @@ | ||||
| #include "tv44.h" | ||||
| #include "action_layer.h" | ||||
| #include "eeconfig.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 _COLEMAK 1 | ||||
| #define _DVORAK 2 | ||||
| #define _LOWER 3 | ||||
| #define _RAISE 4 | ||||
| #define _ADJUST 16 | ||||
| 
 | ||||
| // Keycodes
 | ||||
| enum planck_keycodes { | ||||
|   QWERTY = SAFE_RANGE, | ||||
|   COLEMAK, | ||||
|   DVORAK, | ||||
|   LOWER, | ||||
|   RAISE, | ||||
|   BACKLIT | ||||
| }; | ||||
| 
 | ||||
| // Fillers to make layering more clear
 | ||||
| #define _______ KC_TRNS | ||||
| #define XXXXXXX KC_NO | ||||
| 
 | ||||
| // Custom macros
 | ||||
| #define CTL_ESC     CTL_T(KC_ESC)               // Tap for Esc, hold for Ctrl
 | ||||
| #define SFT_ENT     SFT_T(KC_ENT)               // Tap for Enter, hold for Shift
 | ||||
| #define HPR_TAB     ALL_T(KC_TAB)               // Tap for Tab, hold for Hyper
 | ||||
| #define ALT_GRV     ALT_T(KC_GRV)               // Tap for Backtick, hold for Alt
 | ||||
| 
 | ||||
| const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||||
| 
 | ||||
| /* Qwerty
 | ||||
|  * | ||||
|  * ,---------+------+------+------+------+------+------+------+------+------+------+---------. | ||||
|  * |Hyper/Tab|   Q  |   W  |   E  |   R  |   T  |   Y  |   U  |   I  |   O  |   P  |  Bksp   | | ||||
|  * |---------`------`------`------`------`------`------`------`------`------`------`---------| | ||||
|  * | Ctrl/Esc |   A  |   S  |   D  |   F  |   G  |   H  |   J  |   K  |   L  |   ;  |   '    | | ||||
|  * |----------`------`------`------`------`------`------`------`------`------`------`--------| | ||||
|  * |   Shift   |   Z  |   X  |   C  |   V  |   B  |   N  |   M  |   ,  |   .  |   /  |Sft/Ent| | ||||
|  * |-----------`------`------`------`------`-----'-------`------`------`------`------`-------| | ||||
|  * |  Alt/` |   GUI   |  Lower |    Space     |    Space     |  Raise  | GUI  | Alt  | Ctrl  | | ||||
|  *  `-------+---------+--------+-----^^^------+-----^^^------+---------+------+------+-------' | ||||
|  */ | ||||
| [_QWERTY] = KEYMAP_TV45( | ||||
| /*,--------+-------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------.*/ | ||||
|     HPR_TAB,   KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_BSPC      , | ||||
| /*|--------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`-----------------|*/ | ||||
|     CTL_ESC ,   KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L, KC_SCLN,    KC_QUOT     , | ||||
| /*|---------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`----------------|*/ | ||||
|     KC_LSFT  ,   KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M, KC_COMM,  KC_DOT, KC_SLSH,    SFT_ENT    , | ||||
| /*|----------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`---------------|*/ | ||||
|     ALT_GRV ,   KC_LGUI     ,   LOWER ,     KC_SPC     ,     KC_SPC      ,  RAISE  ,  KC_RGUI, KC_RALT,     KC_RCTL   ), | ||||
| /*`---------+---------------+---------+-------^^^------+-------^^^-------+----------+--------+--------+--------------'*/ | ||||
| 
 | ||||
| /* Colemak
 | ||||
|  * ,---------+------+------+------+------+------+------+------+------+------+------+---------. | ||||
|  * |Hyper/Tab|   Q  |   W  |   F  |   P  |   G  |   J  |   L  |   U  |   Y  |   ;  |  Bksp   | | ||||
|  * |---------`------`------`------`------`------`------`------`------`------`------`---------| | ||||
|  * | Ctrl/Esc |   A  |   R  |   S  |   T  |   D  |   H  |   N  |   E  |   I  |   O  |   '    | | ||||
|  * |----------`------`------`------`------`------`------`------`------`------`------`--------| | ||||
|  * |   Shift   |   Z  |   X  |   C  |   V  |   B  |   K  |   M  |   ,  |   .  |   /  |Sft/Ent| | ||||
|  * |-----------`------`------`------`------`-----'-------`------`------`------`------`-------| | ||||
|  * |  Alt/` |   GUI   |  Lower |    Space     |    Space     |  Raise  | GUI  | Alt  | Ctrl  | | ||||
|  *  `-------+---------+--------+-----^^^------+-----^^^------+---------+------+------+-------' | ||||
|  */ | ||||
| [_COLEMAK] = KEYMAP_TV45( | ||||
| /*,--------+-------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------.*/ | ||||
|     HPR_TAB,   KC_Q,    KC_W,    KC_F,    KC_P,    KC_G,    KC_J,    KC_L,    KC_U,    KC_Y, KC_SCLN,    KC_BSPC      , | ||||
| /*|--------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`-----------------|*/ | ||||
|     CTL_ESC ,   KC_A,    KC_R,    KC_S,    KC_T,    KC_D,    KC_H,    KC_N,    KC_E,    KC_I,    KC_O,    KC_QUOT     , | ||||
| /*|---------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`----------------|*/ | ||||
|     KC_LSFT  ,   KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_K,    KC_M, KC_COMM,  KC_DOT, KC_SLSH,    SFT_ENT    , | ||||
| /*|----------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`---------------|*/ | ||||
|     ALT_GRV ,   KC_LGUI     ,   LOWER ,     KC_SPC     ,     KC_SPC      ,  RAISE  ,  KC_RGUI, KC_RALT,     KC_RCTL   ), | ||||
| /*`---------+---------------+---------+-------^^^------+-------^^^-------+----------+--------+--------+--------------'*/ | ||||
| 
 | ||||
| /* Dvorak
 | ||||
|  * ,---------+------+------+------+------+------+------+------+------+------+------+---------. | ||||
|  * |Hyper/Tab|   '  |   ,  |   .  |   P  |   Y  |   F  |   G  |   C  |   R  |   L  |  Bksp   | | ||||
|  * |---------`------`------`------`------`------`------`------`------`------`------`---------| | ||||
|  * | Ctrl/Esc |   A  |   O  |   E  |   U  |   I  |   D  |   H  |   T  |   N  |   S  |   -    | | ||||
|  * |----------`------`------`------`------`------`------`------`------`------`------`--------| | ||||
|  * | Shift     |   ;  |   Q  |   J  |   K  |   X  |   B  |   M  |   W  |   V  |   Z  |Sft/Ent| | ||||
|  * |-----------`------`------`------`------`-----'-------`------`------`------`------`-------| | ||||
|  * |  Alt/` |   GUI   |  Lower |    Space     |    Space     |  Raise  | GUI  | Alt  | Ctrl  | | ||||
|  *  `-------+---------+--------+-----^^^------+-----^^^------+---------+------+------+-------' | ||||
|  */ | ||||
| [_DVORAK] = KEYMAP_TV45( | ||||
| /*,--------+-------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------.*/ | ||||
|     HPR_TAB,KC_QUOT, KC_COMM,  KC_DOT,    KC_P,    KC_Y,    KC_F,    KC_G,    KC_C,    KC_R,    KC_L,    KC_BSPC      , | ||||
| /*|--------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`-----------------|*/ | ||||
|     CTL_ESC ,   KC_A,    KC_O,    KC_E,    KC_U,    KC_I,    KC_D,    KC_H,    KC_T,    KC_N,    KC_S,    KC_MINS     , | ||||
| /*|---------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`----------------|*/ | ||||
|     KC_LSFT  , KC_SCLN,   KC_Q,    KC_J,    KC_K,    KC_X,    KC_B,    KC_M,    KC_W,    KC_V,    KC_Z,    SFT_ENT    , | ||||
| /*|----------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`---------------|*/ | ||||
|     ALT_GRV ,   KC_LGUI     ,   LOWER ,     KC_SPC     ,     KC_SPC      ,  RAISE  ,  KC_RGUI, KC_RALT,     KC_RCTL   ), | ||||
| /*`---------+---------------+---------+-------^^^------+-------^^^-------+----------+--------+--------+--------------'*/ | ||||
| 
 | ||||
| /* Lower
 | ||||
|  * ,---------+------+------+------+------+------+------+------+------+------+------+---------. | ||||
|  * |   0     |   1  |   2  |   3  |   4  |   5  |   6  |   7  |   8  |   9  |   0  |   Del   | | ||||
|  * |---------`------`------`------`------`------`------`------`------`------`------`---------| | ||||
|  * |   $      |   4  |   5  |   6  |   .  |   +  |   *  |   4  |   5  |   6  |   .  | PageUp | | ||||
|  * |----------`------`------`------`------`------`------`------`------`------`------`--------| | ||||
|  * |   =       |   7  |   8  |   9  |   0  |   -  |   /  |   1  |   2  |   3  |  Up  |PageDn | | ||||
|  * |-----------`------`------`------`------`-----'-------`------`------`------`------`-------| | ||||
|  * |  Brite |         |        |    Home      |     End      |         | Left | Down | Right | | ||||
|  *  `-------+---------+--------+-----^^^------+-----^^^------+---------+------+------+-------' | ||||
|  */ | ||||
| [_LOWER] = KEYMAP_TV45( | ||||
| /*,--------+-------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------.*/ | ||||
|     KC_0   ,   KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_DEL       , | ||||
| /*|--------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`-----------------|*/ | ||||
|     KC_DLR  ,   KC_4,    KC_5,    KC_6,  KC_DOT, KC_PLUS, KC_ASTR,    KC_4,    KC_5,    KC_6,  KC_DOT,    KC_PGUP     , | ||||
| /*|---------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`----------------|*/ | ||||
|     KC_EQL   ,   KC_7,    KC_8,    KC_9,    KC_0, KC_MINS, KC_SLSH,    KC_1,    KC_2,    KC_3,   KC_UP,    KC_PGDN    , | ||||
| /*|----------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`---------------|*/ | ||||
|     BACKLIT ,   _______     , _______ ,     KC_HOME    ,      KC_END     , _______ ,  KC_LEFT, KC_DOWN,     KC_RGHT   ), | ||||
| /*`---------+---------------+---------+-------^^^------+-------^^^-------+----------+--------+--------+--------------'*/ | ||||
| 
 | ||||
| /* Raise
 | ||||
|  * ,---------+------+------+------+------+------+------+------+------+------+------+---------. | ||||
|  * |   ~     |   !  |   @  |   #  |   $  |   %  |   ^  |   &  |   *  |   (  |   )  |   Del   | | ||||
|  * |---------`------`------`------`------`------`------`------`------`------`------`---------| | ||||
|  * |   F1     |  F2  |  F3  |  F4  |  F5  |  F6  |   _  |   ?  |   +  |   {  |   }  |        | | ||||
|  * |----------`------`------`------`------`------`------`------`------`------`------`--------| | ||||
|  * |   F7      |  F8  |  F9  |  F10 |  F11 |  F12 |   -  |   /  |   =  |   [  |   ]  |       | | ||||
|  * |-----------`------`------`------`------`-----'-------`------`------`------`------`-------| | ||||
|  * |  Brite |         |        |     Play     |     Next     |         | Mute | Vol- | Vol+  | | ||||
|  *  `-------+---------+--------+-----^^^------+-----^^^------+---------+------+------+-------' | ||||
|  */ | ||||
| [_RAISE] = KEYMAP_TV45( | ||||
| /*,--------+-------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------.*/ | ||||
|     KC_TILD,KC_EXLM,   KC_AT, KC_HASH,  KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN,    KC_DEL       , | ||||
| /*|--------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`-----------------|*/ | ||||
|     KC_F1,     KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6, KC_UNDS, KC_QUES, KC_PLUS, KC_LCBR, KC_RCBR,    KC_PIPE     , | ||||
| /*|---------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`----------------|*/ | ||||
|     KC_F7,      KC_F8,   KC_F9,  KC_F10,  KC_F11,  KC_F12, KC_MINS, KC_SLSH,  KC_EQL, KC_LBRC, KC_RBRC,    KC_BSLS    , | ||||
| /*|----------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`---------------|*/ | ||||
|     BACKLIT ,   _______     , _______ ,     KC_MPLY    ,     KC_MNXT     , _______ ,  KC_MUTE, KC_VOLD,     KC_VOLU   ), | ||||
| /*`---------+---------------+---------+-------^^^------+-------^^^-------+----------+--------+--------+--------------'*/ | ||||
| 
 | ||||
| /* Adjust (Lower + Raise)
 | ||||
|  * ,---------+------+------+------+------+------+------+------+------+------+------+---------. | ||||
|  * |         | Reset|      |      |      |      |      |      |      |      |      |   Del   | | ||||
|  * |---------`------`------`------`------`------`------`------`------`------`------`---------| | ||||
|  * |          |      |      |      |      |AGnorm|AGswap|Qwerty|Colemk|Dvorak|      |        | | ||||
|  * |----------`------`------`------`------`------`------`------`------`------`------`--------| | ||||
|  * |           |      |      |      |      |     |       |      |      |      |      |       | | ||||
|  * |-----------`------`------`------`------`-----'-------`------`------`------`------`-------| | ||||
|  * |        |         |        |              |              |         |      |      |       | | ||||
|  *  `-------+---------+--------+-----^^^------+-----^^^------+---------+------+------+-------' | ||||
|  */ | ||||
| [_ADJUST] = KEYMAP_TV45( | ||||
| /*,--------+-------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------.*/ | ||||
|     _______, RESET , _______, _______, _______, _______, _______, _______, _______, _______, _______,     KC_DEL      , | ||||
| /*|--------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`-----------------|*/ | ||||
|     _______ ,_______, _______, _______, _______, AG_NORM, AG_SWAP,  QWERTY, COLEMAK,  DVORAK, _______,    _______     , | ||||
| /*|---------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`----------------|*/ | ||||
|     _______  ,_______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______    , | ||||
| /*|----------`-------`--------`--------`--------`--------`--------`--------`--------`--------`--------`---------------|*/ | ||||
|     _______ ,   _______     , _______ ,     _______    ,     _______     , _______ ,  _______, _______,     _______   ), | ||||
| /*`---------+---------------+---------+-------^^^------+-------^^^-------+----------+--------+--------+--------------'*/ | ||||
| }; | ||||
| 
 | ||||
| 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) { | ||||
|   switch (keycode) { | ||||
|     case QWERTY: | ||||
|       if (record->event.pressed) { | ||||
|         persistant_default_layer_set(1UL<<_QWERTY); | ||||
|       } | ||||
|       return false; | ||||
|       break; | ||||
|     case COLEMAK: | ||||
|       if (record->event.pressed) { | ||||
|         persistant_default_layer_set(1UL<<_COLEMAK); | ||||
|       } | ||||
|       return false; | ||||
|       break; | ||||
|     case DVORAK: | ||||
|       if (record->event.pressed) { | ||||
|         persistant_default_layer_set(1UL<<_DVORAK); | ||||
|       } | ||||
|       return false; | ||||
|       break; | ||||
|     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; | ||||
|       break; | ||||
|     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; | ||||
|       break; | ||||
|     case BACKLIT: | ||||
|       if (record->event.pressed) { | ||||
|         register_code(KC_RSFT); | ||||
|         #ifdef BACKLIGHT_ENABLE | ||||
|           backlight_step(); | ||||
|         #endif | ||||
|       } else { | ||||
|         unregister_code(KC_RSFT); | ||||
|       } | ||||
|       return false; | ||||
|       break; | ||||
|   } | ||||
|   return true; | ||||
| } | ||||
| @ -0,0 +1,126 @@ | ||||
| # smt's TV44 keymap | ||||
| 
 | ||||
| This keymap is based on a combination of my Planck keymap and [jeebak's TV44 layout](https://github.com/qmk/qmk_firmware/tree/master/keyboards/tv44/keymaps/jeebak). I removed the macros and TouchCursor/MouseCursor layers, because I'm just not ready for that level of mind-mapping. | ||||
| 
 | ||||
| I had been using something close to the default Minivan layout, but after spending a bit of time with the Planck and Preonic, I decided it would be better for me to try to standardize to some degree, where possible. | ||||
| 
 | ||||
| Also, it's worth noting that my Minivan is one with the "arrows" layout, which has a 45th key, so I had to define a new KEYMAP_TV45 macro in config.h. In spite of this, the 45-key Minivan is still technically considered a "TV44" as far as I know. | ||||
| 
 | ||||
|  | ||||
| 
 | ||||
| ## Notable features (most of which can be found in my or jeebak's respective keymap file): | ||||
| 
 | ||||
| 1. **Shift/Enter** | ||||
| 
 | ||||
|     I use both the left and right shift keys when I type. When I want to modify a key with shift, I hold shift with the hand opposite the one typing the key. In the default keymap, Enter is where shift would be on a standard keyboard layout. Oh, muscle memory. | ||||
| 
 | ||||
|     Thankfully, QMK supports [mod-tap](https://github.com/jackhumbert/qmk_firmware/wiki#fun-with-modifier-keys) keys, and this allows me to set the Enter key to send a modifier (MOD_LSFT) when held, and KC_ENT when tapped. Awesome! | ||||
| 
 | ||||
| 2. **Hyper/Tab** | ||||
| 
 | ||||
|     This key modifies with "Hyper" (see [Brett Terpstra's post](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/) on this) when held, and outputs the code for Tab when tapped. On the Mac, I use KeyboardMaestro to remap my hyper-keys to do a lot of crazy things. | ||||
| 
 | ||||
| 3. **Ctrl/Escape** | ||||
|      | ||||
|     I set up another mod-tap, this time for the Escape key that would act as a Control modifier when held. | ||||
|      | ||||
| 4. **Alt/Backtick** | ||||
| 
 | ||||
|     I don't currently have LEDs on most of my keyboards, and I certainly don't want LED controls on the base layer of a 40%. | ||||
| 
 | ||||
|     So, why use backtick in the lower left corner? I use it as my tmux prefix key, so I need to type it more frequently than most people. Putting it on the base layer works well for my use case, and it's consistent with where I place it in my Planck and Preonic keymaps. | ||||
| 
 | ||||
|     I also like Alt in that position, so it works well as yet another mod-tap key. | ||||
| 
 | ||||
| 
 | ||||
| ## Layers | ||||
| 
 | ||||
| ### Qwerty | ||||
| 
 | ||||
| ``` | ||||
| ,---------+------+------+------+------+------+------+------+------+------+------+---------. | ||||
| |Hyper/Tab|   Q  |   W  |   E  |   R  |   T  |   Y  |   U  |   I  |   O  |   P  |  Bksp   | | ||||
| |---------`------`------`------`------`------`------`------`------`------`------`---------| | ||||
| | Ctrl/Esc |   A  |   S  |   D  |   F  |   G  |   H  |   J  |   K  |   L  |   ;  |   '    | | ||||
| |----------`------`------`------`------`------`------`------`------`------`------`--------| | ||||
| |   Shift   |   Z  |   X  |   C  |   V  |   B  |   N  |   M  |   ,  |   .  |   /  |Sft/Ent| | ||||
| |-----------`------`------`------`------`-----'-------`------`------`------`------`-------| | ||||
| |  Alt/` |   GUI   |  Lower |    Space     |    Space     |  Raise  | GUI  | Alt  | Ctrl  | | ||||
|  `-------+---------+--------+-----^^^------+-----^^^------+---------+------+------+-------' | ||||
| ``` | ||||
| 
 | ||||
| ### Colemak | ||||
| 
 | ||||
| ``` | ||||
| ,---------+------+------+------+------+------+------+------+------+------+------+---------. | ||||
| |Hyper/Tab|   Q  |   W  |   F  |   P  |   G  |   J  |   L  |   U  |   Y  |   ;  |  Bksp   | | ||||
| |---------`------`------`------`------`------`------`------`------`------`------`---------| | ||||
| | Ctrl/Esc |   A  |   R  |   S  |   T  |   D  |   H  |   N  |   E  |   I  |   O  |   '    | | ||||
| |----------`------`------`------`------`------`------`------`------`------`------`--------| | ||||
| |   Shift   |   Z  |   X  |   C  |   V  |   B  |   K  |   M  |   ,  |   .  |   /  |Sft/Ent| | ||||
| |-----------`------`------`------`------`-----'-------`------`------`------`------`-------| | ||||
| |  Alt/` |   GUI   |  Lower |    Space     |    Space     |  Raise  | GUI  | Alt  | Ctrl  | | ||||
|  `-------+---------+--------+-----^^^------+-----^^^------+---------+------+------+-------' | ||||
| ``` | ||||
| 
 | ||||
| ### Dvorak | ||||
| 
 | ||||
| ``` | ||||
| ,---------+------+------+------+------+------+------+------+------+------+------+---------. | ||||
| |Hyper/Tab|   '  |   ,  |   .  |   P  |   Y  |   F  |   G  |   C  |   R  |   L  |  Bksp   | | ||||
| |---------`------`------`------`------`------`------`------`------`------`------`---------| | ||||
| | Ctrl/Esc |   A  |   O  |   E  |   U  |   I  |   D  |   H  |   T  |   N  |   S  |   -    | | ||||
| |----------`------`------`------`------`------`------`------`------`------`------`--------| | ||||
| | Shift     |   ;  |   Q  |   J  |   K  |   X  |   B  |   M  |   W  |   V  |   Z  |Sft/Ent| | ||||
| |-----------`------`------`------`------`-----'-------`------`------`------`------`-------| | ||||
| |  Alt/` |   GUI   |  Lower |    Space     |    Space     |  Raise  | GUI  | Alt  | Ctrl  | | ||||
|  `-------+---------+--------+-----^^^------+-----^^^------+---------+------+------+-------' | ||||
| ``` | ||||
| 
 | ||||
| ### Lower | ||||
| 
 | ||||
| This is where I put the number row, two numpad clusters, common arithmetic operators, and cursorkeys: Arrow cluster, Home/End, Page Up/Page Down. `0` and `$` are also placed on the left side for convenient access to beginning-of-line and end-of-line Vim commands. BRITE has been moved here from the base layer. | ||||
| 
 | ||||
| ``` | ||||
| ,---------+------+------+------+------+------+------+------+------+------+------+---------. | ||||
| |   0     |   1  |   2  |   3  |   4  |   5  |   6  |   7  |   8  |   9  |   0  |   Del   | | ||||
| |---------`------`------`------`------`------`------`------`------`------`------`---------| | ||||
| |   $      |   4  |   5  |   6  |   .  |   +  |   *  |   4  |   5  |   6  |   .  | PageUp | | ||||
| |----------`------`------`------`------`------`------`------`------`------`------`--------| | ||||
| |   =       |   7  |   8  |   9  |   0  |   -  |   /  |   1  |   2  |   3  |  Up  |PageDn | | ||||
| |-----------`------`------`------`------`-----'-------`------`------`------`------`-------| | ||||
| |  Brite |         |        |    Home      |     End      |         | Left | Down | Right | | ||||
|  `-------+---------+--------+-----^^^------+-----^^^------+---------+------+------+-------' | ||||
| ``` | ||||
| 
 | ||||
| ### Raise | ||||
| 
 | ||||
| As a developer, it makes the most sense for me to group all the commonly-used symbols that don't fit on the main layer. In particular, having the dual-column of parens-braces-brackets helps me keep them straight. I've dropped basic media controls onto this layer as well. | ||||
| 
 | ||||
| ``` | ||||
| ,---------+------+------+------+------+------+------+------+------+------+------+---------. | ||||
| |   ~     |   !  |   @  |   #  |   $  |   %  |   ^  |   &  |   *  |   (  |   )  |   Del   | | ||||
| |---------`------`------`------`------`------`------`------`------`------`------`---------| | ||||
| |   F1     |  F2  |  F3  |  F4  |  F5  |  F6  |   _  |   ?  |   +  |   {  |   }  |   |    | | ||||
| |----------`------`------`------`------`------`------`------`------`------`------`--------| | ||||
| |   F7      |  F8  |  F9  |  F10 |  F11 |  F12 |   -  |   /  |   =  |   [  |   ]  |   \   | | ||||
| |-----------`------`------`------`------`-----'-------`------`------`------`------`-------| | ||||
| |  Brite |         |        |     Play     |     Next     |         | Mute | Vol- | Vol+  | | ||||
|  `-------+---------+--------+-----^^^------+-----^^^------+---------+------+------+-------' | ||||
| ``` | ||||
| 
 | ||||
| ### Adjust (Lower + Raise) | ||||
| 
 | ||||
| Utility layer. There isn't much here; it's mainly for swapping the default keymap between Qwerty and Dvorak, or putting the keyboard into flash mode via the Reset key. | ||||
| 
 | ||||
| ``` | ||||
| ,---------+------+------+------+------+------+------+------+------+------+------+---------. | ||||
| |         | Reset|      |      |      |      |      |      |      |      |      |   Del   | | ||||
| |---------`------`------`------`------`------`------`------`------`------`------`---------| | ||||
| |          |      |      |      |      |AGnorm|AGswap|Qwerty|Colemk|Dvorak|      |        | | ||||
| |----------`------`------`------`------`------`------`------`------`------`------`--------| | ||||
| |           |      |      |      |      |     |       |      |      |      |      |       | | ||||
| |-----------`------`------`------`------`-----'-------`------`------`------`------`-------| | ||||
| |        |         |        |              |              |         |      |      |       | | ||||
|  `-------+---------+--------+-----^^^------+-----^^^------+---------+------+------+-------' | ||||
| ``` | ||||
| @ -0,0 +1,68 @@ | ||||
| /*
 | ||||
| Copyright 2017 Priyadi Iman Nurcahyo | ||||
| 
 | ||||
| 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/>.
 | ||||
| */ | ||||
| 
 | ||||
| #include <avr/interrupt.h> | ||||
| #include <avr/io.h> | ||||
| #include <timer.h> | ||||
| #include <fauxclicky.h> | ||||
| #include <stdbool.h> | ||||
| #include <musical_notes.h> | ||||
| 
 | ||||
| __attribute__ ((weak)) | ||||
| float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_F3, 2); | ||||
| __attribute__ ((weak)) | ||||
| float fauxclicky_released_note[2] = MUSICAL_NOTE(_A3, 2); | ||||
| __attribute__ ((weak)) | ||||
| float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C3, 2); | ||||
| 
 | ||||
| bool fauxclicky_enabled = true; | ||||
| uint16_t note_start = 0; | ||||
| bool note_playing = false; | ||||
| uint16_t note_period = 0; | ||||
| 
 | ||||
| void fauxclicky_init() | ||||
| { | ||||
|     // Set port PC6 (OC3A and /OC4A) as output
 | ||||
|     DDRC |= _BV(PORTC6); | ||||
| 
 | ||||
|     // TCCR3A / TCCR3B: Timer/Counter #3 Control Registers
 | ||||
|     TCCR3A = (0 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30); | ||||
|     TCCR3B = (1 << WGM33)  | (1 << WGM32)  | (0 << CS32)  | (1 << CS31) | (0 << CS30); | ||||
| } | ||||
| 
 | ||||
| void fauxclicky_stop() | ||||
| { | ||||
|     FAUXCLICKY_DISABLE_OUTPUT; | ||||
|     note_playing = false; | ||||
| } | ||||
| 
 | ||||
| void fauxclicky_play(float note[2]) { | ||||
|     if (!fauxclicky_enabled) return; | ||||
|     if (note_playing) fauxclicky_stop(); | ||||
|     FAUXCLICKY_TIMER_PERIOD = (uint16_t)(((float)F_CPU) / (note[0] * FAUXCLICKY_CPU_PRESCALER)); | ||||
|     FAUXCLICKY_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (note[0] * FAUXCLICKY_CPU_PRESCALER)) / 2); | ||||
|     note_playing = true; | ||||
|     note_period = (note[1] / 16) * (60 / (float)FAUXCLICKY_TEMPO) * 100;   // check this
 | ||||
|     note_start = timer_read(); | ||||
|     FAUXCLICKY_ENABLE_OUTPUT; | ||||
| } | ||||
| 
 | ||||
| void fauxclicky_check() { | ||||
|     if (!note_playing) return; | ||||
| 
 | ||||
|     if (timer_elapsed(note_start) > note_period) { | ||||
|         fauxclicky_stop(); | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,99 @@ | ||||
| /*
 | ||||
| Copyright 2017 Priyadi Iman Nurcahyo | ||||
| 
 | ||||
| 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/>.
 | ||||
| */ | ||||
| 
 | ||||
| #ifdef AUDIO_ENABLE | ||||
| #error "AUDIO_ENABLE and FAUXCLICKY_ENABLE cannot be both enabled" | ||||
| #endif | ||||
| 
 | ||||
| #include "musical_notes.h" | ||||
| #include "stdbool.h" | ||||
| 
 | ||||
| __attribute__ ((weak)) | ||||
| float fauxclicky_pressed_note[2]; | ||||
| __attribute__ ((weak)) | ||||
| float fauxclicky_released_note[2]; | ||||
| __attribute__ ((weak)) | ||||
| float fauxclicky_beep_note[2]; | ||||
| 
 | ||||
| bool fauxclicky_enabled; | ||||
| 
 | ||||
| //
 | ||||
| // tempo in BPM
 | ||||
| //
 | ||||
| 
 | ||||
| #ifndef FAUXCLICKY_TEMPO | ||||
| #define FAUXCLICKY_TEMPO TEMPO_DEFAULT | ||||
| #endif | ||||
| 
 | ||||
| // beep on press
 | ||||
| #define FAUXCLICKY_ACTION_PRESS fauxclicky_play(fauxclicky_pressed_note) | ||||
| 
 | ||||
| // beep on release
 | ||||
| #define FAUXCLICKY_ACTION_RELEASE fauxclicky_play(fauxclicky_released_note) | ||||
| 
 | ||||
| // general purpose beep
 | ||||
| #define FAUXCLICKY_BEEP fauxclicky_play(fauxclicky_beep_note) | ||||
| 
 | ||||
| // enable
 | ||||
| #define FAUXCLICKY_ON fauxclicky_enabled = true | ||||
| 
 | ||||
| // disable
 | ||||
| #define FAUXCLICKY_OFF do { \ | ||||
|     fauxclicky_enabled = false; \ | ||||
|     fauxclicky_stop(); \ | ||||
| } while (0) | ||||
| 
 | ||||
| // toggle
 | ||||
| #define FAUXCLICKY_TOGGLE do { \ | ||||
|     if (fauxclicky_enabled) { \ | ||||
|         FAUXCLICKY_OFF; \ | ||||
|     } else { \ | ||||
|         FAUXCLICKY_ON; \ | ||||
|     } \ | ||||
| } while (0) | ||||
| 
 | ||||
| //
 | ||||
| // pin configuration
 | ||||
| //
 | ||||
| 
 | ||||
| #ifndef FAUXCLICKY_CPU_PRESCALER | ||||
| #define FAUXCLICKY_CPU_PRESCALER 8 | ||||
| #endif | ||||
| 
 | ||||
| #ifndef FAUXCLICKY_ENABLE_OUTPUT | ||||
| #define FAUXCLICKY_ENABLE_OUTPUT TCCR3A |= _BV(COM3A1); | ||||
| #endif | ||||
| 
 | ||||
| #ifndef FAUXCLICKY_DISABLE_OUTPUT | ||||
| #define FAUXCLICKY_DISABLE_OUTPUT TCCR3A &= ~(_BV(COM3A1) | _BV(COM3A0)); | ||||
| #endif | ||||
| 
 | ||||
| #ifndef FAUXCLICKY_TIMER_PERIOD | ||||
| #define FAUXCLICKY_TIMER_PERIOD ICR3 | ||||
| #endif | ||||
| 
 | ||||
| #ifndef FAUXCLICKY_DUTY_CYCLE | ||||
| #define FAUXCLICKY_DUTY_CYCLE OCR3A | ||||
| #endif | ||||
| 
 | ||||
| //
 | ||||
| // definitions
 | ||||
| //
 | ||||
| 
 | ||||
| void fauxclicky_init(void); | ||||
| void fauxclicky_stop(void); | ||||
| void fauxclicky_play(float note[2]); | ||||
| void fauxclicky_check(void); | ||||
| 
 | ||||
| @ -0,0 +1,133 @@ | ||||
| #include "process_ucis.h" | ||||
| 
 | ||||
| qk_ucis_state_t qk_ucis_state; | ||||
| 
 | ||||
| void qk_ucis_start(void) { | ||||
|   qk_ucis_state.count = 0; | ||||
|   qk_ucis_state.in_progress = true; | ||||
| 
 | ||||
|   qk_ucis_start_user(); | ||||
| } | ||||
| 
 | ||||
| __attribute__((weak)) | ||||
| void qk_ucis_start_user(void) { | ||||
|   unicode_input_start(); | ||||
|   register_hex(0x2328); | ||||
|   unicode_input_finish(); | ||||
| } | ||||
| 
 | ||||
| static bool is_uni_seq(char *seq) { | ||||
|   uint8_t i; | ||||
| 
 | ||||
|   for (i = 0; seq[i]; i++) { | ||||
|     uint16_t code; | ||||
|     if (('1' <= seq[i]) && (seq[i] <= '0')) | ||||
|       code = seq[i] - '1' + KC_1; | ||||
|     else | ||||
|       code = seq[i] - 'a' + KC_A; | ||||
| 
 | ||||
|     if (i > qk_ucis_state.count || qk_ucis_state.codes[i] != code) | ||||
|       return false; | ||||
|   } | ||||
| 
 | ||||
|   return (qk_ucis_state.codes[i] == KC_ENT || | ||||
|           qk_ucis_state.codes[i] == KC_SPC); | ||||
| } | ||||
| 
 | ||||
| __attribute__((weak)) | ||||
| void qk_ucis_symbol_fallback (void) { | ||||
|   for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) { | ||||
|     uint8_t code = qk_ucis_state.codes[i]; | ||||
|     register_code(code); | ||||
|     unregister_code(code); | ||||
|     wait_ms(UNICODE_TYPE_DELAY); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void register_ucis(const char *hex) { | ||||
|   for(int i = 0; hex[i]; i++) { | ||||
|     uint8_t kc = 0; | ||||
|     char c = hex[i]; | ||||
| 
 | ||||
|     switch (c) { | ||||
|     case '0': | ||||
|       kc = KC_0; | ||||
|       break; | ||||
|     case '1' ... '9': | ||||
|       kc = c - '1' + KC_1; | ||||
|       break; | ||||
|     case 'a' ... 'f': | ||||
|       kc = c - 'a' + KC_A; | ||||
|       break; | ||||
|     case 'A' ... 'F': | ||||
|       kc = c - 'A' + KC_A; | ||||
|       break; | ||||
|     } | ||||
| 
 | ||||
|     if (kc) { | ||||
|       register_code (kc); | ||||
|       unregister_code (kc); | ||||
|       wait_ms (UNICODE_TYPE_DELAY); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| bool process_ucis (uint16_t keycode, keyrecord_t *record) { | ||||
|   uint8_t i; | ||||
| 
 | ||||
|   if (!qk_ucis_state.in_progress) | ||||
|     return true; | ||||
| 
 | ||||
|   if (qk_ucis_state.count >= UCIS_MAX_SYMBOL_LENGTH && | ||||
|       !(keycode == KC_BSPC || keycode == KC_ESC || keycode == KC_SPC || keycode == KC_ENT)) { | ||||
|     return false; | ||||
|   } | ||||
| 
 | ||||
|   if (!record->event.pressed) | ||||
|     return true; | ||||
| 
 | ||||
|   qk_ucis_state.codes[qk_ucis_state.count] = keycode; | ||||
|   qk_ucis_state.count++; | ||||
| 
 | ||||
|   if (keycode == KC_BSPC) { | ||||
|     if (qk_ucis_state.count >= 2) { | ||||
|       qk_ucis_state.count -= 2; | ||||
|       return true; | ||||
|     } else { | ||||
|       qk_ucis_state.count--; | ||||
|       return false; | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   if (keycode == KC_ENT || keycode == KC_SPC || keycode == KC_ESC) { | ||||
|     bool symbol_found = false; | ||||
| 
 | ||||
|     for (i = qk_ucis_state.count; i > 0; i--) { | ||||
|       register_code (KC_BSPC); | ||||
|       unregister_code (KC_BSPC); | ||||
|       wait_ms(UNICODE_TYPE_DELAY); | ||||
|     } | ||||
| 
 | ||||
|     if (keycode == KC_ESC) { | ||||
|       qk_ucis_state.in_progress = false; | ||||
|       return false; | ||||
|     } | ||||
| 
 | ||||
|     unicode_input_start(); | ||||
|     for (i = 0; ucis_symbol_table[i].symbol; i++) { | ||||
|       if (is_uni_seq (ucis_symbol_table[i].symbol)) { | ||||
|         symbol_found = true; | ||||
|         register_ucis(ucis_symbol_table[i].code + 2); | ||||
|         break; | ||||
|       } | ||||
|     } | ||||
|     if (!symbol_found) { | ||||
|       qk_ucis_symbol_fallback(); | ||||
|     } | ||||
|     unicode_input_finish(); | ||||
| 
 | ||||
|     qk_ucis_state.in_progress = false; | ||||
|     return false; | ||||
|   } | ||||
|   return true; | ||||
| } | ||||
| @ -0,0 +1,35 @@ | ||||
| #ifndef PROCESS_UCIS_H | ||||
| #define PROCESS_UCIS_H | ||||
| 
 | ||||
| #include "quantum.h" | ||||
| #include "process_unicode_common.h" | ||||
| 
 | ||||
| #ifndef UCIS_MAX_SYMBOL_LENGTH | ||||
| #define UCIS_MAX_SYMBOL_LENGTH 32 | ||||
| #endif | ||||
| 
 | ||||
| typedef struct { | ||||
|   char *symbol; | ||||
|   char *code; | ||||
| } qk_ucis_symbol_t; | ||||
| 
 | ||||
| typedef struct { | ||||
|   uint8_t count; | ||||
|   uint16_t codes[UCIS_MAX_SYMBOL_LENGTH]; | ||||
|   bool in_progress:1; | ||||
| } qk_ucis_state_t; | ||||
| 
 | ||||
| extern qk_ucis_state_t qk_ucis_state; | ||||
| 
 | ||||
| #define UCIS_TABLE(...) {__VA_ARGS__, {NULL, NULL}} | ||||
| #define UCIS_SYM(name, code) {name, #code} | ||||
| 
 | ||||
| extern const qk_ucis_symbol_t ucis_symbol_table[]; | ||||
| 
 | ||||
| void qk_ucis_start(void); | ||||
| void qk_ucis_start_user(void); | ||||
| void qk_ucis_symbol_fallback (void); | ||||
| void register_ucis(const char *hex); | ||||
| bool process_ucis (uint16_t keycode, keyrecord_t *record); | ||||
| 
 | ||||
| #endif | ||||
| @ -0,0 +1,85 @@ | ||||
| #include "process_unicode_common.h" | ||||
| 
 | ||||
| uint8_t mods; | ||||
| 
 | ||||
| void set_unicode_input_mode(uint8_t os_target) | ||||
| { | ||||
|   input_mode = os_target; | ||||
| } | ||||
| 
 | ||||
| uint8_t get_unicode_input_mode(void) { | ||||
|   return input_mode; | ||||
| } | ||||
| 
 | ||||
| __attribute__((weak)) | ||||
| void unicode_input_start (void) { | ||||
|   // save current mods
 | ||||
|   mods = keyboard_report->mods; | ||||
| 
 | ||||
|   // unregister all mods to start from clean state
 | ||||
|   if (mods & MOD_BIT(KC_LSFT)) unregister_code(KC_LSFT); | ||||
|   if (mods & MOD_BIT(KC_RSFT)) unregister_code(KC_RSFT); | ||||
|   if (mods & MOD_BIT(KC_LCTL)) unregister_code(KC_LCTL); | ||||
|   if (mods & MOD_BIT(KC_RCTL)) unregister_code(KC_RCTL); | ||||
|   if (mods & MOD_BIT(KC_LALT)) unregister_code(KC_LALT); | ||||
|   if (mods & MOD_BIT(KC_RALT)) unregister_code(KC_RALT); | ||||
|   if (mods & MOD_BIT(KC_LGUI)) unregister_code(KC_LGUI); | ||||
|   if (mods & MOD_BIT(KC_RGUI)) unregister_code(KC_RGUI); | ||||
| 
 | ||||
|   switch(input_mode) { | ||||
|   case UC_OSX: | ||||
|     register_code(KC_LALT); | ||||
|     break; | ||||
|   case UC_LNX: | ||||
|     register_code(KC_LCTL); | ||||
|     register_code(KC_LSFT); | ||||
|     register_code(KC_U); | ||||
|     unregister_code(KC_U); | ||||
|     unregister_code(KC_LSFT); | ||||
|     unregister_code(KC_LCTL); | ||||
|     break; | ||||
|   case UC_WIN: | ||||
|     register_code(KC_LALT); | ||||
|     register_code(KC_PPLS); | ||||
|     unregister_code(KC_PPLS); | ||||
|     break; | ||||
|   case UC_WINC: | ||||
|     register_code(KC_RALT); | ||||
|     unregister_code(KC_RALT); | ||||
|     register_code(KC_U); | ||||
|     unregister_code(KC_U); | ||||
|   } | ||||
|   wait_ms(UNICODE_TYPE_DELAY); | ||||
| } | ||||
| 
 | ||||
| __attribute__((weak)) | ||||
| void unicode_input_finish (void) { | ||||
|   switch(input_mode) { | ||||
|     case UC_OSX: | ||||
|     case UC_WIN: | ||||
|       unregister_code(KC_LALT); | ||||
|       break; | ||||
|     case UC_LNX: | ||||
|       register_code(KC_SPC); | ||||
|       unregister_code(KC_SPC); | ||||
|       break; | ||||
|   } | ||||
| 
 | ||||
|   // reregister previously set mods
 | ||||
|   if (mods & MOD_BIT(KC_LSFT)) register_code(KC_LSFT); | ||||
|   if (mods & MOD_BIT(KC_RSFT)) register_code(KC_RSFT); | ||||
|   if (mods & MOD_BIT(KC_LCTL)) register_code(KC_LCTL); | ||||
|   if (mods & MOD_BIT(KC_RCTL)) register_code(KC_RCTL); | ||||
|   if (mods & MOD_BIT(KC_LALT)) register_code(KC_LALT); | ||||
|   if (mods & MOD_BIT(KC_RALT)) register_code(KC_RALT); | ||||
|   if (mods & MOD_BIT(KC_LGUI)) register_code(KC_LGUI); | ||||
|   if (mods & MOD_BIT(KC_RGUI)) register_code(KC_RGUI); | ||||
| } | ||||
| 
 | ||||
| void register_hex(uint16_t hex) { | ||||
|   for(int i = 3; i >= 0; i--) { | ||||
|     uint8_t digit = ((hex >> (i*4)) & 0xF); | ||||
|     register_code(hex_to_keycode(digit)); | ||||
|     unregister_code(hex_to_keycode(digit)); | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,132 @@ | ||||
| #ifndef PROCESS_UNICODE_COMMON_H | ||||
| #define PROCESS_UNICODE_COMMON_H | ||||
| 
 | ||||
| #include "quantum.h" | ||||
| 
 | ||||
| #ifndef UNICODE_TYPE_DELAY | ||||
| #define UNICODE_TYPE_DELAY 10 | ||||
| #endif | ||||
| 
 | ||||
| __attribute__ ((unused)) | ||||
| static uint8_t input_mode; | ||||
| 
 | ||||
| void set_unicode_input_mode(uint8_t os_target); | ||||
| uint8_t get_unicode_input_mode(void); | ||||
| void unicode_input_start(void); | ||||
| void unicode_input_finish(void); | ||||
| void register_hex(uint16_t hex); | ||||
| 
 | ||||
| #define UC_OSX 0  // Mac OS X
 | ||||
| #define UC_LNX 1  // Linux
 | ||||
| #define UC_WIN 2  // Windows 'HexNumpad'
 | ||||
| #define UC_BSD 3  // BSD (not implemented)
 | ||||
| #define UC_WINC 4 // WinCompose https://github.com/samhocevar/wincompose
 | ||||
| 
 | ||||
| #define UC_BSPC	UC(0x0008) | ||||
| 
 | ||||
| #define UC_SPC	UC(0x0020) | ||||
| 
 | ||||
| #define UC_EXLM	UC(0x0021) | ||||
| #define UC_DQUT	UC(0x0022) | ||||
| #define UC_HASH	UC(0x0023) | ||||
| #define UC_DLR	UC(0x0024) | ||||
| #define UC_PERC	UC(0x0025) | ||||
| #define UC_AMPR	UC(0x0026) | ||||
| #define UC_QUOT	UC(0x0027) | ||||
| #define UC_LPRN	UC(0x0028) | ||||
| #define UC_RPRN	UC(0x0029) | ||||
| #define UC_ASTR	UC(0x002A) | ||||
| #define UC_PLUS	UC(0x002B) | ||||
| #define UC_COMM	UC(0x002C) | ||||
| #define UC_DASH	UC(0x002D) | ||||
| #define UC_DOT	UC(0x002E) | ||||
| #define UC_SLSH	UC(0x002F) | ||||
| 
 | ||||
| #define UC_0	UC(0x0030) | ||||
| #define UC_1	UC(0x0031) | ||||
| #define UC_2	UC(0x0032) | ||||
| #define UC_3	UC(0x0033) | ||||
| #define UC_4	UC(0x0034) | ||||
| #define UC_5	UC(0x0035) | ||||
| #define UC_6	UC(0x0036) | ||||
| #define UC_7	UC(0x0037) | ||||
| #define UC_8	UC(0x0038) | ||||
| #define UC_9	UC(0x0039) | ||||
| 
 | ||||
| #define UC_COLN UC(0x003A) | ||||
| #define UC_SCLN UC(0x003B) | ||||
| #define UC_LT	UC(0x003C) | ||||
| #define UC_EQL	UC(0x003D) | ||||
| #define UC_GT	UC(0x003E) | ||||
| #define UC_QUES	UC(0x003F) | ||||
| #define UC_AT 	UC(0x0040) | ||||
| 
 | ||||
| #define UC_A 	UC(0x0041) | ||||
| #define UC_B 	UC(0x0042) | ||||
| #define UC_C 	UC(0x0043) | ||||
| #define UC_D 	UC(0x0044) | ||||
| #define UC_E 	UC(0x0045) | ||||
| #define UC_F 	UC(0x0046) | ||||
| #define UC_G 	UC(0x0047) | ||||
| #define UC_H 	UC(0x0048) | ||||
| #define UC_I 	UC(0x0049) | ||||
| #define UC_J 	UC(0x004A) | ||||
| #define UC_K 	UC(0x004B) | ||||
| #define UC_L 	UC(0x004C) | ||||
| #define UC_M 	UC(0x004D) | ||||
| #define UC_N 	UC(0x004E) | ||||
| #define UC_O 	UC(0x004F) | ||||
| #define UC_P 	UC(0x0050) | ||||
| #define UC_Q 	UC(0x0051) | ||||
| #define UC_R 	UC(0x0052) | ||||
| #define UC_S 	UC(0x0053) | ||||
| #define UC_T 	UC(0x0054) | ||||
| #define UC_U 	UC(0x0055) | ||||
| #define UC_V 	UC(0x0056) | ||||
| #define UC_W 	UC(0x0057) | ||||
| #define UC_X 	UC(0x0058) | ||||
| #define UC_Y 	UC(0x0059) | ||||
| #define UC_Z 	UC(0x005A) | ||||
| 
 | ||||
| #define UC_LBRC	UC(0x005B) | ||||
| #define UC_BSLS	UC(0x005C) | ||||
| #define UC_RBRC	UC(0x005D) | ||||
| #define UC_CIRM	UC(0x005E) | ||||
| #define UC_UNDR	UC(0x005F) | ||||
| 
 | ||||
| #define UC_GRV 	UC(0x0060) | ||||
| 
 | ||||
| #define UC_a 	UC(0x0061) | ||||
| #define UC_b 	UC(0x0062) | ||||
| #define UC_c 	UC(0x0063) | ||||
| #define UC_d 	UC(0x0064) | ||||
| #define UC_e 	UC(0x0065) | ||||
| #define UC_f 	UC(0x0066) | ||||
| #define UC_g 	UC(0x0067) | ||||
| #define UC_h 	UC(0x0068) | ||||
| #define UC_i 	UC(0x0069) | ||||
| #define UC_j 	UC(0x006A) | ||||
| #define UC_k 	UC(0x006B) | ||||
| #define UC_l 	UC(0x006C) | ||||
| #define UC_m 	UC(0x006D) | ||||
| #define UC_n 	UC(0x006E) | ||||
| #define UC_o 	UC(0x006F) | ||||
| #define UC_p 	UC(0x0070) | ||||
| #define UC_q 	UC(0x0071) | ||||
| #define UC_r 	UC(0x0072) | ||||
| #define UC_s 	UC(0x0073) | ||||
| #define UC_t 	UC(0x0074) | ||||
| #define UC_u 	UC(0x0075) | ||||
| #define UC_v 	UC(0x0076) | ||||
| #define UC_w 	UC(0x0077) | ||||
| #define UC_x 	UC(0x0078) | ||||
| #define UC_y 	UC(0x0079) | ||||
| #define UC_z 	UC(0x007A) | ||||
| 
 | ||||
| #define UC_LCBR	UC(0x007B) | ||||
| #define UC_PIPE	UC(0x007C) | ||||
| #define UC_RCBR	UC(0x007D) | ||||
| #define UC_TILD	UC(0x007E) | ||||
| #define UC_DEL	UC(0x007F) | ||||
| 
 | ||||
| #endif | ||||
| @ -0,0 +1,54 @@ | ||||
| #include "process_unicodemap.h" | ||||
| 
 | ||||
| __attribute__((weak)) | ||||
| const uint32_t PROGMEM unicode_map[] = { | ||||
| }; | ||||
| 
 | ||||
| void register_hex32(uint32_t hex) { | ||||
|   uint8_t onzerostart = 1; | ||||
|   for(int i = 7; i >= 0; i--) { | ||||
|     if (i <= 3) { | ||||
|       onzerostart = 0; | ||||
|     } | ||||
|     uint8_t digit = ((hex >> (i*4)) & 0xF); | ||||
|     if (digit == 0) { | ||||
|       if (onzerostart == 0) { | ||||
|         register_code(hex_to_keycode(digit)); | ||||
|         unregister_code(hex_to_keycode(digit)); | ||||
|       } | ||||
|     } else { | ||||
|       register_code(hex_to_keycode(digit)); | ||||
|       unregister_code(hex_to_keycode(digit)); | ||||
|       onzerostart = 0; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| __attribute__((weak)) | ||||
| void unicode_map_input_error() {} | ||||
| 
 | ||||
| bool process_unicode_map(uint16_t keycode, keyrecord_t *record) { | ||||
|   if ((keycode & QK_UNICODE_MAP) == QK_UNICODE_MAP && record->event.pressed) { | ||||
|     const uint32_t* map = unicode_map; | ||||
|     uint16_t index = keycode - QK_UNICODE_MAP; | ||||
|     uint32_t code = pgm_read_dword_far(&map[index]); | ||||
|     if (code > 0xFFFF && code <= 0x10ffff && input_mode == UC_OSX) { | ||||
|       // Convert to UTF-16 surrogate pair
 | ||||
|       code -= 0x10000; | ||||
|       uint32_t lo = code & 0x3ff; | ||||
|       uint32_t hi = (code & 0xffc00) >> 10; | ||||
|       unicode_input_start(); | ||||
|       register_hex32(hi + 0xd800); | ||||
|       register_hex32(lo + 0xdc00); | ||||
|       unicode_input_finish(); | ||||
|     } else if ((code > 0x10ffff && input_mode == UC_OSX) || (code > 0xFFFFF && input_mode == UC_LNX)) { | ||||
|       // when character is out of range supported by the OS
 | ||||
|       unicode_map_input_error(); | ||||
|     } else { | ||||
|       unicode_input_start(); | ||||
|       register_hex32(code); | ||||
|       unicode_input_finish(); | ||||
|     } | ||||
|   } | ||||
|   return true; | ||||
| } | ||||
| @ -0,0 +1,9 @@ | ||||
| #ifndef PROCESS_UNICODEMAP_H | ||||
| #define PROCESS_UNICODEMAP_H | ||||
| 
 | ||||
| #include "quantum.h" | ||||
| #include "process_unicode_common.h" | ||||
| 
 | ||||
| void unicode_map_input_error(void); | ||||
| bool process_unicode_map(uint16_t keycode, keyrecord_t *record); | ||||
| #endif | ||||
 Jack Humbert
						Jack Humbert