summaryrefslogtreecommitdiff
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 bf5d75ee9f..943785fef8 100644
--- a/hhkb/Makefile
+++ b/hhkb/Makefile
@@ -39,16 +39,6 @@
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
-# TODO: use config.h for build options?
-VENDOR_ID = 0xFEED
-PRODUCT_ID = 0xCAFE
-MANUFACTURER = 't.m.k.'
-PRODUCT = 'HHKB Mod'
-DESCRIPTION = 't.m.k. firmware for HHKB pro'
-
-MOUSE_DELAY_TIME = 127
-NKRO_ENABLE = true
-
# Target file name (without extension).
TARGET = tmk_hhkb
@@ -78,4 +68,11 @@ MCU = at90usb1286 # Teensy++ 2.0
# examples use this variable to calculate timings. Do not add a "UL" here.
F_CPU = 16000000
+
+# Options
+# comment out to disable
+USB_NKRO_ENABLE = yes
+MOUSEKEY_ENABLE = yes
+#PS2_MOUSE_ENABLE = yes
+
include $(COMMON_DIR)/Makefile.common
diff --git a/hhkb/config.h b/hhkb/config.h
new file mode 100644
index 0000000000..7722ed46a8
--- /dev/null
+++ b/hhkb/config.h
@@ -0,0 +1,40 @@
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0xCAFE
+#define MANUFACTURER t.m.k.
+#define PRODUCT HHKB mod
+#define DESCRIPTION t.m.k. keyboard firmware for HHKB mod
+
+/* controller */
+#include "controller_teensy.h"
+
+/* matrix size */
+#define MATRIX_ROWS 8
+#define MATRIX_COLS 8
+
+/* USB NKey Rollover */
+#ifdef USB_NKRO_ENABLE
+#endif
+
+/* mouse keys */
+#ifdef MOUSEKEY_ENABLE
+# define MOUSEKEY_DELAY_TIME 192
+#endif
+
+/* PS/2 mouse */
+#ifdef PS2_MOUSE_ENABLE
+/*
+# define PS2_CLOCK_PORT PORTF
+# define PS2_CLOCK_PIN PINF
+# define PS2_CLOCK_DDR DDRF
+# define PS2_CLOCK_BIT 0
+# define PS2_DATA_PORT PORTF
+# define PS2_DATA_PIN PINF
+# define PS2_DATA_DDR DDRF
+# define PS2_DATA_BIT 1
+*/
+#endif
+
+#endif
diff --git a/hhkb/controller.h b/hhkb/controller.h
deleted file mode 100644
index 32a10b7cd1..0000000000
--- a/hhkb/controller.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef CONTROLLER_H
-#define CONTROLLER_H 1
-
-#include "controller_teensy.h"
-
-
-/* matrix row size */
-#define MATRIX_ROWS 8
-/* matrix column size */
-#define MATRIX_COLS 8
-
-#endif
diff --git a/hhkb/keymap.c b/hhkb/keymap.c
index fd9bcce8a2..4273835e98 100644
--- a/hhkb/keymap.c
+++ b/hhkb/keymap.c
@@ -9,7 +9,6 @@
#include "print.h"
#include "debug.h"
#include "util.h"
-#include "controller.h"
#include "keymap_skel.h"
@@ -75,7 +74,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |-----------------------------------------------------------|
* |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs|
* |-----------------------------------------------------------|
- * |Contro| | | | | | *| /|Hom|PgU|Lef|Rig|Enter |
+ * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
* |-----------------------------------------------------------|
* |Shift | | | | | | +| -|End|PgD|Dow|Shift |xxx|
* `-----------------------------------------------------------'
diff --git a/hhkb/matrix.c b/hhkb/matrix.c
index a6e0bf633f..dd4440d9e3 100644
--- a/hhkb/matrix.c
+++ b/hhkb/matrix.c
@@ -7,7 +7,6 @@
#include <util/delay.h>
#include "print.h"
#include "util.h"
-#include "controller.h"
#include "matrix_skel.h"
// matrix is active low. (key on: 0/key off: 1)
@@ -22,7 +21,7 @@
// KEY_PREV: (on: 1/ off: 0)
// PE6,PE7(KEY, KEY_PREV)
#define COL_ENABLE (1<<6)
-#define KEY_SELELCT(ROW, COL) (PORTB = COL_ENABLE|(((COL)&0x07)<<3)|((ROW)&0x07))
+#define KEY_SELELCT(ROW, COL) (PORTB = (PORTB&(1<<7))|COL_ENABLE|(((COL)&0x07)<<3)|((ROW)&0x07))
#define KEY_ENABLE (PORTB &= ~COL_ENABLE)
#define KEY_UNABLE (PORTB |= COL_ENABLE)
#define KEY_STATE (PINE&(1<<6))
@@ -53,7 +52,7 @@ void matrix_init(void)
{
// row & col output(PB0-6)
DDRB = 0xFF;
- PORTB = KEY_SELELCT(0, 0);
+ KEY_SELELCT(0, 0);
// KEY: input with pullup(PE6)
// KEY_PREV: output(PE7)
DDRE = 0xBF;