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/protocol | |
parent | 55fc97f957555c20c4509e587e8fd2ef1194ab0d (diff) | |
parent | 4d116a04e94cf0d19317d5b44e4fa9f34a3e5594 (diff) | |
download | qmk_firmware-d9fee5571d7de08e76dff5ce75816faf522240f6.tar.gz qmk_firmware-d9fee5571d7de08e76dff5ce75816faf522240f6.zip |
Merge commit '4d116a04e94cf0d19317d5b44e4fa9f34a3e5594'
Diffstat (limited to 'tmk_core/protocol')
-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 |
3 files changed, 31 insertions, 1 deletions
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 |