Пример #1
0
int8_t processKeysBase(const uint8_t* current, const uint8_t* processed, uint8_t* report)
{
    uint8_t modifiers = current[0];
    if (!(current[1] & MOD_PAD)) {
        uint8_t count = 2;
        for (int8_t i = 2; i < 8; ++i) {
            uint8_t code = current[i];
            uint8_t key = getKeyNumLock(code);
            if (!key)
                key = getKeyBase(code);
            key = toggleKanaMode(key, modifiers, !memchr(processed + 2, key, 6));
            report[count++] = key;
        }
    }
    report[0] = modifiers;
    return XMIT_NORMAL;
}
Пример #2
0
void onPressed(int8_t row, uint8_t column)
{
    uint8_t key;
    uint8_t code;

    if (2 <= BOARD_REV_VALUE)
        code = codeRev2[row][column];
    else
        code = 12 * row + column;
    ++columnCount[column];
    ++rowCount[row];
    key = getKeyBase(code);
    if (KEY_LEFTCONTROL <= key && key <= KEY_RIGHT_GUI) {
        modifiers |= 1u << (key - KEY_LEFTCONTROL);
        return;
    }
    if (KEY_LEFT_FN <= key && key <= KEY_RIGHT_FN) {
        current[1] |= 1u << (key - KEY_LEFT_FN);
        return;
    }
    if (count < 8)
        current[count++] = code;
}