uint8_t HIDKeyboard::getKeyCode(uint8_t k, uint8_t* modifiersP) { *modifiersP = 0; if (adjustForHostCapsLock && (getLEDs() & 0x02)) { // capslock is down on host OS, so host will reverse if ('a' <= k && k <= 'z') k += 'A'-'a'; else if ('A' <= k && k <= 'Z') k += 'a'-'A'; } if (k < 0x80) { k = ascii_to_hid[k]; if (k & SHIFT) { k &= 0x7f; *modifiersP = 0x02; } return k; } if (k >= 0x88) { // non-printing key, Arduino format return k - 0x88; } else { // shift key *modifiersP = 1<<(k-0x80); return 0; } }
void Frame::mirror() { const std::vector<LED>& leds = getLEDs(); for (std::size_t i = 0 ; i < leds.size()/2; ++i) { unsigned int mirrorI = leds.size()-i-1; LED led(mirrorI, leds[i].getColor()); addLED(led); } }