This example implements a USB Host that receives data from a USB Device (Keyboard) using HID: Human Interface Device Class.
The Standard I/O on the evaluation board (typically debugger Virtual COM) is used to show the keyboard inputs.
The following picture shows an exemplary connection of the development board, USB Keyboard and development computer.
The USB Host Keyboard project is available as part of the USB Host Reference examples.
Following files implement application-specific logic in the example:
Keyboard.c
: contains the application main thread which initializes the USB Host Component. It also reads the input from the attached keyboard and outputs it via the Standard I/O.Configuration files for the software components used in the project are available in the ./RTE/
directory and can be modified by users to adjust the operation of related components. Section RTE Components gives an overview about the components and their dependencies.
Following configuration files are provided with this example:
./RTE/USB/
folder:USBH_Config_HID.h
: USB Host HID Class configuration.USBH_Config_0.h
: USB Host Core configuration.USB_Debug.h
: USB Host Debug configuration../RTE/CMSIS/
folder:RTX_Config.h
and RTX_Config.c
: CMSIS-RTX Configuration files for the RTOS Kernel.When a board layer is added to the project, corresponding configuration files for the board and device components will become available in the local ./Board/
directory.
In order to build the project it shall be extended with a compatible board layer that provides following interfaces as connections:
CMSIS_USB_Host
: CMSIS-Driver for USB Host interface.Working with MDK-Middleware Examples explains the workflow for accessing, configuring and building an MDK-Middleware example project for your target hardware.
Board-specific hardware setup such as jumpers, USB ports, power supply, etc. is documented in the board layer description (README.md
) of your selected target.