4.6 USB Host
Hardware Setting
¾Check if 2,3 of
¾Connect with a USB mouse
Flowchart
The following flowchart illuminates the procedure to implement USB host function, which can catch the position of a USB mouse, it is not a certain flow of a function, but provides a clue to study and understand the sample code.
| Start |
|
|
SystemInit ( ) | Initialize system | Enumeration | USB_Handler ( ) |
| |||
| clock |
| |
|
|
| |
main ( ) | Initialize timer | Mouse data | USBF_Handler ( ) |
| process | ||
|
| get_mouse_data ( ) | |
|
|
| |
minihost_init( ) | Init USB host | Display mouse |
|
| data |
| |
|
|
| |
|
|
| Main() |
Figure
Usage
1)Make the hardware setting
2)Enable definition “Debug” in the code
3)Run the code.
4)Move the USB mouse, and watch the mouse position in the terminal IO window as following figure. (Debug viewer window in Keil IDE)
Figure
19