From 06db39583fe87a8d13c0c345887b71a577198049 Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 13 Jan 2011 22:46:57 +0900 Subject: ADB keyboard LEDs support --- adb.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'adb.c') diff --git a/adb.c b/adb.c index e66a501b7c..6848fa652b 100644 --- a/adb.c +++ b/adb.c @@ -42,9 +42,9 @@ uint16_t adb_host_kbd_recv(void) { uint16_t data = 0; attention(); - send_byte(0x2C); // Addr:2, Cmd:talk(11), Reg:0(00) - place_bit0(); // Stopbit - if (!wait_data_lo(0xFF)) // Stop to Start(140-260us) + send_byte(0x2C); // Addr:Keyboard(0010), Cmd:Talk(11), Register0(00) + place_bit0(); // Stopbit(0) + if (!wait_data_lo(0xFF)) // Tlt/Stop to Start(140-260us) return 0; // No data to send if (!read_bit()) // Startbit(1) return -2; @@ -55,6 +55,19 @@ uint16_t adb_host_kbd_recv(void) return data; } +// send state of LEDs +void adb_host_kbd_led(uint8_t led) +{ + attention(); + send_byte(0x2A); // Addr:Keyboard(0010), Cmd:Listen(10), Register2(10) + place_bit0(); // Stopbit(0) + _delay_us(200); // Tlt/Stop to Start + place_bit1(); // Startbit(1) + send_byte(0); // send upper byte (not used) + send_byte(led&0x07); // send lower byte (bit2: ScrollLock, bit1: CapsLock, bit0: NumLock) + place_bit0(); // Stopbit(0); +} + static inline void data_lo() { -- cgit v1.2.3