Boot Magic key for gh60

This commit is contained in:
tmk 2013-02-11 13:56:05 +09:00
parent 8c80deb775
commit b60f9c6ac6
5 changed files with 98 additions and 64 deletions

View file

@ -14,6 +14,8 @@ 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 <stdint.h>
#include <util/delay.h>
#include "keyboard.h"
#include "matrix.h"
#include "keymap.h"
@ -40,8 +42,15 @@ void keyboard_init(void)
timer_init();
matrix_init();
/* boot magic keys goes here */
/* matrix scan for boot magic keys */
#ifdef DEBOUNCE
uint8_t scan = DEBOUNCE * 2;
while (scan--) { matrix_scan(); _delay_ms(1); }
#else
matrix_scan();
#endif
/* boot magic keys */
#ifdef IS_BOOTMAGIC_BOOTLOADER
/* kick up bootloader */
if (IS_BOOTMAGIC_BOOTLOADER()) bootloader_jump();

View file

@ -10,72 +10,25 @@ DIY compact keyboard designed and run by komar007 and Geekhack community.
## Build
Move to this directory then just run `make` like:
$ make -f Makfile.pjrc
$ make -f Makfile.[pjrc|lufa]
## Boot Magic
- `Fn` key for bootloader kick up.
- `D` key for Debug enable.
## Keymap
Two version of keymap are available. `Plan` and `Funky`.
See keymap.c to define your own favourite keymap.
###Keymap with funky layers.
Layer 0: Default Layer
,-----------------------------------------------------------.
|Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
|-----------------------------------------------------------|
|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
|-----------------------------------------------------------|
|Caps | A| S| D| F| G| H| J| K| L|Fn3| '|Return |
|-----------------------------------------------------------|
|Shift | Z| X| C| V| B| N| M| ,| .|Fn2|Shift |
|-----------------------------------------------------------|
|Ctrl|Gui |Alt | Space |Alt |Gui |App |Fn1 |
`-----------------------------------------------------------'
Layer 1: HHKB mode
,-----------------------------------------------------------.
|Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
|-----------------------------------------------------------|
|Caps | | | | | | | |Psc|Slk|Pus|Up | |Inser|
|-----------------------------------------------------------|
|Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
|-----------------------------------------------------------|
|Shift | | | | | | +| -|End|PgD|Dow|Shift |
|-----------------------------------------------------------|
|Ctrl|Gui |Alt | Space |Alt |Gui |App |xxx |
`-----------------------------------------------------------'
Layer 2: Vi mode
,-----------------------------------------------------------.
| `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Backsp |
|-----------------------------------------------------------|
|Tab |Hom|PgD|Up |PgU|End|Hom|PgD|PgU|End| | | | |
|-----------------------------------------------------------|
|Contro| |Lef|Dow|Rig| |Lef|Dow|Up |Rig| | |Return |
|-----------------------------------------------------------|
|Shift | | | | | |Hom|PgD|PgU|End|xxx|Shift |
|-----------------------------------------------------------|
|Ctrl|Gui |Alt | Space |Alt |Gui |App |Ctrl|
`-----------------------------------------------------------'
Layer 3: Mouse mode
,-----------------------------------------------------------.
| `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Backsp |
|-----------------------------------------------------------|
|Tab |MwL|MwD|McU|MwU|MwR|MwL|MwD|MwU|MwR| | | | |
|-----------------------------------------------------------|
|Contro| |McL|McD|McR| |McL|McD|McU|McR|xxx| |Return |
|-----------------------------------------------------------|
|Shift | | |Mb1|Mb2|Mb3|Mb2|Mb1| | | |Shift |
|-----------------------------------------------------------|
|Ctrl|Gui |Alt | Space |Alt |Gui |xxx |Ctrl|
`-----------------------------------------------------------'
Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
### Plain keymap without Fn layer.
### 1. Plain keymap
This will be useful if you want to use key mapping tool like AHK.
To get this plain keymap run:
To get this plain keymap do `make`:
$ make -f Makefile.pjrc plain
$ make -f Makefile.[pjrc|lufa] plain
### Layer 0
,-----------------------------------------------------------.
|Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
|-----------------------------------------------------------|
@ -87,3 +40,62 @@ To get this plain keymap run:
|-----------------------------------------------------------|
|Ctrl|Gui |Alt | Space |Alt |Gui |App |Ctrl|
`-----------------------------------------------------------'
### 2. Funky layers.
$ make -f Makefile.[pjrc|lufa]
#### Layer 0: Default Layer
,-----------------------------------------------------------.
|Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
|-----------------------------------------------------------|
|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
|-----------------------------------------------------------|
|Caps | A| S| D| F| G| H| J| K| L|*L3| '|Return |
|-----------------------------------------------------------|
|Shift | Z| X| C| V| B| N| M| ,| .|*L2|Shift |
|-----------------------------------------------------------|
|Ctrl|Gui |Alt | Space |Alt |*L3 |*L3 |*L1 |
`-----------------------------------------------------------'
#### Layer 1: HHKB mode
,-----------------------------------------------------------.
|Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
|-----------------------------------------------------------|
|Caps | | | | | | | |Psc|Slk|Pus|Up | |Inser|
|-----------------------------------------------------------|
|Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
|-----------------------------------------------------------|
|Shift | | | | | | +| -|End|PgD|Dow|Shift |
|-----------------------------------------------------------|
|Ctrl|Gui |Alt | Space |Alt |Gui |App |*L0 |
`-----------------------------------------------------------'
#### Layer 2: Vi mode
,-----------------------------------------------------------.
| `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Backsp |
|-----------------------------------------------------------|
|Tab |Hom|PgD|Up |PgU|End|Hom|PgD|PgU|End| | | | |
|-----------------------------------------------------------|
|Contro| |Lef|Dow|Rig| |Lef|Dow|Up |Rig| | |Return |
|-----------------------------------------------------------|
|Shift | | | | | |Hom|PgD|PgU|End|*L0|Shift |
|-----------------------------------------------------------|
|Ctrl|Gui |Alt | Space |Alt |Gui |App |Ctrl|
`-----------------------------------------------------------'
#### Layer 3: Mouse mode
,-----------------------------------------------------------.
| `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Backsp |
|-----------------------------------------------------------|
|Tab |MwL|MwD|McU|MwU|MwR|MwL|MwD|MwU|MwR| | | | |
|-----------------------------------------------------------|
|Contro| |McL|McD|McR| |McL|McD|McU|McR|*L0| |Return |
|-----------------------------------------------------------|
|Shift | | |Mb1|Mb2|Mb3|Mb2|Mb1| | | |Shift |
|-----------------------------------------------------------|
|Ctrl|Gui |Alt | Space |Alt |*L0 |*L0 |Ctrl|
`-----------------------------------------------------------'
Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel

View file

@ -47,4 +47,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/*
* Boot magic keys
* call some function by pressing key when pluging cable or powering on.
*/
/* key position on matrix(ROW:COL) */
#define KEY_FN 0x4A
#define KEY_D 0x23
#define KEY_IS_ON(key) matrix_is_on((key)>>4, (key)&0xF)
/* kick up bootloader */
#define IS_BOOTMAGIC_BOOTLOADER() KEY_IS_ON(KEY_FN)
/* debug on */
#define IS_BOOTMAGIC_DEBUG() KEY_IS_ON(KEY_D)
#endif

View file

@ -131,7 +131,7 @@ uint16_t matrix_get_row(uint8_t row)
void matrix_print(void)
{
print("\nr/c 01234567890ABCDEF\n");
print("\nr/c 0123456789ABCDEF\n");
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
phex(row); print(": ");
pbin_reverse16(matrix_get_row(row));