diff options
Diffstat (limited to 'protocol')
-rw-r--r-- | protocol/adb.c | 25 | ||||
-rw-r--r-- | protocol/adb.h | 1 | ||||
-rw-r--r-- | protocol/m0110.c | 2 | ||||
-rw-r--r-- | protocol/news.c | 8 | ||||
-rw-r--r-- | protocol/pjrc/main.c | 3 | ||||
-rw-r--r-- | protocol/pjrc/usb.c | 22 |
6 files changed, 37 insertions, 24 deletions
diff --git a/protocol/adb.c b/protocol/adb.c index d7105b3a9a..9e8d76832d 100644 --- a/protocol/adb.c +++ b/protocol/adb.c @@ -67,6 +67,12 @@ void adb_host_init(void) #ifdef ADB_PSW_BIT psw_hi(); #endif + + // Enable keyboard left/right modifier distinction + // Addr:Keyboard(0010), Cmd:Listen(10), Register3(11) + // upper byte: reserved bits 0000, device address 0010 + // lower byte: device handler 00000011 + adb_host_listen(0x2B,0x02,0x03); } #ifdef ADB_PSW_BIT @@ -98,19 +104,27 @@ uint16_t adb_host_kbd_recv(void) return data; } -// send state of LEDs -void adb_host_kbd_led(uint8_t led) +void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l) { attention(); - send_byte(0x2A); // Addr:Keyboard(0010), Cmd:Listen(10), Register2(10) + send_byte(cmd); 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) + send_byte(data_h); + send_byte(data_l); place_bit0(); // Stopbit(0); } +// send state of LEDs +void adb_host_kbd_led(uint8_t led) +{ + // Addr:Keyboard(0010), Cmd:Listen(10), Register2(10) + // send upper byte (not used) + // send lower byte (bit2: ScrollLock, bit1: CapsLock, bit0: + adb_host_listen(0x2A,0,led&0x07); +} + static inline void data_lo() { @@ -250,6 +264,7 @@ ADB Keycode http://72.0.193.250/Documentation/macppc/adbkeycodes/ http://m0115.web.fc2.com/m0115.jpg [Inside Macintosh volume V, pages 191-192] + http://www.opensource.apple.com/source/IOHIDFamily/IOHIDFamily-421.18.3/IOHIDFamily/Cosmo_USB2ADB.c ADB Signaling http://kbdbabel.sourceforge.net/doc/kbd_signaling_pcxt_ps2_adb.pdf ADB Overview & History diff --git a/protocol/adb.h b/protocol/adb.h index 1e4ca40132..bfe598bbf1 100644 --- a/protocol/adb.h +++ b/protocol/adb.h @@ -56,6 +56,7 @@ POSSIBILITY OF SUCH DAMAGE. void adb_host_init(void); bool adb_host_psw(void); uint16_t adb_host_kbd_recv(void); +void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l); void adb_host_kbd_led(uint8_t led); #endif diff --git a/protocol/m0110.c b/protocol/m0110.c index a669c85a48..8bf7cfe4fe 100644 --- a/protocol/m0110.c +++ b/protocol/m0110.c @@ -321,7 +321,7 @@ static inline uint8_t instant(void) m0110_send(M0110_INSTANT); uint8_t data = m0110_recv(); if (data != M0110_NULL) { - phex(data); print(" "); + debug_hex(data); debug(" "); } return data; } diff --git a/protocol/news.c b/protocol/news.c index d18b996f49..00755a5e2e 100644 --- a/protocol/news.c +++ b/protocol/news.c @@ -99,11 +99,11 @@ Pinouts 2 BZ(Speaker) 3 Keyboard Data(from keyboard MCU TxD) 4 NC - 5 FG + 5 GND 6 Unknown Input(to keyboard MCU RxD via schmitt trigger) 7 Mouse Data(from Mouse Ext connector) 8 Unknown Input(to Keyboard MCU Input via diode and buffer) - 9 GND + 9 FG NOTE: Two LED on keyboard are controlled by pin 6,8? EIA 232 male connector from NWP-411A @@ -115,11 +115,11 @@ Pinouts 2 BZ(Speaker) 3 Keyboard Data(from keyboard MCU TxD) 4 NC - 5 FG + 5 GND 6 NC 7 Mouse Data(from Mouse Ext connector) 8 NC - 9 GND + 9 FG NOTE: These are just from my guess and not confirmed. diff --git a/protocol/pjrc/main.c b/protocol/pjrc/main.c index 9f664bc432..776bfee9d6 100644 --- a/protocol/pjrc/main.c +++ b/protocol/pjrc/main.c @@ -44,9 +44,6 @@ int main(void) { - DEBUG_LED_CONFIG; - DEBUG_LED_OFF; - // set for 16 MHz clock CPU_PRESCALE(0); diff --git a/protocol/pjrc/usb.c b/protocol/pjrc/usb.c index 89087218f3..f4c6f81f5c 100644 --- a/protocol/pjrc/usb.c +++ b/protocol/pjrc/usb.c @@ -128,7 +128,7 @@ static const uint8_t PROGMEM endpoint_config_table[] = { // spec and relevant portions of any USB class specifications! -static uint8_t PROGMEM device_descriptor[] = { +static const uint8_t PROGMEM device_descriptor[] = { 18, // bLength 1, // bDescriptorType 0x00, 0x02, // bcdUSB @@ -146,7 +146,7 @@ static uint8_t PROGMEM device_descriptor[] = { }; // Keyboard Protocol 1, HID 1.11 spec, Appendix B, page 59-60 -static uint8_t PROGMEM keyboard_hid_report_desc[] = { +static const uint8_t PROGMEM keyboard_hid_report_desc[] = { 0x05, 0x01, // Usage Page (Generic Desktop), 0x09, 0x06, // Usage (Keyboard), 0xA1, 0x01, // Collection (Application), @@ -181,7 +181,7 @@ static uint8_t PROGMEM keyboard_hid_report_desc[] = { 0xc0 // End Collection }; #ifdef NKRO_ENABLE -static uint8_t PROGMEM keyboard2_hid_report_desc[] = { +static const uint8_t PROGMEM keyboard2_hid_report_desc[] = { 0x05, 0x01, // Usage Page (Generic Desktop), 0x09, 0x06, // Usage (Keyboard), 0xA1, 0x01, // Collection (Application), @@ -222,7 +222,7 @@ static uint8_t PROGMEM keyboard2_hid_report_desc[] = { // http://www.microchip.com/forums/tm.aspx?high=&m=391435&mpage=1#391521 // http://www.keil.com/forum/15671/ // http://www.microsoft.com/whdc/device/input/wheel.mspx -static uint8_t PROGMEM mouse_hid_report_desc[] = { +static const uint8_t PROGMEM mouse_hid_report_desc[] = { /* mouse */ 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 0x09, 0x02, // USAGE (Mouse) @@ -273,7 +273,7 @@ static uint8_t PROGMEM mouse_hid_report_desc[] = { }; #endif -static uint8_t PROGMEM debug_hid_report_desc[] = { +static const uint8_t PROGMEM debug_hid_report_desc[] = { 0x06, 0x31, 0xFF, // Usage Page 0xFF31 (vendor defined) 0x09, 0x74, // Usage 0x74 0xA1, 0x53, // Collection 0x53 @@ -289,7 +289,7 @@ static uint8_t PROGMEM debug_hid_report_desc[] = { #ifdef EXTRAKEY_ENABLE // audio controls & system controls // http://www.microsoft.com/whdc/archive/w2kbd.mspx -static uint8_t PROGMEM extra_hid_report_desc[] = { +static const uint8_t PROGMEM extra_hid_report_desc[] = { /* system control */ 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 0x09, 0x80, // USAGE (System Control) @@ -348,7 +348,7 @@ static uint8_t PROGMEM extra_hid_report_desc[] = { #define NUM_INTERFACES (KBD2_HID_DESC_NUM + 1) #define CONFIG1_DESC_SIZE (9+(9+9+7)*NUM_INTERFACES) -static uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = { +static const uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = { // configuration descriptor, USB spec 9.6.3, page 264-266, Table 9-10 9, // bLength; 2, // bDescriptorType; @@ -515,17 +515,17 @@ struct usb_string_descriptor_struct { uint8_t bDescriptorType; int16_t wString[]; }; -static struct usb_string_descriptor_struct PROGMEM string0 = { +static const struct usb_string_descriptor_struct PROGMEM string0 = { 4, 3, {0x0409} }; -static struct usb_string_descriptor_struct PROGMEM string1 = { +static const struct usb_string_descriptor_struct PROGMEM string1 = { sizeof(STR_MANUFACTURER), 3, STR_MANUFACTURER }; -static struct usb_string_descriptor_struct PROGMEM string2 = { +static const struct usb_string_descriptor_struct PROGMEM string2 = { sizeof(STR_PRODUCT), 3, STR_PRODUCT @@ -533,7 +533,7 @@ static struct usb_string_descriptor_struct PROGMEM string2 = { // This table defines which descriptor data is sent for each specific // request from the host (in wValue and wIndex). -static struct descriptor_list_struct { +static const struct descriptor_list_struct { uint16_t wValue; // descriptor type uint16_t wIndex; const uint8_t *addr; |