[Submission] Proper Simple 64 Byte Hid Demo

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[Submission] Proper Simple 64 Byte Hid Demo

644 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by behzat_c on Fri Jul 01 00:32:18 MST 2011
Hi!

I've managed to write/edit a proper simple hid demo.

It uses Endpoint0 for Computer to Device transfers, and Endpoint1 for Device to Computer transfer.

Main code is so simple and clean. You can see below.

Please inform me, if there is any bug in there!

And also, i couldn't manage to change the way the device is seen by computer. :confused: I wanted it to seem like "Generic Hid Device" but it appears as "Hid-compliant game controller". I will be appreaciate if you know how could i do this!

Thanks.

#ifdef __USE_CMSIS
#include "LPC17xx.h"
#endif

#include <cr_section_macros.h>
#include <NXP/crp.h>

// Variable to store CRP value in. Will be placed automatically
// by the linker when "Enable Code Read Protect" selected.
// See crp.h header for more information
__CRP const unsigned int CRP_WORD = CRP_NO_CRP ;

#include "string.h"
#include "usbapi.h"
#include "usbDescriptions.h"
#include "usbFunctions.h"

/*
 *  Read data from EP0 , send data to EP1
 *  - interrupt driven
 *  - program enters here only when data
 *  received from EP0
 */
void ProcessIO(U8 *receivedBuffer,U16 length)
{
int i;
for(i=0;i<length;i++)
sendBuffer=receivedBuffer+1;

USBHwEPWrite(INTR_IN_EP, sendBuffer, REPORT_SIZE);
}

int main(void) {

usbHidStart();

while(1)
{
// ...
}

return 0 ;
}
0 Kudos
Reply
1 Reply

632 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by behzat_c on Tue Jul 05 01:41:26 MST 2011
Haven't any anyone tried it yet_? :confused:
0 Kudos
Reply