Gentlemen, thanks for the responses on this most momentous of American holidays.
Right there. That is the constructor call. It apparently works for this guy using Bounce2.
I would love to implement that, but only if I can get away with putting the filters on the column or row wires instead of each of the switches individually. There are 84 keys on this thing and its handwired - including the SK6812 Mini-e under each key. I've had enough soldering this past week to make me wonder how much lead I inhaled even with ventilation and a fan.
I see, for some reason I was expecting writing my own debounce code to be more complicated. I'll give this a shot tomorrow and see if I'm smart enough to adapt it to a matrix and have it register on fall instead of waiting for the end of the debounce delay. I've got some freedom to celebrate today.
Yes. It's all copy and pasted with some unrelated sections removed for brevity. I don't want to overwhelm you with my layer system and rgbled assignments for instance.
Oh wow, I copied this scan loop from someone else's Teensy 3.X keyboard project and never thought about its location like that. That is a weird spot.
Yes. There's contact chatter if I reduce that delay, but if I remove it entirely, there's a weird effect going on with the first column(Esc. Tilde, Tab, etc) that causes the key below the one I'm holding to behave as if rapidly pressed(think turbo mode from third party console controllers) while the key above it is held down. Real head scratcher, I'm 99% certain there's nothing wrong with the wiring and I have no idea what in the code would cause that behavior, but I'm considering adding a low pass filter or a ferrule to just that column to see if that filters out some wire cross talk or interference just in case.
I've been trying to do this, but the problem I mentioned earlier about removing the delay pops up.
But I just came up with the idea to implement this without removing the delay and instead just setting it to 1. It works, and I was able to reduce the interval of that timer to 14ms.
void loop() {
unsigned long now = millis();
if (now - lastTime >= 14) {
for (uint8_t i=0; i<rowsCount; i++) {
digitalWrite(rows[i], LOW);
for (uint8_t j=0; j<columnsCount; j++) {
Key* key = getKey(i, j);
boolean current = !digitalRead(columns[j]);
boolean previous = key->pressed;
key->pressed = current;
LayoutKey* layout = getLayoutKey(key->row, key->column);
if (current && !previous) {
keyPressed(key, layout);
} else if (!current && previous) {
keyReleased(key, layout);
}
}
digitalWrite(rows[i], HIGH);
delay(1);
}
lastTime = now;
}
}
So... that's an improvement I guess. I'd still rather be able to remove it entirely as I'd like my Trill Bar code to run uninterrupted, and I also want the satisfaction of knowing my kepresses are registered on fall and not shortly after.