Skip to content

Commit

Permalink
Restore convenient ADB functions used in QMK port.
Browse files Browse the repository at this point in the history
  • Loading branch information
siggie0815 committed Dec 9, 2020
1 parent 2613242 commit 24ea3ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 9 additions & 4 deletions tmk_core/protocol/adb.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ bool adb_host_psw(void)
* <http://geekhack.org/index.php?topic=14290.msg1068919#msg1068919>
* <http://geekhack.org/index.php?topic=14290.msg1070139#msg1070139>
*/
uint16_t adb_host_kbd_recv(uint8_t addr)
uint16_t adb_host_kbd_recv(void)
{
return adb_host_talk(addr, ADB_REG_0);
return adb_host_talk(ADB_ADDR_KEYBOARD, ADB_REG_0);
}

#ifdef ADB_MOUSE_ENABLE
Expand All @@ -102,6 +102,11 @@ __attribute__ ((weak))
void adb_mouse_task(void) {
return;
}

uint16_t adb_host_mouse_recv(void)
{
return adb_host_talk(ADB_ADDR_MOUSE, ADB_REG_0);
}
#endif

// This sends Talk command to read data from register and returns length of the data.
Expand Down Expand Up @@ -255,12 +260,12 @@ void adb_host_flush(uint8_t addr)
}

// send state of LEDs
void adb_host_kbd_led(uint8_t addr, uint8_t led)
void adb_host_kbd_led(uint8_t led)
{
// Listen Register2
// upper byte: not used
// lower byte: bit2=ScrollLock, bit1=CapsLock, bit0=NumLock
adb_host_listen(addr, 2, 0, led & 0x07);
adb_host_listen(ADB_ADDR_KEYBOARD, ADB_REG_2, 0, led & 0x07);
}


Expand Down
6 changes: 4 additions & 2 deletions tmk_core/protocol/adb.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,15 @@ POSSIBILITY OF SUCH DAMAGE.
// ADB host
void adb_host_init(void);
bool adb_host_psw(void);
uint16_t adb_host_kbd_recv(uint8_t addr);
uint16_t adb_host_talk(uint8_t addr, uint8_t reg);
uint8_t adb_host_talk_buf(uint8_t addr, uint8_t reg, uint8_t *buf, uint8_t len);
void adb_host_listen(uint8_t addr, uint8_t reg, uint8_t data_h, uint8_t data_l);
void adb_host_listen_buf(uint8_t addr, uint8_t reg, uint8_t *buf, uint8_t len);
void adb_host_flush(uint8_t addr);
void adb_host_kbd_led(uint8_t addr, uint8_t led);
void adb_host_kbd_led(uint8_t led);
uint16_t adb_host_kbd_recv(void);
uint16_t adb_host_mouse_recv(void);
// ADB Mouse
void adb_mouse_task(void);
void adb_mouse_init(void);

Expand Down

0 comments on commit 24ea3ac

Please sign in to comment.