* Duplicate default layout as basis of my own * Basic Colemak layer, just to practice flashing * Add reset button so that we don't have to short out the reset button on the board to flash it. * Symbols layer * Navigation layer, and remove unused keys. Now usable, nice. * Correct backspace for UK QWERTY mapping * Small clarification in XD75RE readme instructions * Use UK pipe so that I can type a pipe on a UK keyboard
		
			
				
	
	
		
			155 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			155 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /* Copyright 2017 Kenny Hung
 | |
|  *
 | |
|  * 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 "xd75.h"
 | |
| #include "keymap_uk.h"
 | |
| // Fillers to make layering more clear
 | |
| #define _______ KC_TRNS
 | |
| #define ___T___ KC_TRNS
 | |
| #define XXXXXXX KC_NO
 | |
| 
 | |
| // Layer shorthand
 | |
| #define _CM 0 // Colemak
 | |
| #define _QW 1 // Qwerty
 | |
| #define _DV 2 // Dvorak
 | |
| #define _NB 3 // Numbers
 | |
| #define _FN 4 // Function
 | |
| #define _SYL 5 // Symbols left
 | |
| #define _SYR 6 // Symbols right
 | |
| #define _NAV 7 // Navigation
 | |
| 
 | |
| const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | |
| 
 | |
| /* Colemak _CM
 | |
|  * .------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.
 | |
|  * |        |              |              |               |              |              |        |        |        |                |        |                  |                |               |        |
 | |
|  * |--------+--------------+--------------+---------------+--------------+--------------+--------+--------+--------+----------------+--------+------------------+----------------+------------------------|
 | |
|  * |        | Q            |   W          | F             | P            | G            |        |        |        | J              | L      | U                | Y              | ;             |        |
 | |
|  * |--------+--------------+--------------+---------------+--------------+--------------+--------+--------+--------+----------------+--------+------------------+----------------+------------------------|
 | |
|  * |        | A            |   R          | S             | T            | D            |        |        |        | H              | N      | E                | I              | O             | RETURN |
 | |
|  * |--------+--------------+--------------+---------------+--------------+--------------+--------+--------+--------+----------------+--------+------------------+----------------+------------------------|
 | |
|  * |        | sft or Z     | nb or X      | sym or C      | V            | nav or B     |        |        |        | nav or K       | M      | sym or ,         | nb or .        | sft or /      |        |
 | |
|  * |--------+--------------+--------------+---------------+--------------+--------------+--------+--------+--------+----------------+--------+------------------+----------------+------------------------|
 | |
|  * | LSHIFT | LCTRL        |   LALT       | LGUI          |              | SPACE        | LCTRL  | DEL    | LALT   | BACKSP         |        | RGUI             | RALT           | RCTRL         | RSHIFT |
 | |
|  * '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------'
 | |
|  */	
 | |
|  [_CM] = {
 | |
|   { _______, _______,       _______,       _______,        _______,       _______,        _______, _______, _______, _______,        _______, _______,           _______,          _______,        _______ },
 | |
|   { _______, KC_Q,          KC_W,          KC_F,           KC_P,          KC_G,           _______, _______, _______, KC_J,           KC_L,    KC_U,              KC_Y,             KC_SCLN,        _______ },
 | |
|   { _______, KC_A,          KC_R,          KC_S,           KC_T,          KC_D,           _______, _______, _______, KC_H,           KC_N,    KC_E,              KC_I,             KC_O,           KC_ENT  },
 | |
|   { _______, SFT_T(KC_Z),   LT(_NB, KC_X), LT(_SYL, KC_C), KC_V,          LT(_NAV, KC_B), _______, _______, _______, LT(_NAV, KC_K), KC_M,    LT(_SYR, KC_COMM), LT(_FN, KC_DOT),  SFT_T(KC_SLSH), _______ },
 | |
|   { KC_LSFT, KC_LCTL,       KC_LALT,       KC_LGUI,        LCTL(KC_QUOT), KC_SPC,         KC_LCTL, KC_DEL , KC_LALT, KC_BSPC,        _______, KC_RGUI,           KC_RALT,          KC_RCTL,        KC_RSFT },
 | |
|  },
 | |
| 
 | |
