summaryrefslogtreecommitdiff
path: root/adb.c
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2011-01-13 22:46:57 +0900
committertmk <nobody@nowhere>2011-01-13 22:46:57 +0900
commit06db39583fe87a8d13c0c345887b71a577198049 (patch)
treeab0b5d0c879f9c0faa8e8380e6ddd19ee3e6acaf /adb.c
parent40c24dc89ad3cbcd8bf49d305c08096f198cce95 (diff)
ADB keyboard LEDs support
Diffstat (limited to 'adb.c')
-rw-r--r--adb.c19
1 files changed, 16 insertions, 3 deletions
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()
{