diff options
| author | tmk <nobody@nowhere> | 2010-10-27 20:51:45 +0900 | 
|---|---|---|
| committer | tmk <nobody@nowhere> | 2010-10-27 22:56:01 +0900 | 
| commit | 2f80e790c6310ad24a4cb3d4a72c31314364fef7 (patch) | |
| tree | aad001abdb61ff736e580f98184ab7cd9e870648 /hhkb | |
| parent | 461e0d3d8c82cc78d29d3115af3c417bb51bb50f (diff) | |
new build method for macway
Diffstat (limited to 'hhkb')
| -rw-r--r-- | hhkb/Makefile | 8 | ||||
| -rw-r--r-- | hhkb/keymap.c | 22 | ||||
| -rw-r--r-- | hhkb/keymap.h | 2 | ||||
| -rw-r--r-- | hhkb/matrix.c | 27 | 
4 files changed, 17 insertions, 42 deletions
| 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 <stdint.h>  #include <stdbool.h>  #include <avr/pgmspace.h>  #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 <stdint.h> -#include <stdbool.h>  #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 <stdint.h> +#include <stdbool.h>  #include <avr/io.h>  #include <util/delay.h>  #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(" <ghost"); -        }          print("\n");      }  } @@ -133,22 +129,7 @@ int matrix_key_count(void)  {      int count = 0;      for (int i = 0; i < MATRIX_ROWS; i++) { -        count += bit_pop(matrix[i]); +        count += bitpop(matrix[i]);      }      return count;  } - -inline -static bool matrix_has_ghost_in_row(int row) -{ -    return false; -} - -inline -static int bit_pop(uint8_t bits) -{ -    int c; -    for (c = 0; bits; c++) -        bits &= bits -1; -    return c; -} | 
