]> git.gir.st - tmk_keyboard.git/blob - converter/next_usb/keymap.c
90700da556deccbddcccb08ebc47f80945facf24
[tmk_keyboard.git] / converter / next_usb / keymap.c
1 /*
2 NeXT non-ADB Keyboard USB Converter
3
4 Copyright 2013, Benjamin Gould (bgould@github.com)
5
6 Based on:
7 ---------
8 * TMK firmware code Copyright 2011,2012 Jun WAKO <wakojun@gmail.com>
9 * Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/) \
10 released under BSD license \
11 https://github.com/adafruit/USB-NeXT-Keyboard
12
13 Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB
14 Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html
15 Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/
16
17 This software is licensed with a Modified BSD License.
18 All of this is supposed to be Free Software, Open Source, DFSG-free,
19 GPL-compatible, and OK to use in both free and proprietary applications.
20 Additions and corrections to this file are welcome.
21
22 Redistribution and use in source and binary forms, with or without
23 modification, are permitted provided that the following conditions are met:
24
25 * Redistributions of source code must retain the above copyright
26 notice, this list of conditions and the following disclaimer.
27
28 * Redistributions in binary form must reproduce the above copyright
29 notice, this list of conditions and the following disclaimer in
30 the documentation and/or other materials provided with the
31 distribution.
32
33 * Neither the name of the copyright holders nor the names of
34 contributors may be used to endorse or promote products derived
35 from this software without specific prior written permission.
36
37 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
38 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
40 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
41 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
43 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
44 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
45 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
47 POSSIBILITY OF SUCH DAMAGE.
48
49 */
50
51 #include <stdint.h>
52 #include <stdbool.h>
53 #include "keycode.h"
54 #include "print.h"
55 #include "debug.h"
56 #include "util.h"
57 #include "keymap.h"
58 #include "keycode.h"
59
60 // 32*8(256) byte array which converts PS/2 code into USB code
61 const action_t PROGMEM fn_actions[] = {
62 ACTION_LAYER_MOMENTARY(1), // FN0 - left command key
63 ACTION_LAYER_MOMENTARY(1), // FN1 - right command key
64 ACTION_KEY(KC_BSLS), // FN2 - number pad slash & backslash
65 ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), // FN3 - number pad equals & pipe
66 ACTION_MODS_KEY(MOD_LCTL, KC_Z), // FN4 - cmd+undo on layer 1
67 ACTION_MODS_KEY(MOD_LCTL, KC_X), // FN5 - cmd+cut on layer 1
68 ACTION_MODS_KEY(MOD_LCTL, KC_C), // FN6 - cmd+copy on layer 1
69 ACTION_MODS_KEY(MOD_LCTL, KC_V), // FN7 - cmd+paste on layer 1
70 };
71
72 /* This is the physical layout that I am starting with:
73 * Note: there is some strangeness on the number pad;
74 * the equal sign shifts to pipe and forward slash shifts to backslash
75 * ,-----------------------------------------------------------. ,-----------. ,---------------.
76 * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BS | |VUp|Pwr|BrU| |` | =| /| *|
77 * |-----------------------------------------------------------| |-----------| |---------------|
78 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |VDn| |BrD| | 7| 8| 9| -|
79 * |------------------------------------------------------ | `---' `---' |-----------|---|
80 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| Return| | 4| 5| 6| +|
81 * |-----------------------------------------------------------| ,---. |---------------|
82 * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up | | 1| 2| 3| |
83 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
84 * |Alt |Cmd | Space |Cmd |Alt | |Lef|Dow|Rig| | 0| .| |
85 * `-----------------------------------------------------------' `-----------' `---------------'
86 *
87 * Keymap array:
88 * 8 bytes
89 * +---------+
90 * 0| |
91 * :| | 0x00-0x87
92 * ;| |
93 * 11| |
94 * +---------+
95 */
96 #define KEYMAP( \
97 K49,K4A,K4B,K4C,K4D,K50,K4F,K4E,K1E,K1F,K20,K1D,K1C,K1B, K1A,K58,K19, K26,K27,K28,K25, \
98 K41,K42,K43,K44,K45,K48,K47,K46,K06,K07,K08,K05,K04,K03, K02, K01, K21,K22,K23,K24, \
99 K57,K39,K3A,K3B,K3C,K3D,K40,K3F,K3E,K2D,K2C,K2B, K2A, K12,K18,K13,K15, \
100 K56, K31,K32,K33,K34,K35,K37,K36,K2E,K2F,K30, K55, K16, K11,K17,K14, \
101 K52,K54, K38, K53,K51, K09,K0F,K10, K0B, K0C,K0D \
102 ) { \
103 { KC_NO, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
104 { KC_##K08, KC_##K09, KC_##K10, KC_##K0B, KC_##K0C, KC_##K0D, KC_NO, KC_##K0F }, \
105 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
106 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
107 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
108 { KC_##K28, KC_NO, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
109 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
110 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
111 { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
112 { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
113 { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
114 { KC_##K58, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
115 }
116
117
118 const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
119
120 /* Layer 0: default
121 * ,-----------------------------------------------------------. ,-----------. ,---------------.
122 * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BS | |Ins|Ref|Hom| |` | =| /| *|
123 * |-----------------------------------------------------------| |-----------| |---------------|
124 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |Del| |End| | 7| 8| 9| -|
125 * |-----------------------------------------------------' | `---' `---' |-----------|---|
126 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| Return| | 4| 5| 6| +|
127 * |-----------------------------------------------------------| ,---. |---------------|
128 * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up | | 1| 2| 3| |
129 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
130 * |Fn0 |Alt | Space |LGui |Fn1 | |Lef|Dow|Rig| | 0| .| |
131 * `-----------------------------------------------------------' `-----------' `---------------'
132 */
133 KEYMAP(
134 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, WREF,HOME, GRV, FN3, FN2, PAST,
135 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,NO, DEL, END, P7, P8, P9, PMNS,
136 LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
137 LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
138 FN0, LALT, SPC, LGUI,FN1, LEFT,DOWN,RGHT, P0, PDOT,PENT
139
140 ),
141
142 /* Layer 1: extra keys
143 * ,-----------------------------------------------------------. ,-----------. ,---------------.
144 * |Grv| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| BS | |VUp|VMu|PgU| |` | =| /| *|
145 * |-----------------------------------------------------------| |-----------| |---------------|
146 * |Tab |Pau| W| E| R| T| Y| U| I| O|PSc| \| ]| | |VDn| |PgD| | 7| 8| 9| -|
147 * |-----------------------------------------------------' | `---' `---' |-----------|---|
148 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| Return| | 4| 5| 6| +|
149 * |-----------------------------------------------------------| ,---. |---------------|
150 * |Shift |UND|CUT|COP|PST| B| N| M| ,| .| /|Shift | |Up | | 1| 2| 3| |
151 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
152 * |Fn0 |Alt | Space |RGui |Fn1 | |Lef|Dow|Rig| | 0| .| |
153 * `-----------------------------------------------------------' `-----------' `---------------'
154 */
155 KEYMAP(
156
157 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, VOLU,MUTE,PGUP, TRNS,TRNS,TRNS,TRNS,
158 TRNS,PAUS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,FN3, BSLS,TRNS, VOLD, PGDN, BTN1,MS_U,BTN2,WH_U,
159 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, MS_L,MS_D,MS_R,WH_D,
160 TRNS, FN4, FN5, FN6, FN7, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, TRNS,TRNS,TRNS,
161 TRNS,TRNS, TRNS, TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS
162
163 )
164 };
Imprint / Impressum