1
0
Fork 0

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

@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "keymap.h"
/* GH60 keymap definition macro
/* GH60 keymap definition macro
* K2C, K31 and K3C are extra keys for ISO
*/
#define KEYMAP( \
@ -48,7 +48,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, \
K40, K41, K42, K45, K4A, K4B, K4C, K4D \
) KEYMAP( \
) KEYMAP( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO, K2D, \
@ -136,7 +136,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |-----------------------------------------------------------|
* |Ctrl|Gui |Alt | Space |Alt |Gui |App |xxx |
* `-----------------------------------------------------------'
*/
*/
KEYMAP_ANSI(
PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, NO, INS, \
@ -174,7 +174,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |-----------------------------------------------------------|
* |Ctrl|Gui |Alt | Space | |xxx |xxx | |
* `-----------------------------------------------------------'
* Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
* Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
*/
KEYMAP_ANSI(
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, BSPC, \

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));