I'm not completely sure how diodes work, but I think they will not lead any current at all if their forward voltage is not reached.
LED's are tricky things. You should try hooking one up to a power supply sometime. I have an unregulated power supply with voltage adjustment (in the from of a panel-mounted variac). One day, I plugged a LED into it. I turned on the power supply, and slowly cranked up the voltage.
To my surprise, the voltage stayed almost completely constant. This is because the diode "forced" the circuit to operate at it's forward voltage. This meant that when I twisted the knob, instead of changing the voltage like it normally did, the power supply changed it's current into the LED. This was almost unmeasurable, as I was putting about 5-20 mA into it, and the gauge goes up to 10A.
Now, if you have a regulated power supply, then things can change. Depending on the type of regulation, a diode might not operate at all until it's voltage threshold is reached.
The standard LED driver that I've looked into is a constant current source. Since the LED is already a fixed voltage, a constant current will fix the power, brightness, etc. This is not always so simple, as the best way to make a constant current power supply seems to be making a constant voltage power supply, and running the output through a diode. So you could do that.
Perhaps a better way, and certainly one that is utilized more frequently by flashlight makers is to control the brightness by making a power supply capable of outputting the maximum current, then pulsing it (PWM). The "width" of the on/off square wave will determine the brightness. Make sure it's over 65 Hertz, or you'll see it flicker, especially at night. I was considering using a 555 timer (or similar) and fixing it at some arbitrarily high rate, then using that to flip a transistor, thereby flashing the light, but this doesn't work, as the frequency doesn't really matter that much, it's the "duty cycle" or "percentage of the time the square wave is high" that determines the brightness.
Of course this should be pretty easy to do with a microcontroller. You'd need just one pin to control the brightness, by running the signal through a transistor, which switches the power (current) from the LED powersupply (AKA 5V to 3.3V source, or otherwise current limited supply from USB power ) to the LED bank. Then, by switching the ground sinks, you can theoretically control the LED's individually as a matrix, though I don't know if there's enough pins for all that on the chip.
This would do as a built in safety feature to make it impossible to drive more than one LED per column at time even if every row would be connected to ground. One row is at most 14 LEDs, 14 × 25mA is "only" 325mA. The diodes might be able to take short bursts of current higher than their specified continuous current rating.
They usually can. I'd recommend reading the unusually good datasheets that CREE puts out as a general guide. Also, if there's some sort of hesitating on the package, then it'll be better.
This should be clear from the LED datasheet in that case.
Like I said: usually, but I've soon some poor LED datasheets. Some (most) are abysmal.
I think this is probably an unnecessary risk though. That would require more interesting programming involving timer overflow interrupts to ensure no LEDs are burst fed for too long =) The output couldn't be increased by too much though because of the 500mA roof.
Are you suggesting that you set up a "flicker" like what I have suggested, but instead of having each LED be hot, then neutral, you switch power down the line (I like to think of those lights going around in a circle on movie display boards outside the theater.) Hmm, that could work well, though each line would only be hot for 100/(# of columns) %of the time, so you'd probably need much higher current (theoretically (# of columns) more) for each pulse to achieve the equivalent brightness. This should not be an issue for lower brightnesses, though.
I also don't know how much current that can be passed through the Teensy board itself. The ATmega is specified to be able to supply the 40mA/pin. The ground connections on the Teensy board would be subjected to ~400mA though. I don't know how thick those traces are. It would of course be possible to wire the USB ground directly onto the keyboard PCB as well.
Ideally, I'd say you'd not be passing any appreciable current through the TEENSY, just using it to flip a transistor on and off for you. You colud power the LED's completely separately, and not even have to worry about the grounds, unless you want to also control each LED on/off with the teensy, but even then, 400 mA should be enough for that, as USB is only specc'd to 500 mA in the first place. Though maybe this is more a limitation of USB, not the teensy. Does the Teensy draw a max of 100 mA? If so, then this makes sense.
My idea is to interleave the scans of the two matrices. First the LED matrix is scanned. This requires the B-port to be set as outputs. Then the key matrix is scanned, B-port as inputs with pull-up resistors.
During the LED scan the column pins control which LEDs get lit, and during the key scan they control which column to scan. Depending on the key scan frequency needed N LED scans could be done per key scan.
This is all microcontroller stuff, and I have more experience with analog stuff, so I really can't comment here.
Anyway, I'm off to bed now. I hope this made sense to at least someone. As always, I'm not a EE, so take with brick of salt.