This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294NCPDT: USB LIB modifier key

Part Number: TM4C1294NCPDT

Hi team,

Here's an issue form the customer may need your help:

The customer would like to know how can the USBHIDKEYBOARD HID Keyboard for the USB Library provided by TIVA WARE enable sending a separate modifer key. Could you help resolve this case? Thanks.

Best Regards,

Cherry

  • Hi Cherry,

    sending a separate modifer key.

    Please refer to to the USB library 

    2.18.4.3 USBDHIDKeyboardKeyStateChange
    Reports a key state change to the USB host.
    Prototype:
    uint32_t
    USBDHIDKeyboardKeyStateChange(void *pvKeyboardDevice,
    uint8_t ui8Modifiers,
    uint8_t ui8UsageCode,
    bool bPress)
    Parameters:
    pvKeyboardDevice is the pointer to the device instance structure as returned by USBDHIDKeyboardInit().


    ui8Modifiers contains the states of each of the keyboard modifiers (left/right shift,
    ctrl, alt or GUI keys). Valid values are logical OR combinations of the labels
    HID_KEYB_LEFT_CTRL, HID_KEYB_LEFT_SHIFT, HID_KEYB_LEFT_ALT,
    HID_KEYB_LEFT_GUI, HID_KEYB_RIGHT_CTRL, HID_KEYB_RIGHT_SHIFT,

    HID_KEYB_RIGHT_ALT and HID_KEYB_RIGHT_GUI. Presence of one of these
    bit flags indicates that the relevant modifier key is pressed and absence indicates that it is
    released.
    ui8UsageCode is the usage code of the key whose state has changed. If only modifier keys
    have changed, HID_KEYB_USAGE_RESERVED should be passed in this parameter.
    bPress is true if the key has been pressed or false if it has been released. If only modifier
    keys have changed state, this parameter is ignored.
    Description:
    This function adds or removes a key usage code from the list of keys currently pressed and
    schedules a report transmission to the host to inform it of the new keyboard state. If the
    maximum number of simultaneous key presses are already recorded, the report to the host
    contains the rollover error code, HID_KEYB_USAGE_ROLLOVER instead of key usage codes
    and the caller receives return code KEYB_ERR_TOO_MANY_KEYS.
    Returns:
    Returns KEYB_SUCCESS if the key usage code was added to or removed from the
    current list successfully. KEYB_ERR_TOO_MANY_KEYS is returned if an attempt is
    made to press a 7th key (the BIOS keyboard protocol can report no more than 6 simultaneously
    pressed keys). If called before the USB host has configured the device,
    KEYB_ERR_NOT_CONFIGURED is returned and, if an error is reported while attempting to
    transmit the report, KEYB_ERR_TX_ERROR is returned. If an attempt is made to remove a
    key from the pressed list (by setting parameter bPressed to false) but the key usage code is
    not found, KEYB_ERR_NOT_FOUND is returned.