1
0

Merge branch 'm0110_next'

This commit is contained in:
tmk 2013-09-21 21:35:13 +09:00
commit 6ccea742de
7 changed files with 119 additions and 127 deletions

View File

@ -71,7 +71,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
# Build Options # Build Options
# *Comment out* to disable the options. # *Comment out* to disable the options.
# #
#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700) MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450) EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = yes # Console for debug(+400) CONSOLE_ENABLE = yes # Console for debug(+400)

View File

@ -1,10 +1,12 @@
M0110/M0110A to USB keyboard converter M0110/M0110A to USB keyboard converter
====================================== ======================================
This firmware converts the protocol of Apple Macintosh keyboard M0110/M0110A into USB. This 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.
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`. Pics of **M0110 + M0120** and **M0110A**.
![M0110+M0120](http://i.imgur.com/dyvXb2Tm.jpg)
![M0110A](http://i.imgur.com/HuHOEoHm.jpg)
![M0110](https://raw.github.com/tmk/tmk_keyboard/master/converter/m0110_usb/doc/m0110.jpg)
- 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. - 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`.
Update Update
------ ------
- 2013/08 Change port for signals PF to PD - 2013/08: Change port for signals `PF` to `PD`
- 2013/09: Change port again, it uses inversely `PD0` for data and `PD1` for clock line now.
Connection Building Hardware
---------- -----------------
You need 4P4C plug and cable to connect Teensy or other AVR dev board into the keyboard. You 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`.
Teensy port `PD0` is assigned for `CLOCK` line and `PD1` for `DATA` by default,
you can change pin configuration with editing *config.h*.
You can find 4P4C plugs on telephone handset cable. Note that it is *crossover* connection [![M0110 Converter](http://i.imgur.com/4G2ZOegm.jpg)](http://i.imgur.com/4G2ZOeg.jpg)
while Macintosh keyboard cable is *straight*.
[![Conection](https://raw.github.com/tmk/tmk_keyboard/master/converter/m0110_usb/doc/teensy.jpg)] ### 4P4C phone handset cable
Note that original cable used with Mac is **straight** while phone handset cable is **crossover**.
In this pic: <http://en.wikipedia.org/wiki/Modular_connector#4P4C>
1. `GND`(Black) Close-up pic of handset cable. You can see one end of plug has reverse color codes against the other. Click to enlarge.
2. `CLOCK`(Red) [![4P4C cable](http://i.imgur.com/3S9P1mYm.jpg?1)](http://i.imgur.com/3S9P1mY.jpg?1)
3. `DATA`(Green)
4. `+5V`(Yellow)
Note that wire colors may vary in your cable. [Teensy]: http://www.pjrc.com/teensy/
### Pinout ### Socket Pinout
- <http://pinouts.ru/Inputs/MacKeyboard_pinout.shtml> - <http://pinouts.ru/Inputs/MacKeyboard_pinout.shtml>
- <http://en.wikipedia.org/wiki/Modular_connector#4P4C>
![Jack fig](http://www.kbdbabel.org/conn/kbd_connector_macplus.png) ![Jack fig](http://www.kbdbabel.org/conn/kbd_connector_macplus.png)
### Pull-up Registor ### Pull-up Registor
You may need pull-up registors on signal lines(`CLOCK`, `DATA`) in particular You 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.
when you have long or coiled cable. 1k-10k Ohm will be OK for this purpose.
In some cases MCU can't read signal from keyboard correctly without pull-up resistors.
Building Frimware Building Frimware
----------------- -----------------
To compile firmware you need AVR GCC. You can use [WinAVR](http://winavr.sourceforge.net/) on Windows. To compile firmware you need AVR GCC. You can edit *Makefile* and *config.h* to change compile options and pin configuration.
You can edit *Makefile* and *config.h* to change compile options and pin configuration.
$ git clone git://github.com/tmk/tmk_keyboard.git (or download source) $ git clone git://github.com/tmk/tmk_keyboard.git (or download source)
$ cd m0110_usb $ cd m0110_usb
@ -71,64 +66,69 @@ Keymap
You can change keymaps by editing *keymap.c*. You can change keymaps by editing *keymap.c*.
### M0110 & M0120 ### M0110 & M0120
#### *Default* #### *Default Layer*
,---------------------------------------------------------. ,---------------. ,---------------------------------------------------------. ,---------------.
| `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Ctl| -|Lft|Rgt| | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| -|Lft|Rgt|
|---------------------------------------------------------| |---------------| |---------------------------------------------------------| |---------------|
|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| Up| |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| |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | | 4| 5| 6| Dn|
|---------------------------------------------------------| |---------------| |---------------------------------------------------------| |---------------|
|Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| | |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| |
`---------------------------------------------------------' |-----------|Ent| `---------------------------------------------------------' |-----------|Ent|
|Ctl|Alt | Space |Gui |Ctl| | 0| .| | |Ctl|Gui | Space |Alt |Ctl| | 0| .| |
`-----------------------------------------------' `---------------' `-----------------------------------------------' `---------------'
#### *HHKB/WASD Layer(WASD/IJKL)*
- `Space` and `Enter` also work as `Fn` layer switch key when holding down.
#### *Function Layer(WASD/HHKB)*
,---------------------------------------------------------. ,---------------. ,---------------------------------------------------------. ,---------------.
|Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| -|Lft|Rgt| |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| |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |Ins| \| | 7| 8| 9| Up|
|---------------------------------------------------------| |---------------| |---------------------------------------------------------| |---------------|
|Fn0 |Lef|Dow|Rig| | | |Lef|Dow|Rig| | |Return| | 4| 5| 6| Dn| |Caps |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Enter | | 4| 5| 6| Dn|
|---------------------------------------------------------| |---------------| |---------------------------------------------------------| |---------------|
|Shift |End| |PgD| | | |PgD| |End| |Shift | | 1| 2| 3| | |Shift |End| |PgD| | | | |End|PgD|Dow|Shift | | 1| 2| 3| |
`---------------------------------------------------------' |-----------|Ent| `---------------------------------------------------------' |-----------|Ent|
|Ctl|Alt | Space |Gui |Ctl| | 0| .| | |Ctl|Gui | Space |Alt |Ctl| | 0| .| |
`-----------------------------------------------' `---------------' `-----------------------------------------------' `---------------'
### M0110A ### M0110A
#### *Default* #### *Default Layer*
,---------------------------------------------------------. ,---------------. ,---------------------------------------------------------. ,---------------.
| `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Ctl| =| /| *| | `| 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| -| |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| +| |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | | 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| |---------------------------------------------------------| |-----------|Ent|
|Alt |Gui | Space | \|Lft|Rgt| Dn| | 0| .| | |Ctrl |Gui | Space | \|Lft|Rgt|Dwn| | 0| .| |
`---------------------------------------------------------' `---------------' `---------------------------------------------------------' `---------------'
#### *Cursor Layer(WASD/IJKL)*
- `Space` and `Enter` also work as `Fn` layer switch key when holding down.
- `Backslash(\)` also works as `Alt` when holding down.
#### *Function Layer(WASD/HHKB)*
,---------------------------------------------------------. ,---------------. ,---------------------------------------------------------. ,---------------.
|Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *| |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *|
|---------------------------------------------------------| |---------------| |---------------------------------------------------------| |---------------|
|Caps |Hom| Up|PgU| | | |PgU| Up|Hom|Psc|Slk|Pau| | | 7| 8| 9| -| |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |Ins| | | 7| 8| 9| -|
|-----------------------------------------------------' | |---------------| |-----------------------------------------------------' | |---------------|
|Fn0 |Lef|Dow|Rig| | | |Lef|Dow|Rig| | |Return| | 4| 5| 6| +| |Caps |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Enter | | 4| 5| 6| +|
|---------------------------------------------------------| |---------------| |---------------------------------------------------------| |---------------|
|Shift |End| |PgD| | | |PgD| |End| |Shif|PgU| | 1| 2| 3| | |Shift |End| |PgD| | | | |End|PgD|Dow|Shif|PgU| | 1| 2| 3| |
|---------------------------------------------------------| |-----------|Ent| |---------------------------------------------------------| |-----------|Ent|
|Alt |Gui | Space |Ins|Hom|End|PgD| | 0| .| | |Ctrl |Gui | Space | \|Hom|End|PgD| | 0| .| |
`---------------------------------------------------------' `---------------' `---------------------------------------------------------' `---------------'
Debug Debug
----- -----
You can use [PJRC HID listen](http://www.pjrc.com/teensy/hid_listen.html) to see debug output. 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 `<Command>+H` simultaneously to get help.
The converter has some functions for debug, press `<magickey>+H` simultaneously to get help. - Command: `Shift+Option+Command`(`Shift+Alt+Gui` or `Shift+Alt+Control`)
These function is totally undocumented, tentative, inconsistent and buggy.
magickey: Shift+Option+Command(Shift+Alt+Gui or Shift+Alt+Control)

View File

@ -32,10 +32,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_COLS 8 #define MATRIX_COLS 8
/* legacy keymap support */
#define USE_LEGACY_KEYMAP
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE #define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */ /* Locking resynchronize hack */
@ -48,15 +44,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LCTL)) \ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LCTL)) \
) )
/* boot magic key */
#define BOOTMAGIC_KEY_SALT KC_FN0
#define BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL KC_LCAP
/* ports */ /* ports */
#define M0110_CLOCK_PORT PORTD #define M0110_CLOCK_PORT PORTD
#define M0110_CLOCK_PIN PIND #define M0110_CLOCK_PIN PIND
#define M0110_CLOCK_DDR DDRD #define M0110_CLOCK_DDR DDRD
#define M0110_CLOCK_BIT 0 #define M0110_CLOCK_BIT 1
#define M0110_DATA_PORT PORTD #define M0110_DATA_PORT PORTD
#define M0110_DATA_PIN PIND #define M0110_DATA_PIN PIND
#define M0110_DATA_DDR DDRD #define M0110_DATA_DDR DDRD
#define M0110_DATA_BIT 1 #define M0110_DATA_BIT 0
#endif #endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

View File

@ -44,7 +44,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* |---------------------------------------------------------| |---------------| * |---------------------------------------------------------| |---------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| * |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| +| * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | | 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| * |---------------------------------------------------------' |-----------|Ent|
@ -57,7 +57,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* |---------------------------------------------------------| |---------------| * |---------------------------------------------------------| |---------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| /| * |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| ,| * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | | 4| 5| 6| ,|
* |---------------------------------------------------------| |---------------| * |---------------------------------------------------------| |---------------|
* |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| | * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| |
* `---------------------------------------------------------' |-----------|Ent| * `---------------------------------------------------------' |-----------|Ent|
@ -77,7 +77,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* |---------------------------------------------------------| |---------------| * |---------------------------------------------------------| |---------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| * |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| +| * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | | 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| * |---------------------------------------------------------| |-----------|Ent|
@ -108,89 +108,79 @@ 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 }, \ { 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)])) #ifdef KEYMAP_SECTION_ENABLE
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
#else
// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. static const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
static const uint8_t PROGMEM fn_layer[] = { #endif
1, // Fn0
0, // Fn1
0, // Fn2
0, // Fn3
0, // Fn4
0, // Fn5
0, // Fn6
0 // Fn7
};
// 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[] = {
KC_NO, // Fn0
KC_NO, // Fn1
KC_NO, // Fn2
KC_NO, // Fn3
KC_NO, // Fn4
KC_NO, // Fn5
KC_NO, // Fn6
KC_NO // Fn7
};
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Default: /* Default:
* ,---------------------------------------------------------. ,---------------. * ,---------------------------------------------------------. ,---------------.
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Ctl| =| /| *| * | `| 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| -| * |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| +| * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | | 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| * |---------------------------------------------------------| |-----------|Ent|
* |Ctl |Alt | Space |Gui| \|Lft|Rgt|Dn | | 0| .| | * |Ctl |Gui | Space |Alt| \|Lft|Rgt|Dn | | 0| .| |
* `---------------------------------------------------------' `---------------' * `---------------------------------------------------------' `---------------'
*/ */
KEYMAP( KEYMAP(
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, LCTL,EQL, PSLS,PAST, GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, CLR, EQL, PSLS,PAST,
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS,
FN0, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, FN1, P4, P5, P6, PPLS,
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, UP, P1, P2, P3, PENT, LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, UP, P1, P2, P3, PENT,
LCTL,LALT, SPC, LGUI,BSLS,LEFT,RGHT,DOWN, P0, PDOT LCTL,LGUI, FN0, LALT,FN2, LEFT,RGHT,DOWN, P0, PDOT
), ),
/* Cursor Layer(WASD, IJKL) /* Cursor Layer(WASD, IJKL)
* ,---------------------------------------------------------. ,---------------. * ,---------------------------------------------------------. ,---------------.
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *| * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *|
* |---------------------------------------------------------| |---------------| * |---------------------------------------------------------| |---------------|
* |Caps |Hom| Up|PgU| | | |PgU| Up|Hom|Psc|Slk|Pau| | | 7| 8| 9| -| * |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |Ins| | | 7| 8| 9| -|
* |-----------------------------------------------------' | |---------------| * |-----------------------------------------------------' | |---------------|
* |Fn0 |Lef|Dow|Rig| | | |Lef|Dow|Rig| | |Return| | 4| 5| 6| +| * |Caps |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Enter | | 4| 5| 6| +|
* |---------------------------------------------------------| |---------------| * |---------------------------------------------------------| |---------------|
* |Shift |End| |PgD| | | |PgD| |End| |Shif|PgU| | 1| 2| 3| | * |Shift |End| |PgD| | | | |End|PgD|Dow|Shif|PgU| | 1| 2| 3| |
* |---------------------------------------------------------| |-----------|Ent| * |---------------------------------------------------------| |-----------|Ent|
* |Ctl |Alt | Space |Gui |Ins|Hom|End|PgD| | 0| .| | * |Ctl |Gui | Space |Alt | \|Hom|End|PgD| | 0| .| |
* `---------------------------------------------------------' `---------------' * `---------------------------------------------------------' `---------------'
*/ */
KEYMAP( KEYMAP(
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST, ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
CAPS,HOME,UP, PGUP,NO, NO, NO, PGUP,UP, HOME,PSCR,SLCK,PAUS, P7, P8, P9, PMNS, CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, INS, P7, P8, P9, PMNS,
FN0, LEFT,DOWN,RGHT,NO, NO, NO, LEFT,DOWN,RGHT,NO, NO, ENT, P4, P5, P6, PPLS, LCAP,LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, FN1, P4, P5, P6, PPLS,
LSFT,END, NO, PGDN,NO, NO, NO, PGDN,NO, END, NO, PGUP, P1, P2, P3, PENT, LSFT,END, NO, PGDN,NO, NO, NO, NO, END, PGDN,DOWN, PGUP, P1, P2, P3, PENT,
LCTL,LALT, SPC, LGUI,INS, HOME,END, PGDN, P0, PDOT LCTL,LGUI, FN0, LALT,FN2, HOME,END, PGDN, P0, PDOT
), ),
}; };
uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col) /*
* Fn action definition
*/
#ifdef KEYMAP_SECTION_ENABLE
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
#else
static const uint16_t fn_actions[] PROGMEM = {
#endif
[0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), // Layer switch with Tap key Space
[1] = ACTION_LAYER_TAP_KEY(1, KC_ENTER), // Layer switch with Tap key Enter
[2] = ACTION_MODS_TAP_KEY(MOD_LALT, KC_BSLS), // LALT with Tap key Backslash
};
/* translates key to keycode */
uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
{ {
return KEYCODE(layer, row, col); return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
} }
uint8_t keymap_fn_layer(uint8_t index) /* translates Fn index to action */
action_t keymap_fn_to_action(uint8_t keycode)
{ {
return pgm_read_byte(&fn_layer[index]); action_t action;
} action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
return action;
uint8_t keymap_fn_keycode(uint8_t index)
{
return pgm_read_byte(&fn_keycode[index]);
} }

View File

@ -91,10 +91,11 @@ uint8_t m0110_error = 0;
void m0110_init(void) void m0110_init(void)
{ {
uint8_t data;
idle(); idle();
_delay_ms(1000); _delay_ms(1000);
/* Not needed to initialize in fact.
uint8_t data;
m0110_send(M0110_MODEL); m0110_send(M0110_MODEL);
data = m0110_recv(); data = m0110_recv();
print("m0110_init model: "); phex(data); print("\n"); print("m0110_init model: "); phex(data); print("\n");
@ -102,6 +103,7 @@ void m0110_init(void)
m0110_send(M0110_TEST); m0110_send(M0110_TEST);
data = m0110_recv(); data = m0110_recv();
print("m0110_init test: "); phex(data); print("\n"); print("m0110_init test: "); phex(data); print("\n");
*/
} }
uint8_t m0110_send(uint8_t data) uint8_t m0110_send(uint8_t data)