aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--converter/m0110_usb/Makefile2
-rw-r--r--converter/m0110_usb/README.md128
-rw-r--r--converter/m0110_usb/config.h12
-rw-r--r--converter/m0110_usb/doc/m0110.jpgbin49360 -> 0 bytes
-rw-r--r--converter/m0110_usb/doc/teensy.jpgbin50081 -> 0 bytes
-rw-r--r--converter/m0110_usb/keymap.c98
-rw-r--r--protocol/m0110.c4
7 files changed, 118 insertions, 126 deletions
diff --git a/converter/m0110_usb/Makefile b/converter/m0110_usb/Makefile
index 66eae880f..f1c51e1bb 100644
--- a/converter/m0110_usb/Makefile
+++ b/converter/m0110_usb/Makefile
@@ -71,7 +71,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
71# Build Options 71# Build Options
72# *Comment out* to disable the options. 72# *Comment out* to disable the options.
73# 73#
74#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) 74BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
75MOUSEKEY_ENABLE = yes # Mouse keys(+4700) 75MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
76EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 76EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
77CONSOLE_ENABLE = yes # Console for debug(+400) 77CONSOLE_ENABLE = yes # Console for debug(+400)
diff --git a/converter/m0110_usb/README.md b/converter/m0110_usb/README.md
index bd8bef9f2..b3fb8f7e9 100644
--- a/converter/m0110_usb/README.md
+++ b/converter/m0110_usb/README.md
@@ -1,10 +1,12 @@
1M0110/M0110A to USB keyboard converter 1M0110/M0110A to USB keyboard converter
2====================================== 2======================================
3This firmware converts the protocol of Apple Macintosh keyboard M0110/M0110A into USB. 3This firmware converts the protocol of Apple Macintosh keyboard **M0110**, **M0110A** and **M0120** into USB. Target of this project is USB AVR controller **ATmega32U4**. Using this converter you can revive these retro keyboards with modern computer.
4Target board of this project is [PJRC Teensy](http://www.pjrc.com/teensy/), though, 4
5you can use other board with USB AVR like `ATmega32U4` and `AT90USB`. 5Pics of **M0110 + M0120** and **M0110A**.
6
7![M0110+M0120](http://i.imgur.com/dyvXb2Tm.jpg)
8![M0110A](http://i.imgur.com/HuHOEoHm.jpg)
6 9
7![M0110](https://raw.github.com/tmk/tmk_keyboard/master/converter/m0110_usb/doc/m0110.jpg)
8 10
9- M0110A support was contributed by [skagon@github](https://github.com/skagon). 11- M0110A support was contributed by [skagon@github](https://github.com/skagon).
10- M0120 also is supported. keys(+ * / and ,) on M0120 are recognized as cursor keys. 12- M0120 also is supported. keys(+ * / and ,) on M0120 are recognized as cursor keys.
@@ -13,49 +15,42 @@ you can use other board with USB AVR like `ATmega32U4` and `AT90USB`.
13 15
14Update 16Update
15------ 17------
16- 2013/08 Change port for signals PF to PD 18- 2013/08: Change port for signals `PF` to `PD`
19- 2013/09: Change port again, it uses inversely `PD0` for data and `PD1` for clock line now.
17 20
18 21
19 22
20Connection 23Building Hardware
21---------- 24-----------------
22You need 4P4C plug and cable to connect Teensy or other AVR dev board into the keyboard. 25You need **4P4C** cable and **ATMega32U4** board like PJRC [Teensy]. Port of the MCU `PD1` is assigned to `CLOCK` line and `PD0` to `DATA` by default, you can change pin configuration with editing `config.h`.
23Teensy port `PD0` is assigned for `CLOCK` line and `PD1` for `DATA` by default,
24you can change pin configuration with editing *config.h*.
25 26
26You can find 4P4C plugs on telephone handset cable. Note that it is *crossover* connection 27[![M0110 Converter](http://i.imgur.com/4G2ZOegm.jpg)](http://i.imgur.com/4G2ZOeg.jpg)
27while Macintosh keyboard cable is *straight*.
28 28
29[![Conection](https://raw.github.com/tmk/tmk_keyboard/master/converter/m0110_usb/doc/teensy.jpg)] 29### 4P4C phone handset cable
30Note that original cable used with Mac is **straight** while phone handset cable is **crossover**.
30 31
31In this pic: 32<http://en.wikipedia.org/wiki/Modular_connector#4P4C>
32 33
331. `GND`(Black) 34Close-up pic of handset cable. You can see one end of plug has reverse color codes against the other. Click to enlarge.
342. `CLOCK`(Red) 35[![4P4C cable](http://i.imgur.com/3S9P1mYm.jpg?1)](http://i.imgur.com/3S9P1mY.jpg?1)
353. `DATA`(Green)
364. `+5V`(Yellow)
37 36
38Note that wire colors may vary in your cable. 37[Teensy]: http://www.pjrc.com/teensy/
39 38
40 39
41### Pinout 40### Socket Pinout
42- <http://pinouts.ru/Inputs/MacKeyboard_pinout.shtml> 41- <http://pinouts.ru/Inputs/MacKeyboard_pinout.shtml>
43- <http://en.wikipedia.org/wiki/Modular_connector#4P4C>
44 42
45![Jack fig](http://www.kbdbabel.org/conn/kbd_connector_macplus.png) 43![Jack fig](http://www.kbdbabel.org/conn/kbd_connector_macplus.png)
46 44
47 45
48### Pull-up Registor 46### Pull-up Registor
49You may need pull-up registors on signal lines(`CLOCK`, `DATA`) in particular 47You may need pull-up registors on signal lines(`CLOCK`, `DATA`) in particular when you have long or coiled cable. **1k-10k Ohm** will be OK for this purpose. In that case the converter may not read signal from keyboard correctly without pull-up resistors.
50when you have long or coiled cable. 1k-10k Ohm will be OK for this purpose.
51In some cases MCU can't read signal from keyboard correctly without pull-up resistors.
52 48
53 49
54 50
55Building Frimware 51Building Frimware
56----------------- 52-----------------
57To compile firmware you need AVR GCC. You can use [WinAVR](http://winavr.sourceforge.net/) on Windows. 53To compile firmware you need AVR GCC. You can edit *Makefile* and *config.h* to change compile options and pin configuration.
58You can edit *Makefile* and *config.h* to change compile options and pin configuration.
59 54
60 $ git clone git://github.com/tmk/tmk_keyboard.git (or download source) 55 $ git clone git://github.com/tmk/tmk_keyboard.git (or download source)
61 $ cd m0110_usb 56 $ cd m0110_usb
@@ -71,64 +66,69 @@ Keymap
71You can change keymaps by editing *keymap.c*. 66You can change keymaps by editing *keymap.c*.
72 67
73### M0110 & M0120 68### M0110 & M0120
74#### *Default* 69#### *Default Layer*
75 ,---------------------------------------------------------. ,---------------. 70 ,---------------------------------------------------------. ,---------------.
76 | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Ctl| -|Lft|Rgt| 71 | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| -|Lft|Rgt|
77 |---------------------------------------------------------| |---------------| 72 |---------------------------------------------------------| |---------------|
78 |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| Up| 73 |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| Up|
79 |---------------------------------------------------------| |---------------| 74 |---------------------------------------------------------| |---------------|
80 |Fn0 | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| Dn| 75 |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | | 4| 5| 6| Dn|
81 |---------------------------------------------------------| |---------------| 76 |---------------------------------------------------------| |---------------|
82 |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| | 77 |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| |
83 `---------------------------------------------------------' |-----------|Ent| 78 `---------------------------------------------------------' |-----------|Ent|
84 |Ctl|Alt | Space |Gui |Ctl| | 0| .| | 79 |Ctl|Gui | Space |Alt |Ctl| | 0| .| |
85 `-----------------------------------------------' `---------------' 80 `-----------------------------------------------' `---------------'
86#### *HHKB/WASD Layer(WASD/IJKL)* 81
87 ,---------------------------------------------------------. ,---------------. 82- `Space` and `Enter` also work as `Fn` layer switch key when holding down.
88 |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| -|Lft|Rgt| 83
89 |---------------------------------------------------------| |---------------| 84#### *Function Layer(WASD/HHKB)*
90 |Caps |Hom| Up|PgU| | | |PgU| Up|Hom|Psc|Slk|Pau|Ins| | 7| 8| 9| Up| 85 ,---------------------------------------------------------. ,---------------.
91 |---------------------------------------------------------| |---------------| 86 |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| -|Lft|Rgt|
92 |Fn0 |Lef|Dow|Rig| | | |Lef|Dow|Rig| | |Return| | 4| 5| 6| Dn| 87 |---------------------------------------------------------| |---------------|
93 |---------------------------------------------------------| |---------------| 88 |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |Ins| \| | 7| 8| 9| Up|
94 |Shift |End| |PgD| | | |PgD| |End| |Shift | | 1| 2| 3| | 89 |---------------------------------------------------------| |---------------|
95 `---------------------------------------------------------' |-----------|Ent| 90 |Caps |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Enter | | 4| 5| 6| Dn|
96 |Ctl|Alt | Space |Gui |Ctl| | 0| .| | 91 |---------------------------------------------------------| |---------------|
97 `-----------------------------------------------' `---------------' 92 |Shift |End| |PgD| | | | |End|PgD|Dow|Shift | | 1| 2| 3| |
93 `---------------------------------------------------------' |-----------|Ent|
94 |Ctl|Gui | Space |Alt |Ctl| | 0| .| |
95 `-----------------------------------------------' `---------------'
96
98 97
99### M0110A 98### M0110A
100#### *Default* 99#### *Default Layer*
101 ,---------------------------------------------------------. ,---------------. 100 ,---------------------------------------------------------. ,---------------.
102 | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Ctl| =| /| *| 101 | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| =| /| *|
103 |---------------------------------------------------------| |---------------| 102 |---------------------------------------------------------| |---------------|
104 |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| 103 |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -|
105 |-----------------------------------------------------' | |---------------| 104 |-----------------------------------------------------' | |---------------|
106 |Fn0 | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +| 105 |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | | 4| 5| 6| +|
107 |---------------------------------------------------------| |---------------| 106 |---------------------------------------------------------| |---------------|
108 |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft| Up| | 1| 2| 3| | 107 |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft| Up| | 1| 2| 3| |
109 |---------------------------------------------------------| |-----------|Ent| 108 |---------------------------------------------------------| |-----------|Ent|
110 |Alt |Gui | Space | \|Lft|Rgt| Dn| | 0| .| | 109 |Ctrl |Gui | Space | \|Lft|Rgt|Dwn| | 0| .| |
111 `---------------------------------------------------------' `---------------' 110 `---------------------------------------------------------' `---------------'
112#### *Cursor Layer(WASD/IJKL)* 111
112- `Space` and `Enter` also work as `Fn` layer switch key when holding down.
113- `Backslash(\)` also works as `Alt` when holding down.
114
115#### *Function Layer(WASD/HHKB)*
113 ,---------------------------------------------------------. ,---------------. 116 ,---------------------------------------------------------. ,---------------.
114 |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *| 117 |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *|
115 |---------------------------------------------------------| |---------------| 118 |---------------------------------------------------------| |---------------|
116 |Caps |Hom| Up|PgU| | | |PgU| Up|Hom|Psc|Slk|Pau| | | 7| 8| 9| -| 119 |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |Ins| | | 7| 8| 9| -|
117 |-----------------------------------------------------' | |---------------| 120 |-----------------------------------------------------' | |---------------|
118 |Fn0 |Lef|Dow|Rig| | | |Lef|Dow|Rig| | |Return| | 4| 5| 6| +| 121 |Caps |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Enter | | 4| 5| 6| +|
119 |---------------------------------------------------------| |---------------| 122 |---------------------------------------------------------| |---------------|
120 |Shift |End| |PgD| | | |PgD| |End| |Shif|PgU| | 1| 2| 3| | 123 |Shift |End| |PgD| | | | |End|PgD|Dow|Shif|PgU| | 1| 2| 3| |
121 |---------------------------------------------------------| |-----------|Ent| 124 |---------------------------------------------------------| |-----------|Ent|
122 |Alt |Gui | Space |Ins|Hom|End|PgD| | 0| .| | 125 |Ctrl |Gui | Space | \|Hom|End|PgD| | 0| .| |
123 `---------------------------------------------------------' `---------------' 126 `---------------------------------------------------------' `---------------'
124 127
125 128
126 129
127Debug 130Debug
128----- 131-----
129You can use [PJRC HID listen](http://www.pjrc.com/teensy/hid_listen.html) to see debug output. 132You 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 `<Command>+H` simultaneously to get help.
130
131The converter has some functions for debug, press `<magickey>+H` simultaneously to get help.
132These function is totally undocumented, tentative, inconsistent and buggy.
133 133
134magickey: Shift+Option+Command(Shift+Alt+Gui or Shift+Alt+Control) 134- Command: `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 2f63a3a49..801bc4ebf 100644
--- a/converter/m0110_usb/config.h
+++ b/converter/m0110_usb/config.h
@@ -32,10 +32,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
32#define MATRIX_COLS 8 32#define MATRIX_COLS 8
33 33
34 34
35/* legacy keymap support */
36#define USE_LEGACY_KEYMAP
37
38
39/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ 35/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
40#define LOCKING_SUPPORT_ENABLE 36#define LOCKING_SUPPORT_ENABLE
41/* Locking resynchronize hack */ 37/* Locking resynchronize hack */
@@ -48,15 +44,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
48 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LCTL)) \ 44 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LCTL)) \
49) 45)
50 46
47/* boot magic key */
48#define BOOTMAGIC_KEY_SALT KC_FN0
49#define BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL KC_LCAP
50
51 51
52/* ports */ 52/* ports */
53#define M0110_CLOCK_PORT PORTD 53#define M0110_CLOCK_PORT PORTD
54#define M0110_CLOCK_PIN PIND 54#define M0110_CLOCK_PIN PIND
55#define M0110_CLOCK_DDR DDRD 55#define M0110_CLOCK_DDR DDRD
56#define M0110_CLOCK_BIT 0 56#define M0110_CLOCK_BIT 1
57#define M0110_DATA_PORT PORTD 57#define M0110_DATA_PORT PORTD
58#define M0110_DATA_PIN PIND 58#define M0110_DATA_PIN PIND
59#define M0110_DATA_DDR DDRD 59#define M0110_DATA_DDR DDRD
60#define M0110_DATA_BIT 1 60#define M0110_DATA_BIT 0
61 61
62#endif 62#endif
diff --git a/converter/m0110_usb/doc/m0110.jpg b/converter/m0110_usb/doc/m0110.jpg
deleted file mode 100644
index ef9a123ab..000000000
--- a/converter/m0110_usb/doc/m0110.jpg
+++ /dev/null
Binary files differ
diff --git a/converter/m0110_usb/doc/teensy.jpg b/converter/m0110_usb/doc/teensy.jpg
deleted file mode 100644
index 96e93e7e2..000000000
--- a/converter/m0110_usb/doc/teensy.jpg
+++ /dev/null
Binary files differ
diff --git a/converter/m0110_usb/keymap.c b/converter/m0110_usb/keymap.c
index 7a3bc3585..02c6ef9cd 100644
--- a/converter/m0110_usb/keymap.c
+++ b/converter/m0110_usb/keymap.c
@@ -44,7 +44,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
44 * |---------------------------------------------------------| |---------------| 44 * |---------------------------------------------------------| |---------------|
45 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| 45 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -|
46 * |-----------------------------------------------------' | |---------------| 46 * |-----------------------------------------------------' | |---------------|
47 * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +| 47 * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | | 4| 5| 6| +|
48 * |---------------------------------------------------------| |---------------| 48 * |---------------------------------------------------------| |---------------|
49 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| | 49 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| |
50 * |---------------------------------------------------------' |-----------|Ent| 50 * |---------------------------------------------------------' |-----------|Ent|
@@ -57,7 +57,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
57 * |---------------------------------------------------------| |---------------| 57 * |---------------------------------------------------------| |---------------|
58 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| /| 58 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| /|
59 * |---------------------------------------------------------| |---------------| 59 * |---------------------------------------------------------| |---------------|
60 * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| ,| 60 * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | | 4| 5| 6| ,|
61 * |---------------------------------------------------------| |---------------| 61 * |---------------------------------------------------------| |---------------|
62 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| | 62 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| |
63 * `---------------------------------------------------------' |-----------|Ent| 63 * `---------------------------------------------------------' |-----------|Ent|
@@ -77,7 +77,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
77 * |---------------------------------------------------------| |---------------| 77 * |---------------------------------------------------------| |---------------|
78 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| 78 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -|
79 * |-----------------------------------------------------' | |---------------| 79 * |-----------------------------------------------------' | |---------------|
80 * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +| 80 * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | | 4| 5| 6| +|
81 * |---------------------------------------------------------| |---------------| 81 * |---------------------------------------------------------| |---------------|
82 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| | 82 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| |
83 * |---------------------------------------------------------| |-----------|Ent| 83 * |---------------------------------------------------------| |-----------|Ent|
@@ -108,89 +108,79 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
108 { KC_##K68, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K6D, KC_NO, KC_NO }, \ 108 { KC_##K68, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K6D, KC_NO, KC_NO }, \
109} 109}
110 110
111#define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)])) 111#ifdef KEYMAP_SECTION_ENABLE
112 112const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
113 113#else
114// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. 114static const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
115static const uint8_t PROGMEM fn_layer[] = { 115#endif
116 1, // Fn0
117 0, // Fn1
118 0, // Fn2
119 0, // Fn3
120 0, // Fn4
121 0, // Fn5
122 0, // Fn6
123 0 // Fn7
124};
125
126// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
127// See layer.c for details.
128static const uint8_t PROGMEM fn_keycode[] = {
129 KC_NO, // Fn0
130 KC_NO, // Fn1
131 KC_NO, // Fn2
132 KC_NO, // Fn3
133 KC_NO, // Fn4
134 KC_NO, // Fn5
135 KC_NO, // Fn6
136 KC_NO // Fn7
137};
138
139static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
140 /* Default: 116 /* Default:
141 * ,---------------------------------------------------------. ,---------------. 117 * ,---------------------------------------------------------. ,---------------.
142 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Ctl| =| /| *| 118 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| =| /| *|
143 * |---------------------------------------------------------| |---------------| 119 * |---------------------------------------------------------| |---------------|
144 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| 120 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -|
145 * |-----------------------------------------------------' | |---------------| 121 * |-----------------------------------------------------' | |---------------|
146 * |Fn0 | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +| 122 * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | | 4| 5| 6| +|
147 * |---------------------------------------------------------| |---------------| 123 * |---------------------------------------------------------| |---------------|
148 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| | 124 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| |
149 * |---------------------------------------------------------| |-----------|Ent| 125 * |---------------------------------------------------------| |-----------|Ent|
150 * |Ctl |Alt | Space |Gui| \|Lft|Rgt|Dn | | 0| .| | 126 * |Ctl |Gui | Space |Alt| \|Lft|Rgt|Dn | | 0| .| |
151 * `---------------------------------------------------------' `---------------' 127 * `---------------------------------------------------------' `---------------'
152 */ 128 */
153 KEYMAP( 129 KEYMAP(
154 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, LCTL,EQL, PSLS,PAST, 130 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, CLR, EQL, PSLS,PAST,
155 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS, 131 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS,
156 FN0, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, 132 LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, FN1, P4, P5, P6, PPLS,
157 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, UP, P1, P2, P3, PENT, 133 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, UP, P1, P2, P3, PENT,
158 LCTL,LALT, SPC, LGUI,BSLS,LEFT,RGHT,DOWN, P0, PDOT 134 LCTL,LGUI, FN0, LALT,FN2, LEFT,RGHT,DOWN, P0, PDOT
159 ), 135 ),
160 /* Cursor Layer(WASD, IJKL) 136 /* Cursor Layer(WASD, IJKL)
161 * ,---------------------------------------------------------. ,---------------. 137 * ,---------------------------------------------------------. ,---------------.
162 * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *| 138 * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *|
163 * |---------------------------------------------------------| |---------------| 139 * |---------------------------------------------------------| |---------------|
164 * |Caps |Hom| Up|PgU| | | |PgU| Up|Hom|Psc|Slk|Pau| | | 7| 8| 9| -| 140 * |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |Ins| | | 7| 8| 9| -|
165 * |-----------------------------------------------------' | |---------------| 141 * |-----------------------------------------------------' | |---------------|
166 * |Fn0 |Lef|Dow|Rig| | | |Lef|Dow|Rig| | |Return| | 4| 5| 6| +| 142 * |Caps |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Enter | | 4| 5| 6| +|
167 * |---------------------------------------------------------| |---------------| 143 * |---------------------------------------------------------| |---------------|
168 * |Shift |End| |PgD| | | |PgD| |End| |Shif|PgU| | 1| 2| 3| | 144 * |Shift |End| |PgD| | | | |End|PgD|Dow|Shif|PgU| | 1| 2| 3| |
169 * |---------------------------------------------------------| |-----------|Ent| 145 * |---------------------------------------------------------| |-----------|Ent|
170 * |Ctl |Alt | Space |Gui |Ins|Hom|End|PgD| | 0| .| | 146 * |Ctl |Gui | Space |Alt | \|Hom|End|PgD| | 0| .| |
171 * `---------------------------------------------------------' `---------------' 147 * `---------------------------------------------------------' `---------------'
172 */ 148 */
173 KEYMAP( 149 KEYMAP(
174 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST, 150 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
175 CAPS,HOME,UP, PGUP,NO, NO, NO, PGUP,UP, HOME,PSCR,SLCK,PAUS, P7, P8, P9, PMNS, 151 CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, INS, P7, P8, P9, PMNS,
176 FN0, LEFT,DOWN,RGHT,NO, NO, NO, LEFT,DOWN,RGHT,NO, NO, ENT, P4, P5, P6, PPLS, 152 LCAP,LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, FN1, P4, P5, P6, PPLS,
177 LSFT,END, NO, PGDN,NO, NO, NO, PGDN,NO, END, NO, PGUP, P1, P2, P3, PENT, 153 LSFT,END, NO, PGDN,NO, NO, NO, NO, END, PGDN,DOWN, PGUP, P1, P2, P3, PENT,
178 LCTL,LALT, SPC, LGUI,INS, HOME,END, PGDN, P0, PDOT 154 LCTL,LGUI, FN0, LALT,FN2, HOME,END, PGDN, P0, PDOT
179 ), 155 ),
180}; 156};
181 157
182 158
183uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col) 159/*
184{ 160 * Fn action definition
185 return KEYCODE(layer, row, col); 161 */
186} 162#ifdef KEYMAP_SECTION_ENABLE
163const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
164#else
165static const uint16_t fn_actions[] PROGMEM = {
166#endif
167 [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), // Layer switch with Tap key Space
168 [1] = ACTION_LAYER_TAP_KEY(1, KC_ENTER), // Layer switch with Tap key Enter
169 [2] = ACTION_MODS_TAP_KEY(MOD_LALT, KC_BSLS), // LALT with Tap key Backslash
170};
171
172
187 173
188uint8_t keymap_fn_layer(uint8_t index) 174/* translates key to keycode */
175uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
189{ 176{
190 return pgm_read_byte(&fn_layer[index]); 177 return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
191} 178}
192 179
193uint8_t keymap_fn_keycode(uint8_t index) 180/* translates Fn index to action */
181action_t keymap_fn_to_action(uint8_t keycode)
194{ 182{
195 return pgm_read_byte(&fn_keycode[index]); 183 action_t action;
184 action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
185 return action;
196} 186}
diff --git a/protocol/m0110.c b/protocol/m0110.c
index 8bf7cfe4f..9b53ec2cd 100644
--- a/protocol/m0110.c
+++ b/protocol/m0110.c
@@ -91,10 +91,11 @@ uint8_t m0110_error = 0;
91 91
92void m0110_init(void) 92void m0110_init(void)
93{ 93{
94 uint8_t data;
95 idle(); 94 idle();
96 _delay_ms(1000); 95 _delay_ms(1000);
97 96
97/* Not needed to initialize in fact.
98 uint8_t data;
98 m0110_send(M0110_MODEL); 99 m0110_send(M0110_MODEL);
99 data = m0110_recv(); 100 data = m0110_recv();
100 print("m0110_init model: "); phex(data); print("\n"); 101 print("m0110_init model: "); phex(data); print("\n");
@@ -102,6 +103,7 @@ void m0110_init(void)
102 m0110_send(M0110_TEST); 103 m0110_send(M0110_TEST);
103 data = m0110_recv(); 104 data = m0110_recv();
104 print("m0110_init test: "); phex(data); print("\n"); 105 print("m0110_init test: "); phex(data); print("\n");
106*/
105} 107}
106 108
107uint8_t m0110_send(uint8_t data) 109uint8_t m0110_send(uint8_t data)