diff options
author | tmk <hasu@tmk-kbd.com> | 2015-04-28 11:27:10 +0900 |
---|---|---|
committer | tmk <hasu@tmk-kbd.com> | 2015-04-28 11:27:10 +0900 |
commit | d9fee5571d7de08e76dff5ce75816faf522240f6 (patch) | |
tree | 47fac278e044a8f574f9c886f528100e79777c1b /tmk_core | |
parent | 55fc97f957555c20c4509e587e8fd2ef1194ab0d (diff) | |
parent | 4d116a04e94cf0d19317d5b44e4fa9f34a3e5594 (diff) | |
download | qmk_firmware-d9fee5571d7de08e76dff5ce75816faf522240f6.tar.gz qmk_firmware-d9fee5571d7de08e76dff5ce75816faf522240f6.zip |
Merge commit '4d116a04e94cf0d19317d5b44e4fa9f34a3e5594'
Diffstat (limited to 'tmk_core')
-rw-r--r-- | tmk_core/common/keyboard.c | 10 | ||||
-rw-r--r-- | tmk_core/protocol.mk | 4 | ||||
-rw-r--r-- | tmk_core/protocol/adb.c | 24 | ||||
-rw-r--r-- | tmk_core/protocol/adb.h | 4 | ||||
-rw-r--r-- | tmk_core/protocol/pjrc.mk | 4 |
5 files changed, 45 insertions, 1 deletions
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index f0ead604e..b03b124d7 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c | |||
@@ -39,6 +39,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
39 | #ifdef SERIAL_MOUSE_ENABLE | 39 | #ifdef SERIAL_MOUSE_ENABLE |
40 | #include "serial_mouse.h" | 40 | #include "serial_mouse.h" |
41 | #endif | 41 | #endif |
42 | #ifdef ADB_MOUSE_ENABLE | ||
43 | #include "adb.h" | ||
44 | #endif | ||
42 | 45 | ||
43 | 46 | ||
44 | #ifdef MATRIX_HAS_GHOST | 47 | #ifdef MATRIX_HAS_GHOST |
@@ -69,6 +72,9 @@ void keyboard_init(void) | |||
69 | #ifdef SERIAL_MOUSE_ENABLE | 72 | #ifdef SERIAL_MOUSE_ENABLE |
70 | serial_mouse_init(); | 73 | serial_mouse_init(); |
71 | #endif | 74 | #endif |
75 | #ifdef ADB_MOUSE_ENABLE | ||
76 | adb_mouse_init(); | ||
77 | #endif | ||
72 | 78 | ||
73 | 79 | ||
74 | #ifdef BOOTMAGIC_ENABLE | 80 | #ifdef BOOTMAGIC_ENABLE |
@@ -147,6 +153,10 @@ MATRIX_LOOP_END: | |||
147 | serial_mouse_task(); | 153 | serial_mouse_task(); |
148 | #endif | 154 | #endif |
149 | 155 | ||
156 | #ifdef ADB_MOUSE_ENABLE | ||
157 | adb_mouse_task(); | ||
158 | #endif | ||
159 | |||
150 | // update LED | 160 | // update LED |
151 | if (led_status != host_keyboard_leds()) { | 161 | if (led_status != host_keyboard_leds()) { |
152 | led_status = host_keyboard_leds(); | 162 | led_status = host_keyboard_leds(); |
diff --git a/tmk_core/protocol.mk b/tmk_core/protocol.mk index 726f658a0..54913329e 100644 --- a/tmk_core/protocol.mk +++ b/tmk_core/protocol.mk | |||
@@ -46,5 +46,9 @@ ifdef SERIAL_MOUSE_USE_UART | |||
46 | SRC += $(PROTOCOL_DIR)/serial_uart.c | 46 | SRC += $(PROTOCOL_DIR)/serial_uart.c |
47 | endif | 47 | endif |
48 | 48 | ||
49 | ifdef ADB_MOUSE_ENABLE | ||
50 | OPT_DEFS += -DADB_MOUSE_ENABLE -DMOUSE_ENABLE | ||
51 | endif | ||
52 | |||
49 | # Search Path | 53 | # Search Path |
50 | VPATH += $(TMK_DIR)/protocol | 54 | VPATH += $(TMK_DIR)/protocol |
diff --git a/tmk_core/protocol/adb.c b/tmk_core/protocol/adb.c index bbff66df0..5c6c99b4f 100644 --- a/tmk_core/protocol/adb.c +++ b/tmk_core/protocol/adb.c | |||
@@ -60,6 +60,7 @@ static inline void place_bit1(void); | |||
60 | static inline void send_byte(uint8_t data); | 60 | static inline void send_byte(uint8_t data); |
61 | static inline uint16_t wait_data_lo(uint16_t us); | 61 | static inline uint16_t wait_data_lo(uint16_t us); |
62 | static inline uint16_t wait_data_hi(uint16_t us); | 62 | static inline uint16_t wait_data_hi(uint16_t us); |
63 | static inline uint16_t adb_host_dev_recv(uint8_t device); | ||
63 | 64 | ||
64 | 65 | ||
65 | void adb_host_init(void) | 66 | void adb_host_init(void) |
@@ -121,12 +122,33 @@ bool adb_host_psw(void) | |||
121 | // | 122 | // |
122 | // [from Apple IIgs Hardware Reference Second Edition] | 123 | // [from Apple IIgs Hardware Reference Second Edition] |
123 | 124 | ||
125 | enum { | ||
126 | ADDR_KEYB = 0x20, | ||
127 | ADDR_MOUSE = 0x30 | ||
128 | }; | ||
129 | |||
124 | uint16_t adb_host_kbd_recv(void) | 130 | uint16_t adb_host_kbd_recv(void) |
125 | { | 131 | { |
132 | return adb_host_dev_recv(ADDR_KEYB); | ||
133 | } | ||
134 | |||
135 | #ifdef ADB_MOUSE_ENABLE | ||
136 | void adb_mouse_init(void) { | ||
137 | return; | ||
138 | } | ||
139 | |||
140 | uint16_t adb_host_mouse_recv(void) | ||
141 | { | ||
142 | return adb_host_dev_recv(ADDR_MOUSE); | ||
143 | } | ||
144 | #endif | ||
145 | |||
146 | static inline uint16_t adb_host_dev_recv(uint8_t device) | ||
147 | { | ||
126 | uint16_t data = 0; | 148 | uint16_t data = 0; |
127 | cli(); | 149 | cli(); |
128 | attention(); | 150 | attention(); |
129 | send_byte(0x2C); // Addr:Keyboard(0010), Cmd:Talk(11), Register0(00) | 151 | send_byte(device|0x0C); // Addr:Keyboard(0010)/Mouse(0011), Cmd:Talk(11), Register0(00) |
130 | place_bit0(); // Stopbit(0) | 152 | place_bit0(); // Stopbit(0) |
131 | if (!wait_data_hi(500)) { // Service Request(310us Adjustable Keyboard): just ignored | 153 | if (!wait_data_hi(500)) { // Service Request(310us Adjustable Keyboard): just ignored |
132 | sei(); | 154 | sei(); |
diff --git a/tmk_core/protocol/adb.h b/tmk_core/protocol/adb.h index bfe598bbf..b4b3633cf 100644 --- a/tmk_core/protocol/adb.h +++ b/tmk_core/protocol/adb.h | |||
@@ -56,7 +56,11 @@ POSSIBILITY OF SUCH DAMAGE. | |||
56 | void adb_host_init(void); | 56 | void adb_host_init(void); |
57 | bool adb_host_psw(void); | 57 | bool adb_host_psw(void); |
58 | uint16_t adb_host_kbd_recv(void); | 58 | uint16_t adb_host_kbd_recv(void); |
59 | uint16_t adb_host_mouse_recv(void); | ||
59 | void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l); | 60 | void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l); |
60 | void adb_host_kbd_led(uint8_t led); | 61 | void adb_host_kbd_led(uint8_t led); |
62 | void adb_mouse_task(void); | ||
63 | void adb_mouse_init(void); | ||
64 | |||
61 | 65 | ||
62 | #endif | 66 | #endif |
diff --git a/tmk_core/protocol/pjrc.mk b/tmk_core/protocol/pjrc.mk index 36585de7d..2b1ba2cbf 100644 --- a/tmk_core/protocol/pjrc.mk +++ b/tmk_core/protocol/pjrc.mk | |||
@@ -11,6 +11,10 @@ ifdef MOUSEKEY_ENABLE | |||
11 | SRC += $(PJRC_DIR)/usb_mouse.c | 11 | SRC += $(PJRC_DIR)/usb_mouse.c |
12 | endif | 12 | endif |
13 | 13 | ||
14 | ifdef ADB_MOUSE_ENABLE | ||
15 | SRC += $(PJRC_DIR)/usb_mouse.c | ||
16 | endif | ||
17 | |||
14 | ifdef PS2_MOUSE_ENABLE | 18 | ifdef PS2_MOUSE_ENABLE |
15 | SRC += $(PJRC_DIR)/usb_mouse.c | 19 | SRC += $(PJRC_DIR)/usb_mouse.c |
16 | endif | 20 | endif |