<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>LPC2368 HID Keyboard</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/24504/lpc2368-hid-keyboard</link><description> 
Hi, 

 
I&amp;#39;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&amp;#39;t send data</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: LPC2368 HID Keyboard</title><link>https://community.arm.com/thread/101499?ContentTypeID=1</link><pubDate>Fri, 26 Dec 2008 02:05:26 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c18ec0b2-2888-429e-aea4-7a37c03d93e3</guid><dc:creator>Nuttawit Rittichok</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Tsuaneo,&lt;/p&gt;

&lt;p&gt;
Now I just fixed this problem already. Cause by my setting
&lt;i&gt;HID_ReportDescriptor&lt;/i&gt; mistake.&lt;/p&gt;

&lt;p&gt;
I debug by SourceUSB program , and setting
&lt;i&gt;HID_ReportDescriptor&lt;/i&gt; by HID descriptor tool , both program I
get from your suggestion on keil forum :-).&lt;/p&gt;

&lt;p&gt;
Thankyou very much for you help me in this forum and another forum
that useful to fixed USB development problem.&lt;/p&gt;

&lt;p&gt;
Happy new years,&lt;/p&gt;

&lt;p&gt;
Nuttawit&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LPC2368 HID Keyboard</title><link>https://community.arm.com/thread/77014?ContentTypeID=1</link><pubDate>Thu, 25 Dec 2008 01:18:01 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7bd1e6ab-e7cd-4cfa-b11b-3c5fb10d7c2e</guid><dc:creator>Nuttawit Rittichok</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Tsuneo,&lt;/p&gt;

&lt;p&gt;
By your instruction I already modify my source code.&lt;br /&gt;
Please see modify function below.&lt;/p&gt;

&lt;p&gt;
usbuser.c&lt;/p&gt;

&lt;pre&gt;
void USB_Configure_Event (void) {
  int i;
  if (USB_Configuration)
  {                  /* Check if USB is configured */
        for (i=0; i&amp;lt;8; i++)
                KeyReport[i] = 0;
    USB_WriteEP(0x81, KeyReport, sizeof(KeyReport));
  }
}

void USB_EndPoint1 (DWORD event) {
  int i;
  if (KeyPress)
        saystr (&amp;quot;USB_ENDPoint1\n\r&amp;quot;);
  switch (event) {
    case USB_EVT_IN :
          KeyScan ();
      USB_WriteEP(0x81, KeyReport, sizeof(KeyReport));
      if (KeyPress) // for debug on console
          {
            for (i=0; i&amp;lt;8; i++)
                {
                  sayhex (KeyReport[i]);
                  saystr (&amp;quot; &amp;quot;);
                }
                saystr (&amp;quot;\n\r&amp;quot;);
                KeyPress = FALSE;
          }
          break;
  }
}
&lt;/pre&gt;

&lt;p&gt;
Output on hyperterminal is :&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
USB_ENDPoint1&lt;br /&gt;
00 00 04 00 00 00 00 00&lt;br /&gt;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
but notthing put on notepad. So my test solution is correct or
not?&lt;/p&gt;

&lt;p&gt;
and KeyScan function is :&lt;/p&gt;

&lt;pre&gt;
void KeyScan (void)
{
  switch (Key)
  {
         case &amp;#39;a&amp;#39; :
           KeyReport[2] = 4;
           break;
         case &amp;#39;1&amp;#39; :
           KeyReport[2] = 30;
           break;
  }

}
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
Key is gobal variable when I push button.&lt;/p&gt;

&lt;p&gt;
and I wonder about GetInReport (), I set KeyPress = TRUE when I
push button.&lt;/p&gt;

&lt;pre&gt;
void GetInReport (void)
{
  InReport = 0x00;      /* Default All Input */

  if (KeyPress == TRUE)
  {
    InReport = 0x01;
  }
  else
  {
    InReport = 0x00;
  }
}
&lt;/pre&gt;

&lt;p&gt;
Thanks you,&lt;/p&gt;

&lt;p&gt;
Nuttawit&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LPC2368 HID Keyboard</title><link>https://community.arm.com/thread/53165?ContentTypeID=1</link><pubDate>Wed, 24 Dec 2008 09:42:30 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:879883a4-5181-4270-97ae-9192b6bd2904</guid><dc:creator>Tsuneo Chinzei</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanks to referring my post for SiLabs forum&lt;br /&gt;
It&amp;#39;s somewhat weird to answer to it on Keil forum :-)&lt;/p&gt;

