Data Structures | Macros | Typedefs | Functions
hid_engine.h File Reference
#include "hid_reportparser.h"
#include "hidi2c_types.h"
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  HidI2CSetting
 
struct  HidDescriptor
 
struct  HidI2CInterface
 

Macros

#define SIZEOF_HID_DESCRIPTOR   30
 
#define HIDI2C_VERSION   0x0100
 
#define INPUT_REPORT_TYPE   0x10
 
#define FEATURE_REPORT_TYPE   0x30
 
#define OUTPUT_REPORT_TYPE   0x20
 
#define HID_RESET   0x01
 
#define HID_GET_REPORT   0x02
 
#define HID_SET_REPORT   0x03
 
#define HID_SET_POWER   0x08
 
#define HID_GET_IDLE   0x04
 
#define HID_SET_IDLE   0x05
 
#define HID_GET_PROTOCOL   0x06
 
#define HID_SET_PROTOCOL   0x07
 
#define HID_RES_REG   0x00
 
#define HID_DESC_REG   0x01
 
#define HID_REPORT_DESC_REG   0x02
 
#define HID_INPUT_REPORT_REG   0x03
 
#define HID_OUTPUT_REPORT_REG   0x04
 
#define HID_COMMAND_REG   0x05
 
#define HID_DATA_REG   0x06
 
#define SIZE_OF_INPUT_QUEUE   8
 

Typedefs

typedef struct HidI2CSetting tHidI2CSetting
 
typedef struct HidDescriptor tHidDescriptor
 
typedef struct HidI2CInterface tHidI2CInterface
 

Functions

BOOL initializeHidI2CStack (tHidI2CSetting *settings, uint8_t numOfInstances)
 
BOOL initializeHidI2CStackIdle (tHidI2CSetting *settings, uint8_t numOfInstances, BOOL idle)
 
uint8_t setInputReportAndInitiateSend (uint8_t interface, uint8_t *report)
 
void setFeatureReport (uint8_t interface, uint8_t *report)
 

Macro Definition Documentation

#define SIZEOF_HID_DESCRIPTOR   30
#define HIDI2C_VERSION   0x0100
#define INPUT_REPORT_TYPE   0x10

Referenced by handleHIDCommand().

#define FEATURE_REPORT_TYPE   0x30
#define OUTPUT_REPORT_TYPE   0x20

Referenced by handleHIDCommand().

#define HID_RESET   0x01
#define HID_GET_REPORT   0x02
#define HID_SET_REPORT   0x03
#define HID_SET_POWER   0x08
#define HID_GET_IDLE   0x04

Referenced by handleHIDCommand().

#define HID_SET_IDLE   0x05

Referenced by handleHIDCommand().

#define HID_GET_PROTOCOL   0x06

Referenced by handleHIDCommand().

#define HID_SET_PROTOCOL   0x07

Referenced by handleHIDCommand().

#define HID_RES_REG   0x00
#define HID_DESC_REG   0x01
#define HID_REPORT_DESC_REG   0x02
#define HID_INPUT_REPORT_REG   0x03
#define HID_OUTPUT_REPORT_REG   0x04
#define HID_COMMAND_REG   0x05
#define HID_DATA_REG   0x06
#define SIZE_OF_INPUT_QUEUE   8

Typedef Documentation

typedef struct HidI2CSetting tHidI2CSetting

Settings structure for HIDI2C stack.

typedef struct HidDescriptor tHidDescriptor

HIDI2C Descriptor - Pg. 16 of HIDI2C Spec

Interface structure for HIDI2C. Contains all of the allocated registers as well as the HID descriptor for a specific physical interface.

Function Documentation

BOOL initializeHidI2CStack ( tHidI2CSetting settings,
uint8_t  numOfInstances 
)

Initializes the HIDI2C Stack. This setting initializes both the I2C and HID layer of the stack. Memory allocation and initialization of the HID descriptor is done within this function. The give report descriptor is automatically parsed and the maximum sizes are automatically calculated. Support for multiple HID TLCs is also supported and calculated from the report descriptor parser function.

Each interface provided will allocate its own set of registers and memory space. This allows for devices that have multiple interfaces (and larger memory spaces) to send out multiple HIDI2C packets in parallel.

