Boot Magic key for gh60

example_keyboards
tmk 12 years ago
parent 8c80deb775
commit b60f9c6ac6

@ -14,6 +14,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdint.h>
#include <util/delay.h>
#include "keyboard.h" #include "keyboard.h"
#include "matrix.h" #include "matrix.h"
#include "keymap.h" #include "keymap.h"
@ -40,8 +42,15 @@ void keyboard_init(void)
timer_init(); timer_init();
matrix_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(); matrix_scan();
#endif
/* boot magic keys */
#ifdef IS_BOOTMAGIC_BOOTLOADER #ifdef IS_BOOTMAGIC_BOOTLOADER
/* kick up bootloader */ /* kick up bootloader */
if (IS_BOOTMAGIC_BOOTLOADER()) bootloader_jump(); if (IS_BOOTMAGIC_BOOTLOADER()) bootloader_jump();

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

@ -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)) \ 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 #endif

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

Loading…
Cancel
Save