4.5USB Function
Hardware Setting
¾Check if 1,2 of
¾Check J701 (Short: 5V, Open: 3.3V)
¾Connect with PC via USB cable
Flowchart
The following flowchart illuminates the procedure to implement a USB mouse, it is not a certain flow of a function, but provides a clue to study and understand the sample code.
| Start |
|
|
Check ButtonInit(), | Button, USB core, | Bus reset |
|
HIDInit() |
| ||
HID initialization |
|
| |
|
|
| |
|
| Configure | Check |
|
| USB_2_IRQHandler() | |
|
| Endpoint | |
|
|
| |
Check | Check Ext INT7 |
|
|
EXTI8_15_IRQHandler() |
|
| |
occurred? | Get Device, HID |
| |
|
| ||
|
| description |
|
Device has been |
| Enable Endpoint 5 | Check |
| HidMouseSendReport() | ||
connected with |
| interrupt transfer | |
Initial Endpoint 0 |
| ||
Host |
|
| |
|
|
| |
|
| Use interrupt transfer to | Check |
|
| communicate with host | USB_1_IRQHandler() |
Figure
Usage
1)Make the hardware setting.
2)Watch the mouse moving when pressing “Up”, “Down”, “Left”, “Right” buttons.
18