aboutsummaryrefslogtreecommitdiff
path: root/hhkb
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2011-01-02 23:52:13 +0900
committertmk <nobody@nowhere>2011-01-02 23:52:13 +0900
commit2a562a4191a5b9e88731efb5eabd921821f25f7e (patch)
tree20f5bb311ff99ced3dd8ee2d9430e2fbe8183f7b /hhkb
parent1ed336a06499c1baee2421141d59d115f0ee3c4b (diff)
downloadqmk_firmware-2a562a4191a5b9e88731efb5eabd921821f25f7e.tar.gz
qmk_firmware-2a562a4191a5b9e88731efb5eabd921821f25f7e.zip
Add PS/2 mouse support to connect TrackPoint Unit.
Change build options: Makefile and config.h. See README.
Diffstat (limited to 'hhkb')
-rw-r--r--hhkb/Makefile17
-rw-r--r--hhkb/config.h40
-rw-r--r--hhkb/controller.h12
-rw-r--r--hhkb/keymap.c3
-rw-r--r--hhkb/matrix.c5
5 files changed, 50 insertions, 27 deletions
diff --git a/hhkb/Makefile b/hhkb/Makefile
index bf5d75ee9..943785fef 100644
--- a/hhkb/Makefile
+++ b/hhkb/Makefile
@@ -39,16 +39,6 @@
39# To rebuild project do "make clean" then "make all". 39# To rebuild project do "make clean" then "make all".
40#---------------------------------------------------------------------------- 40#----------------------------------------------------------------------------
41 41
42# TODO: use config.h for build options?
43VENDOR_ID = 0xFEED
44PRODUCT_ID = 0xCAFE
45MANUFACTURER = 't.m.k.'
46PRODUCT = 'HHKB Mod'
47DESCRIPTION = 't.m.k. firmware for HHKB pro'
48
49MOUSE_DELAY_TIME = 127
50NKRO_ENABLE = true
51
52# Target file name (without extension). 42# Target file name (without extension).
53TARGET = tmk_hhkb 43TARGET = tmk_hhkb
54 44
@@ -78,4 +68,11 @@ MCU = at90usb1286 # Teensy++ 2.0
78# examples use this variable to calculate timings. Do not add a "UL" here. 68# examples use this variable to calculate timings. Do not add a "UL" here.
79F_CPU = 16000000 69F_CPU = 16000000
80 70
71
72# Options
73# comment out to disable
74USB_NKRO_ENABLE = yes
75MOUSEKEY_ENABLE = yes
76#PS2_MOUSE_ENABLE = yes
77
81include $(COMMON_DIR)/Makefile.common 78include $(COMMON_DIR)/Makefile.common
diff --git a/hhkb/config.h b/hhkb/config.h
new file mode 100644
index 000000000..7722ed46a
--- /dev/null
+++ b/hhkb/config.h
@@ -0,0 +1,40 @@
1#ifndef CONFIG_H
2#define CONFIG_H
3
4#define VENDOR_ID 0xFEED
5#define PRODUCT_ID 0xCAFE
6#define MANUFACTURER t.m.k.
7#define PRODUCT HHKB mod
8#define DESCRIPTION t.m.k. keyboard firmware for HHKB mod
9
10/* controller */
11#include "controller_teensy.h"
12
13/* matrix size */
14#define MATRIX_ROWS 8
15#define MATRIX_COLS 8
16
17/* USB NKey Rollover */
18#ifdef USB_NKRO_ENABLE
19#endif
20
21/* mouse keys */
22#ifdef MOUSEKEY_ENABLE
23# define MOUSEKEY_DELAY_TIME 192
24#endif
25
26/* PS/2 mouse */
27#ifdef PS2_MOUSE_ENABLE
28/*
29# define PS2_CLOCK_PORT PORTF
30# define PS2_CLOCK_PIN PINF
31# define PS2_CLOCK_DDR DDRF
32# define PS2_CLOCK_BIT 0
33# define PS2_DATA_PORT PORTF
34# define PS2_DATA_PIN PINF
35# define PS2_DATA_DDR DDRF
36# define PS2_DATA_BIT 1
37*/
38#endif
39
40#endif
diff --git a/hhkb/controller.h b/hhkb/controller.h
deleted file mode 100644
index 32a10b7cd..000000000
--- a/hhkb/controller.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef CONTROLLER_H
2#define CONTROLLER_H 1
3
4#include "controller_teensy.h"
5
6
7/* matrix row size */
8#define MATRIX_ROWS 8
9/* matrix column size */
10#define MATRIX_COLS 8
11
12#endif
diff --git a/hhkb/keymap.c b/hhkb/keymap.c
index fd9bcce8a..4273835e9 100644
--- a/hhkb/keymap.c
+++ b/hhkb/keymap.c
@@ -9,7 +9,6 @@
9#include "print.h" 9#include "print.h"
10#include "debug.h" 10#include "debug.h"
11#include "util.h" 11#include "util.h"
12#include "controller.h"
13#include "keymap_skel.h" 12#include "keymap_skel.h"
14 13
15 14
@@ -75,7 +74,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
75 * |-----------------------------------------------------------| 74 * |-----------------------------------------------------------|
76 * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs| 75 * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs|
77 * |-----------------------------------------------------------| 76 * |-----------------------------------------------------------|
78 * |Contro| | | | | | *| /|Hom|PgU|Lef|Rig|Enter | 77 * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
79 * |-----------------------------------------------------------| 78 * |-----------------------------------------------------------|
80 * |Shift | | | | | | +| -|End|PgD|Dow|Shift |xxx| 79 * |Shift | | | | | | +| -|End|PgD|Dow|Shift |xxx|
81 * `-----------------------------------------------------------' 80 * `-----------------------------------------------------------'
diff --git a/hhkb/matrix.c b/hhkb/matrix.c
index a6e0bf633..dd4440d9e 100644
--- a/hhkb/matrix.c
+++ b/hhkb/matrix.c
@@ -7,7 +7,6 @@
7#include <util/delay.h> 7#include <util/delay.h>
8#include "print.h" 8#include "print.h"
9#include "util.h" 9#include "util.h"
10#include "controller.h"
11#include "matrix_skel.h" 10#include "matrix_skel.h"
12 11
13// matrix is active low. (key on: 0/key off: 1) 12// matrix is active low. (key on: 0/key off: 1)
@@ -22,7 +21,7 @@
22// KEY_PREV: (on: 1/ off: 0) 21// KEY_PREV: (on: 1/ off: 0)
23// PE6,PE7(KEY, KEY_PREV) 22// PE6,PE7(KEY, KEY_PREV)
24#define COL_ENABLE (1<<6) 23#define COL_ENABLE (1<<6)
25#define KEY_SELELCT(ROW, COL) (PORTB = COL_ENABLE|(((COL)&0x07)<<3)|((ROW)&0x07)) 24#define KEY_SELELCT(ROW, COL) (PORTB = (PORTB&(1<<7))|COL_ENABLE|(((COL)&0x07)<<3)|((ROW)&0x07))
26#define KEY_ENABLE (PORTB &= ~COL_ENABLE) 25#define KEY_ENABLE (PORTB &= ~COL_ENABLE)
27#define KEY_UNABLE (PORTB |= COL_ENABLE) 26#define KEY_UNABLE (PORTB |= COL_ENABLE)
28#define KEY_STATE (PINE&(1<<6)) 27#define KEY_STATE (PINE&(1<<6))
@@ -53,7 +52,7 @@ void matrix_init(void)
53{ 52{
54 // row & col output(PB0-6) 53 // row & col output(PB0-6)
55 DDRB = 0xFF; 54 DDRB = 0xFF;
56 PORTB = KEY_SELELCT(0, 0); 55 KEY_SELELCT(0, 0);
57 // KEY: input with pullup(PE6) 56 // KEY: input with pullup(PE6)
58 // KEY_PREV: output(PE7) 57 // KEY_PREV: output(PE7)
59 DDRE = 0xBF; 58 DDRE = 0xBF;