![]() |
RA Flexible Software Package Documentation
Release v6.4.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:
| Device Group | Devices |
|---|---|
| RA2 | RA2A1, RA2L2 |
| RA4 | RA4E1, RA4E2, RA4L1, RA4M1, RA4M2, RA4M3, RA4W1 |
| RA6 | RA6E1, RA6E2, RA6M1, RA6M2, RA6M3, RA6M4, RA6M5, RA6T3 |
| RA8 | RA8D1, RA8D2, RA8E1, RA8E2, RA8M1, RA8M2, RA8P1, RA8T1, RA8T2 |
| Configuration | Options | Default | Description |
|---|
| 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.