| /* Numbers _NB / Functions _FN
 | |
|  * .----------------------------------------------------------------------------------------------------------------------------------------------------.
 | |
|  * |        |        |              |        |        |        |        |        |        |        |        |        |                |        |        |
 | |
|  * |--------+--------+--------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+----------------+-----------------|
 | |
|  * |        |        | F7           | F8     | F9     | F10    |        |        |        |        | 7      | 8      | 9              |        |        |
 | |
|  * |--------+--------+--------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+----------------+--------+--------|
 | |
|  * |        |        | F4           | F5     | F6     | F11    |        |        |        |        | 4      | 5      | 6              |        |        |
 | |
|  * |--------+--------+--------------+--------+--------+--------+--------+--------+--------+--------+--------+----------------------------------+--------|
 | |
|  * |        |        | F1           | F2     | F3     | F12    |        |        |        |        | 1      | 2      | 3              |        |        |
 | |
|  * |--------+--------+--------------+--------+--------+--------+--------+--------+--------+--------+--------+-------------------------+--------+--------|
 | |
|  * |        |        |              |        |        |        |        |        |        |        | 0      | 0      | .              |        |        |
 | |
|  * '----------------------------------------------------------------------------------------------------------------------------------------------------'
 | |
|  */
 | |
|  [_NB] = {
 | |
|   { _______, _______, _______,       _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,         _______, _______, },
 | |
|   { _______, _______, KC_F7,         KC_F8,   KC_F9,   KC_F10,  _______, _______, _______, _______, KC_7,    KC_8,    KC_9,            _______, _______  },
 | |
|   { _______, _______, KC_F4,         KC_F5,   KC_F6,   KC_F11,  _______, _______, _______, _______, KC_4,    KC_5,    KC_6,            _______, _______  },
 | |
|   { _______, _______, LT(_NB, KC_X), KC_F2,   KC_F3,   KC_F12,  _______, _______, _______, _______, KC_1,    KC_2,    KC_3,            _______, _______  },
 | |
|   { _______, _______, _______,       _______, _______, _______, _______, _______, _______, _______, KC_0,    KC_0,    KC_DOT,          _______, _______  },
 | |
|  },
 | |
|  [_FN] = {
 | |
|   { _______, _______, _______,       _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,         _______, _______, },
 | |
|   { _______, _______, KC_F7,         KC_F8,   KC_F9,   KC_F10,  _______, _______, _______, _______, KC_7,    KC_8,    KC_9,            _______, _______  },
 | |
|   { _______, _______, KC_F4,         KC_F5,   KC_F6,   KC_F11,  _______, _______, _______, _______, KC_5,    KC_5,    KC_6,            _______, _______  },
 | |
|   { _______, _______, KC_F1,         KC_F2,   KC_F3,   KC_F12,  _______, _______, _______, _______, KC_1,    KC_2,    LT(_FN, KC_DOT), _______, _______  },
 | |
|   { _______, _______, _______,       _______, _______, _______, _______, _______, _______, _______, KC_0,    KC_0,    KC_DOT,          _______, _______  },
 | |
|  },
 | |
| 
 | |
| /* Symbols _SYL and _SYR
 | |
|  * .-------------------------------------------------------------------------------------------------------------------------------------------------------.
 | |
|  * |        |        |        |               |        |        |        |        |        |        |        |                  |        |        |        |
 | |
|  * |--------+--------+--------+---------------+--------+--------+--------+--------+--------+--------+--------+------------------+--------+--------+--------|
 | |
|  * |        | !      | £      | _             | -      | ~      |        |        |        | \      | {      | }                | /      | #      |        |
 | |
|  * |--------+--------+--------+---------------+--------+--------+--------+--------+--------+--------+--------+------------------+--------+--------+--------|
 | |
|  * |        | $      | %      | +             | =      |        |        |        |        | "      | (      | )                | '      | @      |        |
 | |
|  * |--------+--------+--------+---------------+--------+--------+--------+--------+--------+--------+--------+------------------+--------+--------+--------|
 | |
|  * |        | ^      | &      | *             | |      |        |        |        |        | <      | [      | ]                | >      | `      |        |
 | |
|  * |--------+--------+--------+---------------+--------+--------+--------+--------+--------+--------+--------+------------------+--------+--------+--------|
 | |
|  * |        |        |        |               |        |        |        |        |        |        |        |                  |        |        |        |
 | |
|  * '-------------------------------------------------------------------------------------------------------------------------------------------------------'
 | |
|  */ 
 | |
|  [_SYL] = {
 | |
|   { _______, _______, _______, _______,        _______, _______, _______, _______, _______, _______, _______, _______,           _______, _______, _______  },
 | |
|   { _______, KC_EXLM, UK_PND,  KC_UNDS,        KC_MINS, KC_TILD, _______, _______, _______, UK_BSLS, KC_LCBR, KC_RCBR,           KC_SLSH, UK_HASH, _______  },
 | |
|   { _______, KC_DLR,  KC_PERC, KC_PLUS,        KC_EQL,  _______, _______, _______, _______, UK_QUOT, KC_LPRN, KC_RPRN,           KC_QUOT, UK_AT,   _______  },
 | |
|   { _______, KC_CIRC, KC_AMPR, LT(_SYL, KC_C), UK_PIPE, _______, _______, _______, _______, KC_LABK, KC_LBRC, KC_RBRC,           KC_RABK, KC_GRV,  _______  },
 | |
|   { _______, _______, _______, _______,        _______, _______, _______, _______, _______, _______, _______, _______,           _______, _______, _______  },
 | |
|  }, 
 | |
