Wixel SDK
Data Structures | Typedefs | Functions | Variables
usb_hid.h File Reference
#include "usb_hid_constants.h"
#include <cc2511_types.h>

Go to the source code of this file.

Data Structures

struct  HID_KEYBOARD_OUT_REPORT
 
struct  HID_KEYBOARD_IN_REPORT
 
struct  HID_MOUSE_IN_REPORT
 
struct  HID_JOYSTICK_IN_REPORT
 

Typedefs

typedef struct HID_KEYBOARD_OUT_REPORT HID_KEYBOARD_OUT_REPORT
 
typedef struct HID_KEYBOARD_IN_REPORT HID_KEYBOARD_IN_REPORT
 
typedef struct HID_MOUSE_IN_REPORT HID_MOUSE_IN_REPORT
 
typedef struct HID_JOYSTICK_IN_REPORT HID_JOYSTICK_IN_REPORT
 

Functions

void usbHidService (void)
 
uint8 usbHidKeyCodeFromAsciiChar (char asciiChar)
 

Variables

HID_KEYBOARD_OUT_REPORT XDATA usbHidKeyboardOutput
 
HID_KEYBOARD_IN_REPORT XDATA usbHidKeyboardInput
 
HID_MOUSE_IN_REPORT XDATA usbHidMouseInput
 
HID_JOYSTICK_IN_REPORT XDATA usbHidJoystickInput
 
BIT usbHidKeyboardInputUpdated
 
BIT usbHidMouseInputUpdated
 
BIT usbHidJoystickInputUpdated
 

Detailed Description

The usb_hid.lib library implements a composite USB device containing a keyboard interface and a mouse interface using the Human Interface Device (HID) class.

You can find the specification of the USB HID device class in HID1_11.pdf, available for download from USB Implementers Forum at this url: http://www.usb.org/developers/hidpage

A complete list of Usage tags used in HID reports, which define the format of the input and output data used by this library, can be found in Hut1_12.pdf on the same page.

(A listing of all class specification documents is at http://www.usb.org/devclass_docs)

Definition in file usb_hid.h.

Function Documentation

uint8 usbHidKeyCodeFromAsciiChar ( char  asciiChar)

Converts an ASCII-encoded character into the corresponding HID Key Code, suitable for the keyCodes array in HID_KEYBOARD_IN_REPORT. Note that many pairs of ASCII characters map to the same key code because they are on the same key. For example, both '4' and '$' map to 0x21 (KEY_4). To send a dollar sign to the computer, you must set the shift bit of the modifiers byte in the HID_KEYBOARD_IN_REPORT.

Definition at line 731 of file usb_hid.c.

void usbHidService ( void  )

This must be called regularly if you are implementing an HID device.

Definition at line 555 of file usb_hid.c.

Variable Documentation

HID_JOYSTICK_IN_REPORT XDATA usbHidJoystickInput

Contains input data sent in HID reports from the device's joystick interface to the host. You can use this variable to send joystick position and button data to the USB host. After writing data to this variable, set usbHidJoystickInputUpdated to 1 to tell the HID library to send that data to the computer.

Definition at line 377 of file usb_hid.c.

BIT usbHidJoystickInputUpdated

After writing data to usbHidJoystickInput, set this bit to 1 to trigger an HID report to be sent from the joystick interface to the host. This bit is cleared by the library once the report is sent.

Definition at line 381 of file usb_hid.c.

HID_KEYBOARD_IN_REPORT XDATA usbHidKeyboardInput

Contains input data to be sent from the keyboard interface to the host. You can use this variable to send key presses to the computer. After writing data to this struct, set usbHidKeyboardInputUpdated to 1 to tell the HID library to send that data to the computer. See HID_KEYBOARD_IN_REPORT for details.

Definition at line 375 of file usb_hid.c.

BIT usbHidKeyboardInputUpdated

After writing data to usbHidKeyboardInput, set this bit to 1 to trigger an HID report to be sent from the keyboard interface to the host. This bit is cleared by the library once the report is sent.

Definition at line 379 of file usb_hid.c.

HID_KEYBOARD_OUT_REPORT XDATA usbHidKeyboardOutput

Contains output data received by the keyboard interface from the host. If the Wixel is connected to a Windows machine, you can use this variable to determine whether the Caps Lock, Num Lock, or Scroll Lock options are active. This might not work on Linux or Mac OS computers. See HID_KEYBOARD_OUT_REPORT for details.

Definition at line 374 of file usb_hid.c.

HID_MOUSE_IN_REPORT XDATA usbHidMouseInput

Contains input data to be sent from the mouse interface to the host. You can use this variable to send X, Y and mouse wheel position changes to the computer and report the state of the mouse buttons. After writing data to this variable, set usbHidMouseInputUpdated to 1 to tell the HID library to send that data to the computer. See HID_MOUSE_IN_REPORT for details.

Definition at line 376 of file usb_hid.c.

BIT usbHidMouseInputUpdated

After writing data to usbHidMouseInput, set this bit to 1 to trigger an HID report to be sent from the mouse interface to the host. This bit is cleared by the library once the report is sent.

Definition at line 380 of file usb_hid.c.