diff options
40 files changed, 2778 insertions, 201 deletions
diff --git a/common/command.c b/common/command.c index 8ca16b9102..6d4e4c642d 100644 --- a/common/command.c +++ b/common/command.c @@ -234,6 +234,7 @@ static bool command_common(uint8_t code) break; #ifdef NKRO_ENABLE case KC_N: + clear_keyboard(); //Prevents stuck keys. keyboard_nkro = !keyboard_nkro; if (keyboard_nkro) print("NKRO: enabled\n"); diff --git a/common/host.h b/common/host.h index c59fbfee6a..7c4f06601d 100644 --- a/common/host.h +++ b/common/host.h @@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define HOST_H #include <stdint.h> +#include <stdbool.h> #include "report.h" #include "host_driver.h" diff --git a/common/util.c b/common/util.c index 644301fe89..9d8fb93219 100644 --- a/common/util.c +++ b/common/util.c @@ -22,7 +22,7 @@ uint8_t bitpop(uint8_t bits) { uint8_t c; for (c = 0; bits; c++) - bits &= bits -1; + bits &= bits - 1; return c; /* const uint8_t bit_count[] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 }; @@ -30,6 +30,14 @@ uint8_t bitpop(uint8_t bits) */ } +uint8_t bitpop16(uint16_t bits) +{ + uint8_t c; + for (c = 0; bits; c++) + bits &= bits - 1; + return c; +} + // most significant on-bit - return highest location of on-bit uint8_t biton(uint8_t bits) { diff --git a/common/util.h b/common/util.h index 87636c9710..c3734487f9 100644 --- a/common/util.h +++ b/common/util.h @@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UTIL_H -#define UTIL_H 1 +#define UTIL_H #include <stdint.h> @@ -29,6 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. uint8_t bitpop(uint8_t bits); +uint8_t bitpop16(uint16_t bits); uint8_t biton(uint8_t bits); #endif diff --git a/converter/adb_usb/keymap.c b/converter/adb_usb/keymap.c index c622dc6238..bde829de3e 100644 --- a/converter/adb_usb/keymap.c +++ b/converter/adb_usb/keymap.c @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* +/* * Keymap for ADB keyboard */ #include <stdint.h> @@ -31,36 +31,84 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)])) -// Convert physical keyboard layout to matrix array. -// This is a macro to define keymap easily in keyboard layout form. -/* Apple Extended Keyboard */ -#define KEYMAP( \ +#define KEYMAP_ALL( \ K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \ K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \ K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \ K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \ K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \ - K36,K3A,K37, K31, K3B,K3D,K3C, K52, K41,K4C \ + K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C, \ + /* for ISO/JIS keyboard */ \ + K0A, /* NON-US \ and | 0x64 */ \ + K34, /* Keypad ENTER 0x58 */ \ + K40, /* F17 0x6C */ \ + K44, /* F18? 0x6d */ \ + K4F, /* F18 0x6d */ \ + K50, /* F19 0x6e */ \ + K5A, /* F20 0x6f */ \ + K5D, /* INTL3(Yen) 0x89 */ \ + K5E, /* INTL1(Ro) 0x87 */ \ + K5F, /* Keypad Comma 0x85 */ \ + K66, /* LANG2(Eisu) 0x91 */ \ + K68, /* LANG1(Kana) 0x90 */ \ + K6A, /* F16 0x6B */ \ + K6E /* Application 0x65 */ \ ) { \ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \ - { KC_##K08, KC_##K09, KC_NO, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ + { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \ - { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_NO, KC_##K35, KC_##K36, KC_##K37 }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \ - { KC_NO, KC_##K41, KC_NO, KC_##K43, KC_NO, KC_##K45, KC_NO, KC_##K47 }, \ - { KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_NO }, \ - { KC_NO, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \ - { KC_##K58, KC_##K59, KC_NO, KC_##K5B, KC_##K5C, KC_NO, KC_NO, KC_NO }, \ - { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_NO, KC_##K67 }, \ - { KC_NO, KC_##K69, KC_NO, KC_##K6B, KC_NO, KC_##K6D, KC_NO, KC_##K6F }, \ + { KC_##K40, KC_##K41, KC_NO, KC_##K43, KC_##K44, KC_##K45, KC_NO, KC_##K47 }, \ + { KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_##K4F }, \ + { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \ + { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, \ + { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \ + { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_NO, KC_##K6D, KC_##K6E, KC_##K6F }, \ { KC_NO, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \ - { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_NO, KC_NO, KC_NO, KC_##K7F } \ + { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_NO, KC_##K7F } \ } + +// Convert physical keyboard layout to matrix array. +// This is a macro to define keymap easily in keyboard layout form. +/* Apple Extended Keyboard */ +#define KEYMAP_EXTENDED_US( \ + K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \ + K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \ + K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \ + K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \ + K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \ + K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \ +) KEYMAP_ALL( \ + K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \ + K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \ + K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \ + K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \ + K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \ + K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C, \ + /* for ISO/JIS keyboard */ \ + NONUS_BSLASH, /* NON-US \ and | 0x64 */ \ + KP_ENTER, /* Keypad ENTER 0x58 */ \ + F17, /* F17 0x6C */ \ + F18, /* F18? 0x6d */ \ + F18, /* F18 0x6d */ \ + F19, /* F19 0x6e */ \ + F20, /* F20 0x6f */ \ + INT3, /* INTL3(Yen) 0x89 */ \ + INT1, /* INTL1(Ro) 0x87 */ \ + KP_COMMA, /* Keypad Comma 0x85 */ \ + LANG2, /* LANG2(Eisu) 0x91 */ \ + LANG1, /* LANG1(Kana) 0x90 */ \ + F16, /* F16 0x6B */ \ + APPLICATION /* Application 0x65 */ \ +) + + // Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. static const uint8_t PROGMEM fn_layer[] = { 0, // Fn0 @@ -103,13 +151,13 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Ctrl |Gui |Alt | Space | | | | |Lef|Dow|Rig| | 0| .| | * `-----------------------------------------------------------' `-----------' `---------------' */ - KEYMAP( + KEYMAP_EXTENDED_US( ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, PWR, - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS, CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, - LCTL,LGUI,LALT, SPC, LEFT,DOWN,RGHT, P0, PDOT,PENT + LCTL,LGUI,LALT, SPC, RGUI,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT ), }; diff --git a/converter/m0110_usb/Makefile b/converter/m0110_usb/Makefile index 1fee258a6f..bf0f083f6d 100644 --- a/converter/m0110_usb/Makefile +++ b/converter/m0110_usb/Makefile @@ -35,9 +35,9 @@ F_CPU = 16000000 # Build Options # *Comment out* to disable the options. # -MOUSEKEY_ENABLE = yes # Mouse keys +#MOUSEKEY_ENABLE = yes # Mouse keys #PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support -EXTRAKEY_ENABLE = yes # Audio control and System control +#EXTRAKEY_ENABLE = yes # Audio control and System control #NKRO_ENABLE = yes # USB Nkey Rollover @@ -55,6 +55,3 @@ include $(TOP_DIR)/protocol/pjrc.mk include $(TOP_DIR)/protocol.mk include $(TOP_DIR)/common.mk include $(TOP_DIR)/rules.mk - -hasu: EXTRAFLAGS += -DHASU -hasu: all diff --git a/converter/m0110_usb/Makefile.hasu b/converter/m0110_usb/Makefile.hasu new file mode 100644 index 0000000000..b35b3cce5a --- /dev/null +++ b/converter/m0110_usb/Makefile.hasu @@ -0,0 +1,57 @@ +# Target file name (without extension). +TARGET = m0110 + +# Directory common source filess exist +TOP_DIR = ../.. + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# keyboard dependent files +SRC = keymap_hasu.c \ + matrix.c \ + led.c \ + m0110.c + +CONFIG_H = config.h + + +# MCU name, you MUST set this to match the board you are using +# type "make clean" after changing this, so all files will be rebuilt +#MCU = at90usb162 # Teensy 1.0 +MCU = atmega32u4 # Teensy 2.0 +#MCU = at90usb646 # Teensy++ 1.0 +#MCU = at90usb1286 # Teensy++ 2.0 + + +# Processor frequency. +# Normally the first thing your program should do is set the clock prescaler, +# so your program will run at the correct speed. You should also set this +# variable to same clock speed. The _delay_ms() macro uses this, and many +# examples use this variable to calculate timings. Do not add a "UL" here. +F_CPU = 16000000 + + +# Build Options +# *Comment out* to disable the options. +# +MOUSEKEY_ENABLE = yes # Mouse keys +#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support +EXTRAKEY_ENABLE = yes # Audio control and System control +#NKRO_ENABLE = yes # USB Nkey Rollover + + + +#---------------- Programming Options -------------------------- +PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex + + +# Search Path +VPATH += $(TARGET_DIR) +VPATH += $(TOP_DIR) + + +include $(TOP_DIR)/protocol/pjrc.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk diff --git a/converter/m0110_usb/README.md b/converter/m0110_usb/README.md index 0ad3631f7c..206f434251 100644 --- a/converter/m0110_usb/README.md +++ b/converter/m0110_usb/README.md @@ -4,9 +4,10 @@ This firmware converts the protocol of Apple Macintosh keyboard M0110/M0110A int Target board of this project is [PJRC Teensy](http://www.pjrc.com/teensy/), though, you can use other board with USB AVR like `ATmega32U4` and `AT90USB`. - + -M0110A support was contributed by [skagon@github](https://github.com/skagon). +- M0110A support was contributed by [skagon@github](https://github.com/skagon). +- M0120 also is supported. keys(+ * / and ,) on M0120 are recognized as cursor keys. @@ -19,7 +20,7 @@ you can change pin configuration with editing *config.h*. You can find 4P4C plugs on telephone handset cable. Note that it is *crossover* connection while Macintosh keyboard cable is *straight*. -[](http://i.imgur.com/vJoVO.jpg) +[] In this pic: @@ -28,7 +29,7 @@ In this pic: 3. `DATA`(Green) 4. `+5V`(Yellow) -Not that wire colors may vary in your cable. +Note that wire colors may vary in your cable. ### Pinout @@ -62,56 +63,56 @@ Keymap ------ You can change keymaps by editing *keymap.c*. -### M0110 +### M0110 & M0120 #### *Default* - ,---------------------------------------------------------. - | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| - |---------------------------------------------------------| - |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| - |---------------------------------------------------------| - |Fn0 | A| S| D| F| G| H| J| K| L| ;| '|Return| - |---------------------------------------------------------| - |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | - `---------------------------------------------------------' - |Ctr|Alt | Space |Gui |Ctr| - `-----------------------------------------------' -#### *HHKB/WASD Layer* - ,---------------------------------------------------------. - |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| - |---------------------------------------------------------| - |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up | |Ins| - |---------------------------------------------------------| - |Fn0 |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Return| - |---------------------------------------------------------| - |Shift |End| |PgD| |VoD|VoU|Mut|End|PgD|Dow|Shift | - `---------------------------------------------------------' - |Ctr|Alt | Space |Gui |Ctr| - `-----------------------------------------------' + ,---------------------------------------------------------. ,---------------. + | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Ctl| -|Lft|Rgt| + |---------------------------------------------------------| |---------------| + |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| Up| + |---------------------------------------------------------| |---------------| + |Fn0 | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| Dn| + |---------------------------------------------------------| |---------------| + |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| | + `---------------------------------------------------------' |-----------|Ent| + |Alt|Gui | Space |Ctl |Alt| | 0| .| | + `-----------------------------------------------' `---------------' +#### *HHKB/WASD Layer(WASD/IJKL)* + ,---------------------------------------------------------. ,---------------. + |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| -|Lft|Rgt| + |---------------------------------------------------------| |---------------| + |Caps |Hom| Up|PgU| | | |PgU| Up|Hom|Psc|Slk|Pau|Ins| | 7| 8| 9| Up| + |---------------------------------------------------------| |---------------| + |Fn0 |Lef|Dow|Rig| | | |Lef|Dow|Rig| | |Return| | 4| 5| 6| Dn| + |---------------------------------------------------------| |---------------| + |Shift |End| |PgD| | | |PgD| |End| |Shift | | 1| 2| 3| | + `---------------------------------------------------------' |-----------|Ent| + |Alt|Gui | Space |Ctl |Alt| | 0| .| | + `-----------------------------------------------' `---------------' ### M0110A #### *Default* ,---------------------------------------------------------. ,---------------. - | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Gui| =| /| *| + | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Ctl| =| /| *| |---------------------------------------------------------| |---------------| |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| |-----------------------------------------------------' | |---------------| |Fn0 | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +| |---------------------------------------------------------| |---------------| - |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| | + |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft| Up| | 1| 2| 3| | |---------------------------------------------------------| |-----------|Ent| - |Ctrl |Alt | Space | \|Lft|Rgt|Dn | | 0| .| | + |Alt |Gui | Space | \|Lft|Rgt| Dn| | 0| .| | `---------------------------------------------------------' `---------------' -#### *HHKB/WASD/mousekey Layer* +#### *Cursor Layer(WASD/IJKL)* ,---------------------------------------------------------. ,---------------. - |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk|Mb1|Mb3|Mb2| + |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *| |---------------------------------------------------------| |---------------| - |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up | | | |MwD|McU|MwU|MwU| + |Caps |Hom| Up|PgU| | | |PgU| Up|Hom|Psc|Slk|Pau| | | 7| 8| 9| -| |-----------------------------------------------------' | |---------------| - |Fn0 |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Return| |McL|McD|McR|MwD| + |Fn0 |Lef|Dow|Rig| | | |Lef|Dow|Rig| | |Return| | 4| 5| 6| +| |---------------------------------------------------------| |---------------| - |Shift |End| |PgD| |VoD|VoU|Mut|End|PgD|Dow|Shif|Up | |MwL|McD|MwR| | - |---------------------------------------------------------| |-----------|Mb2| - |Ctrl |Alt | Space |Ins|Lft|Rgt|Dn | | Mb1|Mb3| | + |Shift |End| |PgD| | | |PgD| |End| |Shif|PgU| | 1| 2| 3| | + |---------------------------------------------------------| |-----------|Ent| + |Alt |Gui | Space |Ins|Hom|End|PgD| | 0| .| | `---------------------------------------------------------' `---------------' @@ -120,5 +121,7 @@ Debug ----- You can use [PJRC HID listen](http://www.pjrc.com/teensy/hid_listen.html) to see debug output. -The converter has some functions for debug, press `Alt+Gui+H` simultaneously to get help. +The converter has some functions for debug, press `<magickey>+H` simultaneously to get help. These function is totally undocumented, tentative, inconsistent and buggy. + +magickey: Shift+Option+Command(Shift+Alt+Gui or Shift+Alt+Control) diff --git a/converter/m0110_usb/config.h b/converter/m0110_usb/config.h index d2e904077f..be00259e6b 100644 --- a/converter/m0110_usb/config.h +++ b/converter/m0110_usb/config.h @@ -36,9 +36,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* Locking Caps Lock support */ //#define MATRIX_HAS_LOCKING_CAPS -/* key combination for command */ +/* magic key */ #define IS_COMMAND() ( \ - keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_LGUI)) \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LGUI)) || \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LCTL)) \ ) diff --git a/converter/m0110_usb/keymap.c b/converter/m0110_usb/keymap.c index 4dd419d1b9..191bf3a156 100644 --- a/converter/m0110_usb/keymap.c +++ b/converter/m0110_usb/keymap.c @@ -27,8 +27,65 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "keymap.h" -#define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)])) +/* + * The keymap works with both M0110 and M0110A keyboards. As you can see, the M0110A is a superset + * of the M0110 keyboard, with only one exception: 'Enter' in M0110 does not exist + * on the M0110A, but since it generates a unique scan code which is not used for some other key in + * the M0110A, they are totally interchangeable. In fact, the M0110A is functionally (almost) + * identical to the combination of the M0110 along with the M0120 keypad. The only difference + * (which is causing some problems as you will read below) is that the M0110+M0120 don't have + * dedicated arrow keys, while the M0110A does. However, the M0120 did have arrow keys, which + * doubled as the [comma], [/], [*] and [+] keys, when used with the [Shift] key. The M0110A has + * substituted the [comma] key with the [=] key, however its scancode is the same. + * + * Physical layout: + * M0110A + * ,---------------------------------------------------------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Bcksp| |Clr| =| /| *| + * |---------------------------------------------------------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| + * |-----------------------------------------------------' | |---------------| + * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +| + * |---------------------------------------------------------| |---------------| + * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| | + * |---------------------------------------------------------' |-----------|Ent| + * |Opt |Mac | Space | \|Lft|Rgt|Dn | | 0| .| | + * `---------------------------------------------------------' `---------------' + * + * M0110 M0120 + * ,---------------------------------------------------------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| -| +| *| + * |---------------------------------------------------------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| /| + * |---------------------------------------------------------| |---------------| + * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| ,| + * |---------------------------------------------------------| |---------------| + * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| | + * `---------------------------------------------------------' |-----------|Ent| + * |Opt|Mac | Space |Ent |Opt| | 0| .| | + * `-----------------------------------------------' `---------------' + * With Shift keys on M0120 work as curosor.(-:Left *:Right /:Up ,:Down) + * + * NOTE: \ is located differently. + * NOTE: Enter on M0110 is different from Enter on keypad(M0120 and M0110A). + * NOTE: Left Shift and right Shift are logically same key. + * NOTE: Left Option and right Option are logically same key. + */ +/* Keymap definition Macro + * ,---------------------------------------------------------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| =| /| *| + * |---------------------------------------------------------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| + * |-----------------------------------------------------' | |---------------| + * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +| + * |---------------------------------------------------------| |---------------| + * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| | + * |---------------------------------------------------------| |-----------|Ent| + * |Opt |Mac | Space |Ent| \|Lft|Rgt|Dn | | 0| .| | + * `---------------------------------------------------------' `---------------' + * NOTE: Ent between Space and \ means Enter on M0110. + */ #define KEYMAP( \ K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K68,K6D,K62, \ K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E, K59,K5B,K5C,K4E, \ @@ -52,10 +109,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. { KC_##K68, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K6D, KC_NO, KC_NO }, \ } +#define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)])) + // Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. static const uint8_t PROGMEM fn_layer[] = { -#ifndef HASU 1, // Fn0 0, // Fn1 0, // Fn2 @@ -64,22 +122,11 @@ static const uint8_t PROGMEM fn_layer[] = { 0, // Fn5 0, // Fn6 0 // Fn7 -#else - 1, // Fn0 - 2, // Fn1 - 3, // Fn2 - 1, // Fn3 - 2, // Fn4 - 0, // Fn5 - 0, // Fn6 - 0 // Fn7 -#endif }; // Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer. // See layer.c for details. static const uint8_t PROGMEM fn_keycode[] = { -#ifndef HASU KC_NO, // Fn0 KC_NO, // Fn1 KC_NO, // Fn2 @@ -88,33 +135,12 @@ static const uint8_t PROGMEM fn_keycode[] = { KC_NO, // Fn5 KC_NO, // Fn6 KC_NO // Fn7 -#else - KC_ENTER, // Fn0 - KC_SCOLON, // Fn1 - KC_SLASH, // Fn2 - KC_UP, // Fn3 - KC_NO, // Fn4 - KC_NO, // Fn5 - KC_NO, // Fn6 - KC_NO // Fn7 -#endif }; static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* - * The keymap works with both M0110 and M0110A keyboards. As you can see, the M0110A is a superset - * of the M0110 keyboard, with only one exception: 'Enter' in M0110 does not exist - * on the M0110A, but since it generates a unique scan code which is not used for some other key in - * the M0110A, they are totally interchangeable. In fact, the M0110A is functionally (almost) - * identical to the combination of the M0110 along with the M0120 keypad. The only difference - * (which is causing some problems as you will read below) is that the M0110+M0120 don't have - * dedicated arrow keys, while the M0110A does. However, the M |