Parameters
settingsPointer to an array of HIDI2C settings. This data structure is a list of all the physical interfaces as well as the report descriptor that is associated with that specific interface.
numOfInstancesNumber of interfaces that are included within the settings array.

References FALSE, and initializeHidI2CStackIdle().

Referenced by main().

BOOL initializeHidI2CStackIdle ( tHidI2CSetting settings,
uint8_t  numOfInstances,
BOOL  idle 
)

References HidDescriptor::bcdVersion_H, HidDescriptor::bcdVersion_L, HidI2CSetting::bInterface, HidI2CInterface::bInterface, sReportDescriptorInformation::bMaxInputSize, sReportDescriptorInformation::bMaxOutputSize, sReportDescriptorInformation::bNumOfReportIDs, HidI2CInterface::curOpCode, HidI2CInterface::currentQueuePos, HidI2CInterface::dataRegister, HidI2CInterface::featureReports, HidI2CInterface::featureReportsDefault, sReportIdNode::featureSize, getReportInformation(), HID_COMMAND_REG, HID_DATA_REG, HID_INPUT_REPORT_REG, HID_OUTPUT_REPORT_REG, HID_REPORT_DESC_REG, HidI2CInterface::hidDescriptor, hidI2C_initializeI2C(), HIDI2C_NO_MEMORY, HIDI2C_SUCCESS, HidI2CInterface::info, HidI2CInterface::inputOffset, inputReportQueue, HidI2CInterface::inputReportQueue, HidI2CInterface::inputReportRegister, sReportIdNode::inSize, HidI2CInterface::numOfReportIDs, HidI2CInterface::outputReportRegister, HidI2CSetting::pReportDescriptor, PRODUCT_ID, HidI2CInterface::reportDescriptor, sReportDescriptorInformation::reportIDs, HidI2CInterface::resetRegister, SIZE_OF_INPUT_QUEUE, SIZEOF_HID_DESCRIPTOR, HidI2CInterface::sizeOfDataReg, VENDOR_ID, VERSION_ID, HidDescriptor::wCommandRegister, HidDescriptor::wDataRegister, HidDescriptor::wHIDDescLength, HidDescriptor::wInputRegister, HidDescriptor::wMaxInputLength, HidDescriptor::wMaxOutputLength, HidDescriptor::wOutputRegister, HidDescriptor::wProductID, HidDescriptor::wReportDescLength, HidDescriptor::wReportDescRegister, HidI2CSetting::wReportLength, HidDescriptor::wReserved0, HidDescriptor::wReserved1, HidDescriptor::wVendorID, and HidDescriptor::wVersionID.

Referenced by initializeHidI2CStack().

uint8_t setInputReportAndInitiateSend ( uint8_t  interface,
uint8_t *  report 
)

Sets an input report and initializes the send. Depending on if the user defined NON_BLOCKING_MODE has false in the hidi2c_settings.h file, this function will return HIDI2C_BUSY if there is a transfer in progress. If the is in blocking mode, interrupts will be disables and the function will wait for ending pending transfer to finish before scheduling the transfer and asserting the GPIO pin.

Parameters
interfaceSpecific interface to send input report over
reportInput report to set
Returns
HIDI2C_SUCCESS on successful copying of the provided report into the local input report register. See hidi2c_errno.h for other error codes.

References HidI2CInterface::currentQueuePos, getIndexForInterface(), hidI2C_disableInterrupts(), hidI2C_enableInterrupts(), HIDI2C_INVALID_REPORTID, HIDI2C_NO_MEMORY, hidI2C_setGPIOPinActive(), HIDI2C_SUCCESS, index, HidI2CInterface::info, inputReportQueue, HidI2CInterface::inputReportQueue, sReportIdNode::inSize, sReportDescriptorInformation::reportIDs, and SIZE_OF_INPUT_QUEUE.

Referenced by main(), and Port1_ISR().

void setFeatureReport ( uint8_t  interface,
uint8_t *  report 
)

Sets a feature report in the HIDI2C API. If feature reports are used by the device, this function could be called in conjunction with the initializeHidI2CStackIdle command and an initial report should be passed to the API. This also sets the "default" featuyre report.

Parameters
interfaceI2C interface being used
reportFeature report to send (include report ID if multiple TLCs are used.

References getIndexForInterface(), and index.


Copyright 2013, Texas Instruments Incorporated