From 2f80e790c6310ad24a4cb3d4a72c31314364fef7 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 27 Oct 2010 20:51:45 +0900 Subject: new build method for macway --- hhkb/Makefile | 8 +++++++- hhkb/keymap.c | 22 ++++++---------------- hhkb/keymap.h | 2 -- hhkb/matrix.c | 27 ++++----------------------- 4 files changed, 17 insertions(+), 42 deletions(-) (limited to 'hhkb') diff --git a/hhkb/Makefile b/hhkb/Makefile index 1c6eb3db57..7339e70232 100644 --- a/hhkb/Makefile +++ b/hhkb/Makefile @@ -39,7 +39,13 @@ # To rebuild project do "make clean" then "make all". #---------------------------------------------------------------------------- -DESCRIPTION = 't.m.k. firmware for HHKB pro\n' +VENDOR_ID = 0xFEED +PRODUCT_ID = 0xCAFE +MANUFACTURER = 't.m.k.' +PRODUCT = 't.m.k. HHKB pro' +DESCRIPTION = 't.m.k. firmware for HHKB pro' + +MOUSE_DELAY_TIME = 127 # Target file name (without extension). TARGET = tmk_hhkb diff --git a/hhkb/keymap.c b/hhkb/keymap.c index f5386b7223..ca78200c08 100644 --- a/hhkb/keymap.c +++ b/hhkb/keymap.c @@ -1,14 +1,16 @@ /* * Keymap for PFU HHKB Pro */ +#include #include #include #include "usb_keyboard.h" #include "usb_keycodes.h" #include "matrix.h" -#include "keymap.h" #include "print.h" #include "debug.h" +#include "util.h" +#include "keymap.h" #define FN_KEYCODE(fn) (pgm_read_byte(&fn_keycode[(fn)])) @@ -33,9 +35,6 @@ } -static int onbit(uint8_t bits); - - static int current_layer = 0; static bool layer_used = false; @@ -104,7 +103,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |-----------------------------------------------------------| * |Shift | | | | | | | | | | |Shift | | * `-----------------------------------------------------------' - * |Gui|Alt |Sapce |Alt |Gui| + * |Gui|Alt |Space |Alt |Gui| * `-------------------------------------------' */ KEYMAP(KB_ESC, KB_F1, KB_F2, KB_F3, KB_F4, KB_F5, KB_F6, KB_F7, KB_F8, KB_F9, KB_F10, KB_F11, KB_F12, KB_INS, KB_DEL, \ @@ -199,7 +198,7 @@ void keymap_fn_proc(int fn_bits) } else if (fn_bits == 0) { // send key when Fn key is released without using the layer if (!layer_used) { - uint8_t code = FN_KEYCODE(onbit(last_bits)); + uint8_t code = FN_KEYCODE(biton(last_bits)); if (code != KB_NO) { if (IS_MOD(code)) { keyboard_modifier_keys = last_mod | 1<<(code & 0x07); @@ -221,18 +220,9 @@ void keymap_fn_proc(int fn_bits) last_bits = fn_bits; last_mod = keyboard_modifier_keys; layer_used = false; - keymap_set_layer(FN_LAYER(onbit(fn_bits))); + keymap_set_layer(FN_LAYER(biton(fn_bits))); debug("layer: "); phex(current_layer); debug("("); debug_bin(last_bits); debug(")\n"); debug("last_mod: "); debug_hex(last_mod); debug("\n"); } } - -static int onbit(uint8_t bits) -{ - int n = 0; - if (bits >> 4) { bits >>= 4; n += 4;} - if (bits >> 2) { bits >>= 2; n += 2;} - if (bits >> 1) { bits >>= 1; n += 1;} - return n; -} diff --git a/hhkb/keymap.h b/hhkb/keymap.h index a577c79b9b..c65c2e19b9 100644 --- a/hhkb/keymap.h +++ b/hhkb/keymap.h @@ -1,8 +1,6 @@ #ifndef KEYMAP_H #define KEYMAP_H 1 -#include -#include #include "usb_keycodes.h" #include "keymap_skel.h" diff --git a/hhkb/matrix.c b/hhkb/matrix.c index d8dc9a7f8c..d95ee11350 100644 --- a/hhkb/matrix.c +++ b/hhkb/matrix.c @@ -1,10 +1,13 @@ /* * scan matrix */ +#include +#include #include #include #include "matrix.h" #include "print.h" +#include "util.h" // matrix is active low. (key on: 0/key off: 1) // @@ -30,10 +33,6 @@ static uint8_t _matrix0[MATRIX_ROWS]; static uint8_t _matrix1[MATRIX_ROWS]; -static bool matrix_has_ghost_in_row(int row); -static int bit_pop(uint8_t bits); - - inline int matrix_rows(void) { @@ -122,9 +121,6 @@ void matrix_print(void) for (int row = 0; row < matrix_rows(); row++) { phex(row); print(": "); pbin_reverse(matrix_get_row(row)); - if (matrix_has_ghost_in_row(row)) { - print("