Added NKRO key bit count

This commit is contained in:
NicoHood 2015-10-25 15:19:11 +01:00
parent c78fc923f4
commit 1f35b772da

View file

@ -83,10 +83,14 @@ size_t NKROKeyboardAPI::removeAll(void)
for (uint8_t i = 0; i < sizeof(_keyReport.allkeys); i++) for (uint8_t i = 0; i < sizeof(_keyReport.allkeys); i++)
{ {
// Is a key in the list or did we found an empty slot? // Is a key in the list or did we found an empty slot?
//TODO count every bit? auto bits = _keyReport.allkeys[i];
if(_keyReport.allkeys[i]){ do {
ret++; if(bits & 0x01){
ret++;
}
bits >>=1;
} }
while(bits);
_keyReport.allkeys[i] = 0x00; _keyReport.allkeys[i] = 0x00;
} }
return ret; return ret;