aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/protocol/adb.h
diff options
context:
space:
mode:
authorsiggie0815 <dev.siggie@gmail.com>2020-12-30 04:18:16 +0100
committerGitHub <noreply@github.com>2020-12-29 19:18:16 -0800
commit1b3504e3292db2074b83944c32b67a7c88bb4f51 (patch)
treed6d857822fd9c9fe036faa829d1bf936aa1850e6 /tmk_core/protocol/adb.h
parent9410b15ac98d0a67d7eb851c074078c75ac420f2 (diff)
downloadqmk_firmware-1b3504e3292db2074b83944c32b67a7c88bb4f51.tar.gz
qmk_firmware-1b3504e3292db2074b83944c32b67a7c88bb4f51.zip
Update ADB impelemtation in TMK Core (#11168)
* Update ADB impelmentation in tmk_core to recent version. Pcked from tmk_keyboard repository revision: 48d696443857512d45f9a7329e0dd0a76345860f * Restore convenient ADB functions used in QMK port. * Do cformat.
Diffstat (limited to 'tmk_core/protocol/adb.h')
-rw-r--r--tmk_core/protocol/adb.h58
1 files changed, 53 insertions, 5 deletions
diff --git a/tmk_core/protocol/adb.h b/tmk_core/protocol/adb.h
index 34cbcf769..fe8becc2d 100644
--- a/tmk_core/protocol/adb.h
+++ b/tmk_core/protocol/adb.h
@@ -1,5 +1,5 @@
1/* 1/*
2Copyright 2011 Jun WAKO <wakojun@gmail.com> 2Copyright 2011-19 Jun WAKO <wakojun@gmail.com>
3 3
4This software is licensed with a Modified BSD License. 4This software is licensed with a Modified BSD License.
5All of this is supposed to be Free Software, Open Source, DFSG-free, 5All of this is supposed to be Free Software, Open Source, DFSG-free,
@@ -47,12 +47,60 @@ POSSIBILITY OF SUCH DAMAGE.
47#define ADB_POWER 0x7F 47#define ADB_POWER 0x7F
48#define ADB_CAPS 0x39 48#define ADB_CAPS 0x39
49 49
50/* ADB commands */
51// Default Address
52#define ADB_ADDR_0 0
53#define ADB_ADDR_DONGLE 1
54#define ADB_ADDR_KEYBOARD 2
55#define ADB_ADDR_MOUSE 3
56#define ADB_ADDR_TABLET 4
57#define ADB_ADDR_APPLIANCE 7
58#define ADB_ADDR_8 8
59#define ADB_ADDR_9 9
60#define ADB_ADDR_10 10
61#define ADB_ADDR_11 11
62#define ADB_ADDR_12 12
63#define ADB_ADDR_13 13
64#define ADB_ADDR_14 14
65#define ADB_ADDR_15 15
66// for temporary purpose, do not use for polling
67#define ADB_ADDR_TMP 15
68#define ADB_ADDR_MOUSE_POLL 10
69// Command Type
70#define ADB_CMD_RESET 0
71#define ADB_CMD_FLUSH 1
72#define ADB_CMD_LISTEN 8
73#define ADB_CMD_TALK 12
74// Register
75#define ADB_REG_0 0
76#define ADB_REG_1 1
77#define ADB_REG_2 2
78#define ADB_REG_3 3
79
80/* ADB keyboard handler id */
81#define ADB_HANDLER_STD 0x01 /* IIGS, M0116 */
82#define ADB_HANDLER_AEK 0x02 /* M0115, M3501 */
83#define ADB_HANDLER_AEK_RMOD 0x03 /* M0115, M3501, alternate mode enableing right modifiers */
84#define ADB_HANDLER_STD_ISO 0x04 /* M0118, ISO swapping keys */
85#define ADB_HANDLER_AEK_ISO 0x05 /* M0115, M3501, ISO swapping keys */
86#define ADB_HANDLER_M1242_ANSI 0x10 /* Adjustable keyboard */
87#define ADB_HANDLER_CLASSIC1_MOUSE 0x01
88#define ADB_HANDLER_CLASSIC2_MOUSE 0x02
89#define ADB_HANDLER_EXTENDED_MOUSE 0x04
90#define ADB_HANDLER_TURBO_MOUSE 0x32
91
50// ADB host 92// ADB host
51void adb_host_init(void); 93void adb_host_init(void);
52bool adb_host_psw(void); 94bool adb_host_psw(void);
95uint16_t adb_host_talk(uint8_t addr, uint8_t reg);
96uint8_t adb_host_talk_buf(uint8_t addr, uint8_t reg, uint8_t *buf, uint8_t len);
97void adb_host_listen(uint8_t addr, uint8_t reg, uint8_t data_h, uint8_t data_l);
98void adb_host_listen_buf(uint8_t addr, uint8_t reg, uint8_t *buf, uint8_t len);
99void adb_host_flush(uint8_t addr);
100void adb_host_kbd_led(uint8_t led);
53uint16_t adb_host_kbd_recv(void); 101uint16_t adb_host_kbd_recv(void);
54uint16_t adb_host_mouse_recv(void); 102uint16_t adb_host_mouse_recv(void);
55void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l); 103
56void adb_host_kbd_led(uint8_t led); 104// ADB Mouse
57void adb_mouse_task(void); 105void adb_mouse_task(void);
58void adb_mouse_init(void); 106void adb_mouse_init(void);