RA Flexible Software Package Documentation
Release v5.6.0
|
|
This module is USB Peripheral Human Interface Device Class Driver (PHID). It implements the USB PHID Interface.
Refer to USB (r_usb_basic) for the common API (r_usb_basic) to be called from the application.
The r_usb_phid module combines with the r_usb_basic module to provide a USB Peripheral Human Interface Device Class (PHID) driver. The PHID driver conforms to the USB Human Interface Device class specifications and implements communication with a HID host.
The r_usb_phid module has the following functions:
Configuration | Options | Default | Description |
---|---|---|---|
Interrupt In Pipe |
| USB PIPE6 | Select the pipe number for input interrupt events. |
Interrupt Out Pipe |
| USB PIPE7 | Select the pipe number for output interrupt events. |
Configuration | Options | Default | Description |
---|---|---|---|
Name | Name must be a valid C symbol | g_phid0 | Module name. |
Refer to the USB (r_usb_basic) module.
Refer to the USB (r_usb_basic) module.
This driver notifies the application when receiving the following class requests:
Request | Code | Description |
---|---|---|
Get_Report | 0x01 | Receives a report from the HID host |
Set_Report | 0x09 | Sends a report to the HID host |
Get_Idle | 0x02 | Receives a duration (time) from the HID host |
Set_Idle | 0x0A | Sends a duration (time) to the HID host |
Get_Protocol | 0x03 | Reads a protocol from the HID host |
Set_Protocol | 0x0B | Sends a protocol to the HID host |
Get_Descriptor | 0x06 | Transmits a report or HID descriptor |
The data format of supported class requests is described below:
bmRequestType | bRequest | wValue | wIndex | wLength | Data |
---|---|---|---|---|---|
0xA1 | GET_REPORT (0x01) | ReportType & ReportID | Interface | ReportLength | Report |
0x21 | SET_REPORT (0x09) | ReportType & ReportID | Interface | ReportLength | Report |
0xA1 | GET_IDLE (0x02) | 0 & ReportID | Interface | 1 | Idle rate |
0x21 | SET_IDLE (0x0A) | Duration & ReportID | Interface | 0 | Idle rate |
0xA1 | GET_PROTOCOL (0x03) | 0 | Interface | 0 | 0 (Boot) or 1 (Report) |
0x21 | SET_PROTOCOL (0x0B) | 0 (Boot) or 1 (Report) | Interface | 0 | Not applicable |
This is a minimal example for implementing PHID in a non-RTOS application.
This is a minimal example for implementing PHID in an RTOS application.
A template for PHID descriptors can be found in ra/fsp/src/r_usb_phid. Be sure to replace the vendor ID with your own.
Keyboard templates should be referred to r_usb_phid_descriptor_keyboard.c.template.
Mouse templates should be referred to r_usb_phid_descriptor_mouse.c.template.