aboutsummaryrefslogtreecommitdiff
path: root/hhkb
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2011-05-25 10:37:58 +0900
committertmk <nobody@nowhere>2011-05-25 11:30:14 +0900
commitaf85b6bba6744573f1edecd26fb504c31094414f (patch)
tree3ba304c36fa36c83d06123b569c77b68b801e7cd /hhkb
parent74f7e19863ced21bf5d27c1fb1207f79f2195e24 (diff)
downloadqmk_firmware-af85b6bba6744573f1edecd26fb504c31094414f.tar.gz
qmk_firmware-af85b6bba6744573f1edecd26fb504c31094414f.zip
added HHKB/README and clean some codes.
Diffstat (limited to 'hhkb')
-rw-r--r--[-rwxr-xr-x]hhkb/Makefile11
-rw-r--r--hhkb/Makefile.vusb11
-rw-r--r--hhkb/README80
-rw-r--r--hhkb/config_pjrc.h (renamed from hhkb/config.h)0
-rw-r--r--hhkb/config_vusb.h88
-rw-r--r--[-rwxr-xr-x]hhkb/doc/HHKB_TP1684.jpgbin149082 -> 149082 bytes
-rw-r--r--[-rwxr-xr-x]hhkb/doc/HHKB_chart1.jpgbin155342 -> 155342 bytes
-rw-r--r--[-rwxr-xr-x]hhkb/doc/HHKB_chart2.jpgbin148225 -> 148225 bytes
-rw-r--r--[-rwxr-xr-x]hhkb/doc/HHKB_connector.jpgbin193900 -> 193900 bytes
-rw-r--r--[-rwxr-xr-x]hhkb/doc/HHKB_controller.jpgbin135100 -> 135100 bytes
-rw-r--r--[-rwxr-xr-x]hhkb/doc/HHKB_keyswitch.jpgbin171469 -> 171469 bytes
-rw-r--r--[-rwxr-xr-x]hhkb/doc/connector_contact.jpgbin192830 -> 192830 bytes
-rw-r--r--[-rwxr-xr-x]hhkb/doc/logic_analyzer.jpgbin169564 -> 169564 bytes
-rw-r--r--[-rwxr-xr-x]hhkb/doc/probe_contact.jpgbin208477 -> 208477 bytes
-rw-r--r--[-rwxr-xr-x]hhkb/doc/teensy_install.jpgbin135851 -> 135851 bytes
-rw-r--r--[-rwxr-xr-x]hhkb/doc/teensy_wiring.jpgbin154695 -> 154695 bytes
16 files changed, 94 insertions, 96 deletions
diff --git a/hhkb/Makefile b/hhkb/Makefile
index 4a0af1cdc..e1cc2f210 100755..100644
--- a/hhkb/Makefile
+++ b/hhkb/Makefile
@@ -1,5 +1,10 @@
1#
2# Makefile for PJRC Teensy
3#
4
5
1# Target file name (without extension). 6# Target file name (without extension).
2TARGET = hhkb 7TARGET = hhkb_pjrc
3 8
4# Directory common source filess exist 9# Directory common source filess exist
5COMMON_DIR = .. 10COMMON_DIR = ..
@@ -13,7 +18,7 @@ TARGET_SRC = main_pjrc.c \
13 matrix.c \ 18 matrix.c \
14 led.c 19 led.c
15 20
16CONFIG_H = config.h 21CONFIG_H = config_pjrc.h
17 22
18 23
19# MCU name, you MUST set this to match the board you are using 24# MCU name, you MUST set this to match the board you are using
@@ -36,7 +41,7 @@ F_CPU = 16000000
36# comment out to disable the options. 41# comment out to disable the options.
37MOUSEKEY_ENABLE = yes # Mouse keys 42MOUSEKEY_ENABLE = yes # Mouse keys
38#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support 43#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
39USB_EXTRA_ENABLE = yes # Enhanced feature for Windows(Audio control and System control) 44USB_EXTRA_ENABLE = yes # Audio control and System control
40USB_NKRO_ENABLE = yes # USB Nkey Rollover 45USB_NKRO_ENABLE = yes # USB Nkey Rollover
41 46
42 47
diff --git a/hhkb/Makefile.vusb b/hhkb/Makefile.vusb
index 7826ffd02..77841b824 100644
--- a/hhkb/Makefile.vusb
+++ b/hhkb/Makefile.vusb
@@ -1,3 +1,8 @@
1#
2# Makefile for V-USB
3#
4
5
1# Target file name (without extension). 6# Target file name (without extension).
2TARGET = hhkb_vusb 7TARGET = hhkb_vusb
3 8
@@ -23,10 +28,6 @@ OPT_DEFS = -DDEBUG_LEVEL=0
23 28
24# MCU name, you MUST set this to match the board you are using 29# MCU name, you MUST set this to match the board you are using
25# type "make clean" after changing this, so all files will be rebuilt 30# type "make clean" after changing this, so all files will be rebuilt
26#MCU = at90usb162 # Teensy 1.0
27#MCU = atmega32u4 # Teensy 2.0
28#MCU = at90usb646 # Teensy++ 1.0
29#MCU = at90usb1286 # Teensy++ 2.0
30MCU = atmega168 31MCU = atmega168
31 32
32 33
@@ -42,7 +43,7 @@ F_CPU = 20000000
42# comment out to disable the options. 43# comment out to disable the options.
43# 44#
44MOUSEKEY_ENABLE = yes # Mouse keys 45MOUSEKEY_ENABLE = yes # Mouse keys
45USB_EXTRA_ENABLE = yes # Enhanced feature for Windows(Audio control and System control) 46USB_EXTRA_ENABLE = yes # Audio control and System control
46#USB_NKRO_ENABLE = yes # USB Nkey Rollover 47#USB_NKRO_ENABLE = yes # USB Nkey Rollover
47 48
48 49
diff --git a/hhkb/README b/hhkb/README
new file mode 100644
index 000000000..2a4418101
--- /dev/null
+++ b/hhkb/README
@@ -0,0 +1,80 @@
1Alternative Controller for HHKB
2===============================
3
4Feature
5-------
6- Mouse Keys
7- NKRO on USB
8- Keymap Layers
9
10
11Customize Keymap
12----------------
13see keymap.c.
14
15
16Build for Teensy
17----------------
180. Edit matrix.c.
19 adjust scan code to your pin configuration.(see doc/HHKB.txt for pinouts)
201. Define macros in config_pjrc.h.(Optional)
21 VENDOR_ID, PRODUCT_ID and string descriptor.
22 IS_COMMAND
232. Edit Makefile for MCU setting and build options.
24 MCU, F_CPU
25 MOUSEKEY_ENABLE, USB_EXTRA_ENABLE, USB_NKRO_ENABLE
263. Build hex file.
27 $ make
284. Program MCU.
29 $ make program
30
31
32Build for V-USB
33---------------
340. Edit matrix.c and usbconfig.h.
35 adjust scan code to your pin configuration.(see doc/HHKB.txt for pinouts)
36 define macros for V-USB in usbconfig.h.
371. Define macros in config_vusb.h.(Optional)
38 IS_COMMAND
392. Edit Makefile.vusb for MCU setting and build options.
40 MCU, F_CPU
41 MOUSEKEY_ENABLE, USB_EXTRA_ENABLE, USB_NKRO_ENABLE
423. Build hex file.
43 $ make -f Makefile.vusb
444. Program MCU.
45 $ make -f Makefile.vusb program
46
47 Using a bootloader to program for convenience is recommended.
48 Once program this V-USB bootloader at first, you can program MCU without
49 extra programmer. You should have reset switch to start up as bootloader
50 mode in this case.
51 USBaspLoader:
52 http://www.obdev.at/products/vusb/usbasploader.html
53
54
55V-USB Circuit
56-------------
57 +---+ +---------------+
58USB GND | | ATmega168 |
59=== C3 | |
605V <-------+--------+---|Vcc,AVCC | HHKB
61 R1 | | ====
62D- <----+--+-----R2-----|INT1 PB0-2|------->ROW
63D+ <----|---+----R3-----|INT0 PB3-5|------->COL
64 Z1 Z2 | PB6|------->ENABLE
65GND<----+---+--+--+-----|GND PE6|------->KEY
66 | | | PE7|------->PREV
67 | C2-+--|XTAL1 | (see doc/HHKB.txt for pinouts)
68 | X1 | |
69 +--C3-+--|XTAL2 RST|---SW--+GND
70 +---------------+
71R1: 1.5K Ohm
72R2,R3: 68 Ohm
73Z1,Z2: Zener 3.6V
74C1,C2: 22pF
75C3: 0.1uF
76X1: Crystal 20MHz(16MHz/12MHz)
77SW: Push Switch(Optional for bootloader)
78
79
80EOF
diff --git a/hhkb/config.h b/hhkb/config_pjrc.h
index 886eef928..886eef928 100644
--- a/hhkb/config.h
+++ b/hhkb/config_pjrc.h
diff --git a/hhkb/config_vusb.h b/hhkb/config_vusb.h
index 3b44b94a3..7c4291a21 100644
--- a/hhkb/config_vusb.h
+++ b/hhkb/config_vusb.h
@@ -29,92 +29,4 @@
29#endif 29#endif
30 30
31 31
32/* PS/2 lines */
33#ifdef PS2_MOUSE_ENABLE
34
35#define PS2_CLOCK_PORT PORTD
36#define PS2_CLOCK_PIN PIND
37#define PS2_CLOCK_DDR DDRD
38#define PS2_CLOCK_BIT 4
39#define PS2_DATA_PORT PORTD
40#define PS2_DATA_PIN PIND
41#define PS2_DATA_DDR DDRD
42#define PS2_DATA_BIT 0
43
44
45// Synchronous USART is used to receive data from keyboard.
46// Use RXD pin for PS/2 DATA line and XCK for PS/2 CLOCK.
47// NOTE: This is recomended strongly if you use V-USB library.
48#define PS2_USE_USART
49
50// External or Pin Change Interrupt is used to receive data from keyboard.
51// Use INT1 or PCINTxx for PS/2 CLOCK line. see below.
52//#define PS2_USE_INT
53
54
55#ifdef PS2_USE_USART
56// synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge
57// set DDR of CLOCK as input to be slave
58#define PS2_USART_INIT() do { \
59 PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
60 PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
61 UCSR0C = ((1 << UMSEL00) | \
62 (3 << UPM00) | \
63 (0 << USBS0) | \
64 (3 << UCSZ00) | \
65 (0 << UCPOL0)); \
66 UCSR0A = 0; \
67 UBRR0H = 0; \
68 UBRR0L = 0; \
69} while (0)
70#define PS2_USART_RX_INT_ON() do { \
71 UCSR0B = ((1 << RXCIE0) | \
72 (1 << RXEN0)); \
73} while (0)
74#define PS2_USART_RX_POLL_ON() do { \
75 UCSR0B = (1 << RXEN0); \
76} while (0)
77#define PS2_USART_OFF() do { \
78 UCSR0C = 0; \
79 UCSR0B &= ~((1 << RXEN0) | \
80 (1 << TXEN0)); \
81} while (0)
82#define PS2_USART_RX_READY (UCSR0A & (1<<RXC0))
83#define PS2_USART_RX_DATA UDR0
84#define PS2_USART_ERROR (UCSR0A & ((1<<FE0) | (1<<DOR0) | (1<<UPE0)))
85#define PS2_USART_RX_VECT USART_RX_vect
86#endif
87
88
89#ifdef PS2_USE_INT
90/* INT1
91#define PS2_INT_INIT() do { \
92 EICRA |= ((1<<ISC11) | \
93 (0<<ISC10)); \
94} while (0)
95#define PS2_INT_ON() do { \
96 EIMSK |= (1<<INT1); \
97} while (0)
98#define PS2_INT_OFF() do { \
99 EIMSK &= ~(1<<INT1); \
100} while (0)
101#define PS2_INT_VECT INT1_vect
102*/
103
104/* PCINT20 */
105#define PS2_INT_INIT() do { \
106 PCICR |= (1<<PCIE2); \
107} while (0)
108#define PS2_INT_ON() do { \
109 PCMSK2 |= (1<<PCINT20); \
110} while (0)
111#define PS2_INT_OFF() do { \
112 PCMSK2 &= ~(1<<PCINT20); \
113 PCICR &= ~(1<<PCIE2); \
114} while (0)
115#define PS2_INT_VECT PCINT2_vect
116#endif
117
118#endif
119
120#endif 32#endif
diff --git a/hhkb/doc/HHKB_TP1684.jpg b/hhkb/doc/HHKB_TP1684.jpg
index 0a0316409..0a0316409 100755..100644
--- a/hhkb/doc/HHKB_TP1684.jpg
+++ b/hhkb/doc/HHKB_TP1684.jpg
Binary files differ
diff --git a/hhkb/doc/HHKB_chart1.jpg b/hhkb/doc/HHKB_chart1.jpg
index 1f09bd185..1f09bd185 100755..100644
--- a/hhkb/doc/HHKB_chart1.jpg
+++ b/hhkb/doc/HHKB_chart1.jpg
Binary files differ
diff --git a/hhkb/doc/HHKB_chart2.jpg b/hhkb/doc/HHKB_chart2.jpg
index 45f5ada90..45f5ada90 100755..100644
--- a/hhkb/doc/HHKB_chart2.jpg
+++ b/hhkb/doc/HHKB_chart2.jpg
Binary files differ
diff --git a/hhkb/doc/HHKB_connector.jpg b/hhkb/doc/HHKB_connector.jpg
index e8a09e9b2..e8a09e9b2 100755..100644
--- a/hhkb/doc/HHKB_connector.jpg
+++ b/hhkb/doc/HHKB_connector.jpg
Binary files differ
diff --git a/hhkb/doc/HHKB_controller.jpg b/hhkb/doc/HHKB_controller.jpg
index e3dae8e86..e3dae8e86 100755..100644
--- a/hhkb/doc/HHKB_controller.jpg
+++ b/hhkb/doc/HHKB_controller.jpg
Binary files differ
diff --git a/hhkb/doc/HHKB_keyswitch.jpg b/hhkb/doc/HHKB_keyswitch.jpg
index 3afc269e7..3afc269e7 100755..100644
--- a/hhkb/doc/HHKB_keyswitch.jpg
+++ b/hhkb/doc/HHKB_keyswitch.jpg
Binary files differ
diff --git a/hhkb/doc/connector_contact.jpg b/hhkb/doc/connector_contact.jpg
index 5304bc8d7..5304bc8d7 100755..100644
--- a/hhkb/doc/connector_contact.jpg
+++ b/hhkb/doc/connector_contact.jpg
Binary files differ
diff --git a/hhkb/doc/logic_analyzer.jpg b/hhkb/doc/logic_analyzer.jpg
index f1b438ae7..f1b438ae7 100755..100644
--- a/hhkb/doc/logic_analyzer.jpg
+++ b/hhkb/doc/logic_analyzer.jpg
Binary files differ
diff --git a/hhkb/doc/probe_contact.jpg b/hhkb/doc/probe_contact.jpg
index dc79afa0c..dc79afa0c 100755..100644
--- a/hhkb/doc/probe_contact.jpg
+++ b/hhkb/doc/probe_contact.jpg
Binary files differ
diff --git a/hhkb/doc/teensy_install.jpg b/hhkb/doc/teensy_install.jpg
index 873d988ed..873d988ed 100755..100644
--- a/hhkb/doc/teensy_install.jpg
+++ b/hhkb/doc/teensy_install.jpg
Binary files differ
diff --git a/hhkb/doc/teensy_wiring.jpg b/hhkb/doc/teensy_wiring.jpg
index 1c4eb6743..1c4eb6743 100755..100644
--- a/hhkb/doc/teensy_wiring.jpg
+++ b/hhkb/doc/teensy_wiring.jpg
Binary files differ