In the example released today we will show the user how to create the simplest of USB projects. In this example we will be using the USB-HID driver provided on Windows, Linux and Mac machines.
In this example the CY8C24x93 device will enumerate using the HID driver and control the mouse on the user’s screen. The cursor will move around the screen in a square pattern.
For more information take a moment to review the earlier posts:
Forum Post Attachments:
At the bottom of this post we are including the following items:
- Example Project Zip File
- Project Images
User Modules Used:
The user can download the example project at the bottom of this post. The project uses the following list of Creator Components:
The main.c firmware is included in the example project. Please review the commented sections for more details.
In this project we will create a simple USB HID mouse which will move in a square pattern on the computer screen. The main.c source code includes both the mouse controls and the USB parameters initialization using the USBFS APIs. The key to the example is the usage of the USB wizard provided with the USBFS user module. To access the USB wizard navigate to the Chip Editor window and right click on the USBFS user module in the Workspace Explorer. Select the USB Setup Wizard to launch the configuration window.
The USB Setup Wizard provides users a graphical experience when setting up and configuring the USB device. Here the user is able to describe the device, set descriptors, and apply attributes to the device. When the features have been applied the user module will apply those changes. The user then generates their project to apply the settings and generate the APIs for the user module. For this example we have created a basic HID example for users to test and explore.
There are no hardware configurations for this example. All of the onboard connections have been made. The user will need to connect the PSoC 1 USB connector to the host computer after programming.
Test Your Project:
Build the project and program the PSoC 1 device using the program button in PSoC Designer, Program>Program Part. Once the device has been programmed change the USB connection to the PSoC 1 USB connector.
Once the device has connected the mouse cursor will begin to move in a square pattern around the PC screen. To stop the cursor control you can unplug the kit from the USB port.
I hope this example can help you in your design.