
Chapter 4 Software Development
4-2-6. Creating USB Mouse Demo
The next stage involves modifying the sample program slightly so that the JOB60851 board emulates a USB mouse. Use the following steps to modify the source code and then recompile.
(1)Modifying source code
The file Include\Class.h under the work directory specifies as its default the device class BULK_IN_OUT_AND_INT. Comment out that #define and uncomment the HID_MOUSE_ONLY one.
/* | 1. Specify device class | */ |
| |
| #define | HID_MOUSE_ONLY |
| /* ← Enable this one */ |
/* | #define | BULK_AND_HID_MOUSE | */ |
|
/* | #define | HID_MOUSE_AND_BULK | */ |
|
/* | #define | BULK_IN_OUT_AND_INT | */ | /* ←Disable this default */ |
/* | #define | COMPLEX_ALTERNATE | */ |
|
/* | #define | PRINTER | */ |
|
/* | #define | ISO_TEST | */ |
|
(2)Compiling
The supplied make files and compiler do not check for dependencies on files in the include directory, so first clean the .HEX and .OBJ files from the work directory and then run the make utility.
n make clean <Enter> or maker clean <Enter>
nmake <Enter> or maker <Enter>
Successful compilation produces the file USB.HEX in the work directory. Check the link map file USB.M66 in the same directory for error messages from the linker.
(3)Setting up mouse demo
The sample mouse program emulates a USB mouse in response to commands received over a serial link to the JOB60851 board. It therefore requires connecting both the USB cable and, using the procedure in subsections
(4)Downloading program and installing mouse driver
To test USB.HEX, download it to the JOB60851 board and execute it there with the procedure in Section 2.3 "Running User Programs."
When the JOB60851 board connects the emulated USB mouse to the personal computer, Windows 98 automatically launches its driver wizard, so install the HID mouse driver from the
page