Implements a USB HID class keyboard.
The source code of the HIDKBD implementation resides in kits/common/drivers/hidkbd.c and hidkbd.h. This driver implements a basic USB keyboard. Refer to hidkbd examples for STK3700 and DK3750 for examples using this driver.
This section contains a description of the configuration options for the driver. The options are #define's which are expected to be found in the application "usbconfig.h" header file. The values shown below are from the Giant Gecko STK3700 hidbkd example.
// USB interface number. Interfaces are numbered from zero to one less than // the number of concurrent interfaces supported by the configuration. // The interfac numbers must be 0 standalone HID device, for a // composite device which includes a HID interface it must not be in conflict // with other device interfaces. #define HIDKBD_INTERFACE_NO 0 // Endpoint address for HID input reports. #define HIDKBD_INTR_IN_EP_ADDR 0x81 // The bInterval reported with the interrupt IN endpoint descriptor. #define HIDKBD_POLL_RATE 24 // Timer id, see USBTIMER in the USB device stack documentation. // The HID driver use a timer to implement the idle-rate defined in the HID class spec. #define HIDKBD_IDLE_TIMER 0
|typedef void(*||HIDKBD_SetReportFunc_t) (uint8_t report)|
|Callback function pointer for HID output reports. This function will be called by the driver each time an output report is received by the device. |
|void||HIDKBD_Init (HIDKBD_Init_t *init)|
|Initialize HID Keyboard driver. |
|void||HIDKBD_KeyboardEvent (HIDKBD_KeyReport_t *report)|
|Report a keyboard press/release event. |
|int||HIDKBD_SetupCmd (const USB_Setup_TypeDef *setup)|
|Handle USB setup commands. Implements HID class specific commands. This function must be called each time the device receive a setup command. |
|void||HIDKBD_StateChangeEvent (USBD_State_TypeDef oldState, USBD_State_TypeDef newState)|
|Handle USB state change events, this function must be called each time the USB device state is changed. |
|const char||HIDKBD_ReportDescriptor |
|typedef void(* HIDKBD_SetReportFunc_t) (uint8_t report)|
Callback function pointer for HID output reports. This function will be called by the driver each time an output report is received by the device.
Output report byte.
Bit 0 : State of keyboard NumLock LED.
Bit 1 : State of keyboard CapsLock LED.
Bit 2 : State of keyboard ScrollLock LED.
Definition at line
57 of file
|void HIDKBD_Init||(||HIDKBD_Init_t *||)|
|void HIDKBD_KeyboardEvent||(||HIDKBD_KeyReport_t *||)|
|int HIDKBD_SetupCmd||(||const USB_Setup_TypeDef *||)|
Handle USB setup commands. Implements HID class specific commands. This function must be called each time the device receive a setup command.
Pointer to the setup packet received.
- USB_STATUS_OK if command accepted, USB_STATUS_REQ_UNHANDLED when command is unknown. In the latter case the USB device stack will handle the request.
Definition at line
229 of file
References USB_Setup_TypeDef::bRequest, USB_Setup_TypeDef::Direction, GET_DESCRIPTOR, USB_Setup_TypeDef::Recipient, SL_MIN, STATIC_UBUF, USB_Setup_TypeDef::Type, USB_HID_DESCRIPTOR, USB_HID_DESCSIZE, USB_HID_GET_IDLE, USB_HID_GET_REPORT, USB_HID_REPORT_DESCRIPTOR, USB_HID_SET_IDLE, USB_HID_SET_REPORT, USB_SETUP_DIR_IN, USB_SETUP_RECIPIENT_INTERFACE, USB_SETUP_TYPE_CLASS, USB_SETUP_TYPE_STANDARD, USB_STATUS_OK, USB_STATUS_REQ_UNHANDLED, USBD_Read(), USBD_Write(), USBTIMER_Stop(), USB_Setup_TypeDef::wIndex, USB_Setup_TypeDef::wLength, and USB_Setup_TypeDef::wValue.
Handle USB state change events, this function must be called each time the USB device state is changed.
The device state the device has just left. [in]
The new device state.
Definition at line
326 of file