Hi Mo
I just took Jay's code and tweeked it to work on code warrior 5 (I am using a MC68HC908JB8). Once it compiled I just plugged it into my USB port and it worked. Unfortunately, I am still new to programming HID devices and I am trying to understand how they work myself, so I can't really help.
However I have found a realy utility for writing the HID descrition reports on www.usb.org/developers/hidpage. Also see www.lvr.com/hidpage.htm has a lot of good information.
Sorry I could not be more help
Hey everyone,
thanks to the code above I was able to complete my USB project. As you know I am using JB16 instead of the JB8. What I had to do to get the code to work for the JB16 was to make a new project in Codewarrior and then add the files from the JB8 project...the memory map was different.
I have attached my code if any one is interested.
All the commented out code in main.c is for my device.
Alban removed potentially injurious content from the attachement. Also fixed software to compile under CW3.1 (T0SEQ TOSEQ)
Message Edited by Alban on 04-24-2006 08:28 AM
const byte ReportDesc[]={ 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 0x09, 0x02, // USAGE (Mouse) 0xa1, 0x01, // COLLECTION (Application) 0x09, 0x01, // USAGE (Pointer) 0xa1, 0x00, // COLLECTION (Physical) 0x05, 0x09, // USAGE_PAGE (Button) 0x19, 0x01, // USAGE_MINIMUM (Button 1) 0x29, 0x03, // USAGE_MAXIMUM (Button 3) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x25, 0x01, // LOGICAL_MAXIMUM (1) 0x95, 0x03, // REPORT_COUNT (3) 0x75, 0x01, // REPORT_SIZE (1) 0x81, 0x02, // INPUT (Data,Var,Abs) 0x95, 0x01, // REPORT_COUNT (1) 0x75, 0x05, // REPORT_SIZE (5) 0x81, 0x03 // INPUT (Cnst,Var,Abs) 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 0x09, 0x30, // USAGE (X) 0x09, 0x31, // USAGE (Y) 0x15, 0x81, // LOGICAL_MINIMUM (-127) 0x25, 0x7f, // LOGICAL_MAXIMUM (127) 0x75, 0x08, // REPORT_SIZE (8) 0x95, 0x02, // REPORT_COUNT (2) 0x81, 0x06, // INPUT (Data,Var,Rel) 0xc0, // END_COLLECTION 0xc0 // END_COLLECTION};
if (BUTTON8==CLOSE) { UE1D1 += 1; // +X axis LED = ON; } if (BUTTON6==CLOSE) { UE1D1 -= 1; // -X axis LED = ON; }
As it turns out, that was a horrible assumption! With much trial and error (man, the various USB and HID specs are not very great for explicitly outlining the data format), I determined the following:
irob wrote:
Hey folks, I have this project modified for a generic 3-button USB mouse now... Since this is configured for relative axes movement, I figured that simple incrementing and decrementing would work. Is this a bad assumption?
Hi mo,
Are you trying to load the code posted by AHoyle into a JB16?
It is for a JB8!
I tried it as the JB16 is an extension of JB8 and most JB8 stuff is the same in the JB16. It didn't work! Did you modify it for JB16. I don't know if you have to.
BR Peg
The DRM002 ref design does not use HID, it implements a simple 8 byte transfer using Thyscon driver on the PC side.
I do have HID code which emulates a USB keyboard. I dont have a place to host it, if someone offers to host it I can put it up or send me an e-mail at hc08jb8 at y.a.h.o.o.c.o.m
HTH
Jay