|  [_SYR] = {
 | |
|   { _______, _______, _______, _______,        _______, _______, _______, _______, _______, _______, _______, _______,           _______, _______, _______  },
 | |
|   { _______, KC_EXLM, UK_PND,  KC_UNDS,        KC_MINS, KC_TILD, _______, _______, _______, KC_BSLS, KC_LCBR, KC_RCBR,           KC_SLSH, UK_HASH, _______  },
 | |
|   { _______, KC_DLR,  KC_PERC, KC_PLUS,        KC_EQL,  _______, _______, _______, _______, UK_QUOT, KC_LPRN, KC_RPRN,           KC_QUOT, UK_AT,   _______  },
 | |
|   { _______, KC_CIRC, KC_AMPR, KC_ASTR,        UK_PIPE, _______, _______, _______, _______, KC_LABK, KC_LBRC, LT(_SYR, KC_COMM), KC_RABK, KC_GRV,  _______  },
 | |
|   { _______, _______, _______, _______,        _______, _______, _______, _______, _______, _______, _______, _______,           _______, _______, _______  },
 | |
|  },
 | |
| /*
 | |
|  * Navigation
 | |
|  * .------------------------------------------------------------------------------------------------------------------------------------------------------------------.
 | |
|  * |        |          |              |        |              |               |        |        |        |               |        |        |        |        |        |
 | |
|  * |--------+----------+--------------+--------+--------------+---------------+--------+--------+--------+---------------+--------+--------+--------+--------+--------|
 | |
|  * |        | Esc      | Ctrl L       | Up     | Ctrl R       |               |        |        |        |               | PtSn   | ScLk   | Pause  |        |        |
 | |
|  * |--------+----------+--------------+--------+--------------+---------------+--------+--------+--------+---------------+--------+--------+--------+--------+--------|
 | |
|  * |        | Tab      | Left         | Down   | Right        |               |        |        |        |               | Insert | Home   | PgUp   |        |        |
 | |
|  * |--------+----------+--------------+--------+--------------+---------------+--------+--------+--------+---------------+--------+--------+--------+--------+--------|
 | |
|  * |        | ShTab    |              |        |              |               |        |        |        |               | ScLk   | End    | PgDn   |        |        |
 | |
|  * |--------+----------+--------------+--------+--------------+---------------+--------+--------+--------+---------------+--------+--------+--------+--------+--------|
 | |
|  * |        |          |              |        |              |               |        |        |        |               |        |        |        |        | RESET  |
 | |
|  * '------------------------------------------------------------------------------------------------------------------------------------------------------------------'
 | |
|  */
 | |
|  [_NAV] = {
 | |
|   { _______, _______,   _______,       _______, _______,       _______,        _______, _______, _______, _______,        _______, _______, _______, _______, _______  },
 | |
|   { _______, KC_ESC,    LCTL(KC_LEFT), KC_UP  , LCTL(KC_RGHT), _______,        _______, _______, _______, _______,        KC_PSCR, KC_SLCK, KC_PAUS, _______, _______  },
 | |
|   { _______, KC_TAB,    KC_LEFT,       KC_DOWN, KC_RGHT,       _______,        _______, _______, _______, _______,        KC_INS,  KC_HOME, KC_PGUP, _______, _______  },
 | |
|   { _______, S(KC_TAB), _______,       _______, _______,       LT(_NAV, KC_B), _______, _______, _______, LT(_NAV, KC_K), KC_SLCK, KC_END,  KC_PGDN, _______, _______  },
 | |
|   { _______, _______,   _______,       _______, _______,       _______,        _______, _______, _______, _______,        _______, _______, _______, _______, RESET    },
 | |
|  },
 | |
| };
 | |
| 
 | |
| const uint16_t PROGMEM fn_actions[] = {
 | |
| 
 | |
| };
 | |
| 
 | |
| const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
 | |
| {
 | |
|   // MACRODOWN only works in this function
 | |
|       switch(id) {
 | |
|         case 0:
 | |
|           if (record->event.pressed) {
 | |
|             register_code(KC_RSFT);
 | |
|             #ifdef BACKLIGHT_ENABLE
 | |
|               backlight_step();
 | |
|             #endif
 | |
|           } else {
 | |
|             unregister_code(KC_RSFT);
 | |
|           }
 | |
|         break;
 | |
|       }
 | |
|     return MACRO_NONE;
 | |
| };
 |