Hi,
I've been try to modify USB_HID lpc23xx code to keyboard. and I aleady read this forum. www.cygnal.org/.../001381.html
and I already modify usbdesc.c for keyboard. Now PC can see my lpc2368 board as HID_KEYBOARD. But I can't send data to PC, so can you told how to midify code for send keyboard data from my board to PC.
Thanks,
Nuttawit
Hi Tsuneo,
By your instruction I already modify my source code. Please see modify function below.
usbuser.c
void USB_Configure_Event (void) { int i; if (USB_Configuration) { /* Check if USB is configured */ for (i=0; i<8; i++) KeyReport[i] = 0; USB_WriteEP(0x81, KeyReport, sizeof(KeyReport)); } } void USB_EndPoint1 (DWORD event) { int i; if (KeyPress) saystr ("USB_ENDPoint1\n\r"); switch (event) { case USB_EVT_IN : KeyScan (); USB_WriteEP(0x81, KeyReport, sizeof(KeyReport)); if (KeyPress) // for debug on console { for (i=0; i<8; i++) { sayhex (KeyReport[i]); saystr (" "); } saystr ("\n\r"); KeyPress = FALSE; } break; } }
Output on hyperterminal is : USB_ENDPoint1 00 00 04 00 00 00 00 00
but notthing put on notepad. So my test solution is correct or not?
and KeyScan function is :
void KeyScan (void) { switch (Key) { case 'a' : KeyReport[2] = 4; break; case '1' : KeyReport[2] = 30; break; } }
Key is gobal variable when I push button.
and I wonder about GetInReport (), I set KeyPress = TRUE when I push button.
void GetInReport (void) { InReport = 0x00; /* Default All Input */ if (KeyPress == TRUE) { InReport = 0x01; } else { InReport = 0x00; } }
Thanks you,
Hi Tsuaneo,
Now I just fixed this problem already. Cause by my setting HID_ReportDescriptor mistake.
I debug by SourceUSB program , and setting HID_ReportDescriptor by HID descriptor tool , both program I get from your suggestion on keil forum :-).
Thankyou very much for you help me in this forum and another forum that useful to fixed USB development problem.
Happy new years,