HIDDKeyboardInputReport_PressStandardKey
Default mainpageat91libusbdevicehid-keyboardHIDDKeyboardInputReport_PressStandardKey
Description Source Call Graph
Start Line: 71
void HIDDKeyboardInputReport_PressStandardKey(HIDDKeyboardInputReport *report, unsigned char key)
{
    ASSERT(key <= HIDDKeyboardDriverDescriptors_LASTSTANDARDKEY,
           "Invalid standard key code (%d)\n\r",
           key);

    // Find first available slot
    unsigned int i = 0;
    unsigned char found = 0;
    while ((i < HIDDKeyboardInputReport_MAXKEYPRESSES) && !found) {

        // Free slot: no key referenced (code = 0) or ErrorRollOver
        if ((report->pressedKeys[i] == 0)
            || (report->pressedKeys[i] == HIDKeypad_ERRORROLLOVER)) {

            found = 1;
            report->pressedKeys[i] = key;
        }
        
        i++;
    }

    // Report ErrorRollOver in all fields if too many keys are pressed
    if (!found) {

        for (i=0; i < HIDDKeyboardInputReport_MAXKEYPRESSES; i++) {

            report->pressedKeys[i] = HIDKeypad_ERRORROLLOVER;
        }
    }
}