&lt;p&gt;
Is this the base example?&lt;/p&gt;

&lt;p&gt;
&amp;quot;LPC2368 / LPC2378 USB HID (Human Interface Device) Example&amp;quot; on
KEIL&lt;br /&gt;
&lt;a href="http://www.keil.com/download/docs/335.asp"&gt;http://www.keil.com/download/docs/335.asp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
I explain about a simple implementation, for first try.&lt;br /&gt;
In this snippet, the device sends key input reports every time the
endpoint interrupt occurs. The rate of report transmission is
determined by the bInterval field (ms) of the endpoint descriptor of
the interrupt IN. That is, the key scan rate also matches to this
rate.&lt;/p&gt;

&lt;p&gt;
a) In the Set_Configuration callback, put the first dummy report
to the interrupt IN endpoint.&lt;br /&gt;
It triggers the interrupt sequence.&lt;/p&gt;

&lt;pre&gt;
usbuser.c

#include &amp;lt;string.h&amp;gt;
#define KEYREPORT_SIZE    8
BYTE keyReport[ KEYREPORT_SIZE ];

/*
 *  USB Set Configuration Event Callback
 *   Called automatically on USB Set Configuration Request
 */

#if USB_CONFIGURE_EVENT
void USB_Configure_Event (void) {

  if (USB_Configuration) {                  /* Check if USB is configured */
&lt;b&gt;    memset( keyReport, 0, sizeof(keyReport) );        // clear out the input report
    USB_WriteEP(0x81, keyReport, sizeof(keyReport));  // send it to trigger interrupt sequence&lt;/b&gt;
  }
}
#endif
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
b) In the endpoint ISR, scan the keys and put the keycode to the
report.&lt;br /&gt;
And put the report to the IN endpoint.&lt;br /&gt;
Write your own KeyScan() routine :-)&lt;/p&gt;

&lt;pre&gt;
usbuser.c

/*
 *  USB Endpoint 1 Event Callback
 *   Called automatically on USB Endpoint 1 Event
 *    Parameter:       event
 */

void USB_EndPoint1 (DWORD event) {

  switch (event) {
    case USB_EVT_IN:
&lt;b&gt;      KeyScan();
      USB_WriteEP(0x81, keyReport, sizeof(keyReport));&lt;/b&gt;
      break;
  }
}
&lt;/pre&gt;

&lt;p&gt;
In the KeyScan(), you don&amp;#39;t need to consider make/break of keys -
it is handled by the host side. Just put the keycode(s) to the
keycode array on the report, for the key(s) currently pushed down.
The keycode array can hold up to 6 keys - 6 key rollover. When more
than 6 keys are pushed simultaneously, fill the keycode array with
ErrorRollOver (0x01) When no key is pushed, clear the array with
0.&lt;/p&gt;

&lt;pre&gt;
Report format

keyReport
 byte
  0   Modifier byte
  1   reserved - 0
  2   keycode array [0]
  3   keycode array [1]
  4   keycode array [2]
  5   keycode array [3]
  6   keycode array [4]
  7   keycode array [5]

The bitmap of Modifier byte
 bit
  0   LEFT CTRL
  1   LEFT SHIFT
  2   LEFT ALT
  3   LEFT GUI
  4   RIGHT CTRL
  5   RIGHT SHIFT
  6   RIGHT ALT
  7   RIGHT GUI
&lt;/pre&gt;

&lt;p&gt;
The keycodes are defined in this spec&lt;/p&gt;

&lt;p&gt;
HID Usage Table 1.12&lt;br /&gt;
&lt;a href="http://www.usb.org/developers/devclass_docs/Hut1_12.pdf"&gt;www.usb.org/.../Hut1_12.pdf&lt;/a&gt;&lt;br /&gt;

10 Keyboard/Keypad Page (0x07) (Hut1_12.pdf p54)&lt;/p&gt;

&lt;p&gt;
When you succeed this try, the next step is,&lt;br /&gt;
- send the key report just when key make/break occurs (Windows
default)&lt;br /&gt;
- support output report for LED indicators - CAPS, Num lock etc.&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>