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 | 4d116a04e94cf0d19317d5b44e4fa9f34a3e5594 (patch) | |
tree | 3a2c044bec35111604aedfd024ab2689b3f40c7c /protocol/adb.c | |
parent | 1fe4406f374291ab2e86e95a97341fd9c475fcb8 (diff) | |
download | firmware-4d116a04e94cf0d19317d5b44e4fa9f34a3e5594.tar.gz firmware-4d116a04e94cf0d19317d5b44e4fa9f34a3e5594.tar.bz2 firmware-4d116a04e94cf0d19317d5b44e4fa9f34a3e5594.zip |
Squashed 'tmk_core/' changes from b9e0ea0..caca2c0
caca2c0 Add mouse support to ADB
5b0835a Merge commit '1fe4406f374291ab2e86e95a97341fd9c475fcb8'
f2f7556 Remove unneeded tap delays #201
8124195 Fix URL of HID Usage Tables pdf
0bb4679 Fix typo of doc/keycode.txt
b24fa1a Fix handling of consumer usage #199
6ae1a3d Improve anti-ghosting behavior for fast typing
a4c9763 Fix dfu-programmer parameters
b62b3f2 Move ring_buffer.h file
6ec424f Fix debug print
502fb0c Fix ibm4704 protocol with using interrupt
git-subtree-dir: tmk_core
git-subtree-split: caca2c01553394d959550034c817520d575c7fa0
Diffstat (limited to 'protocol/adb.c')
-rw-r--r-- | protocol/adb.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/protocol/adb.c b/protocol/adb.c index bbff66df0..5c6c99b4f 100644 --- a/protocol/adb.c +++ b/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(); |