summaryrefslogtreecommitdiff
path: root/tmk_core/protocol
diff options
context:
space:
mode:
authortmk <hasu@tmk-kbd.com>2015-04-28 11:27:10 +0900
committertmk <hasu@tmk-kbd.com>2015-04-28 11:27:10 +0900
commitd9fee5571d7de08e76dff5ce75816faf522240f6 (patch)
tree47fac278e044a8f574f9c886f528100e79777c1b /tmk_core/protocol
parent55fc97f957555c20c4509e587e8fd2ef1194ab0d (diff)
parent4d116a04e94cf0d19317d5b44e4fa9f34a3e5594 (diff)
Merge commit '4d116a04e94cf0d19317d5b44e4fa9f34a3e5594'
Diffstat (limited to 'tmk_core/protocol')
-rw-r--r--tmk_core/protocol/adb.c24
-rw-r--r--tmk_core/protocol/adb.h4
-rw-r--r--tmk_core/protocol/pjrc.mk4
3 files changed, 31 insertions, 1 deletions
diff --git a/tmk_core/protocol/adb.c b/tmk_core/protocol/adb.c
index bbff66df03..5c6c99b4fc 100644
--- a/tmk_core/protocol/adb.c
+++ b/tmk_core/protocol/adb.c
@@ -60,6 +60,7 @@ static inline void place_bit1(void);
static inline void send_byte(uint8_t data);
static inline uint16_t wait_data_lo(uint16_t us);
static inline uint16_t wait_data_hi(uint16_t us);
+static inline uint16_t adb_host_dev_recv(uint8_t device);
void adb_host_init(void)
@@ -121,12 +122,33 @@ bool adb_host_psw(void)
//
// [from Apple IIgs Hardware Reference Second Edition]
+enum {
+ ADDR_KEYB = 0x20,
+ ADDR_MOUSE = 0x30
+};
+
uint16_t adb_host_kbd_recv(void)
{
+ return adb_host_dev_recv(ADDR_KEYB);
+}
+
+#ifdef ADB_MOUSE_ENABLE
+void adb_mouse_init(void) {
+ return;
+}
+
+uint16_t adb_host_mouse_recv(void)
+{
+ return adb_host_dev_recv(ADDR_MOUSE);
+}
+#endif
+
+static inline uint16_t adb_host_dev_recv(uint8_t device)
+{
uint16_t data = 0;
cli();
attention();
- send_byte(0x2C); // Addr:Keyboard(0010), Cmd:Talk(11), Register0(00)
+ send_byte(device|0x0C); // Addr:Keyboard(0010)/Mouse(0011), Cmd:Talk(11), Register0(00)
place_bit0(); // Stopbit(0)
if (!wait_data_hi(500)) { // Service Request(310us Adjustable Keyboard): just ignored
sei();
diff --git a/tmk_core/protocol/adb.h b/tmk_core/protocol/adb.h
index bfe598bbf1..b4b3633cf4 100644
--- a/tmk_core/protocol/adb.h
+++ b/tmk_core/protocol/adb.h
@@ -56,7 +56,11 @@ POSSIBILITY OF SUCH DAMAGE.
void adb_host_init(void);
bool adb_host_psw(void);
uint16_t adb_host_kbd_recv(void);
+uint16_t adb_host_mouse_recv(void);
void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l);
void adb_host_kbd_led(uint8_t led);
+void adb_mouse_task(void);
+void adb_mouse_init(void);
+
#endif
diff --git a/tmk_core/protocol/pjrc.mk b/tmk_core/protocol/pjrc.mk
index 36585de7df..2b1ba2cbfb 100644
--- a/tmk_core/protocol/pjrc.mk
+++ b/tmk_core/protocol/pjrc.mk
@@ -11,6 +11,10 @@ ifdef MOUSEKEY_ENABLE
SRC += $(PJRC_DIR)/usb_mouse.c
endif
+ifdef ADB_MOUSE_ENABLE
+ SRC += $(PJRC_DIR)/usb_mouse.c
+endif
+
ifdef PS2_MOUSE_ENABLE
SRC += $(PJRC_DIR)/usb_mouse.c
endif