bugfix: add delay between teensy col write and pin read

without this we have ghosting problems on the bottommost keys of the
teensy side

thanks to hasu (on geekhack) for the suggestion, and PrinsValium for
confirming erratic behavior with his firmware without these delays.
thanks DOX for making the changes and trying it out.  i'm just adding it
to the repo.
f13
Ben Blazak 2012-06-03 21:12:15 -07:00
parent 71bf4204e9
commit d27b162400
2 changed files with 20 additions and 2 deletions

View File

@ -39,8 +39,10 @@
* "teensy-2-0.md", and the '.svg' circuit diagram.
*/
// --- helpers
#define teensypin_write(register, operation, pin) \
_teensypin_write(register, operation, pin)
#define teensypin_write(register, operation, pin) do { \
_teensypin_write(register, operation, pin); \
_delay_us(1); /* allow pins time to stabalize */ \
} while(0)
#define _teensypin_write(register, operation, pin_letter, pin_number) \
((register##pin_letter) operation (1<<(pin_number)))

View File

@ -78,6 +78,22 @@
* Switching the row pins between hi-Z and drive low (treating them as
if they were open drain) seems just as good as, and a little safer
than, driving them high when the row's not active.
* We need to delay for at least 1 μs between changing the column pins and
reading the row pins. I would assume this is to allow the pins time to
stabalize.
* Thanks to [hasu] (http://geekhack.org/member.php?3412-hasu)
for the suggestion [here]
(http://geekhack.org/showthread.php?22780-Interest-Check-Custom-split-ergo-keyboard&p=606415&viewfull=1#post606415),
and [PrinsValium] (http://geekhack.org/member.php?6408-PrinsValium)
for noting that his firmware had erratic behavior without the delays
[here]
(http://geekhack.org/showthread.php?22780-Interest-Check-Custom-split-ergo-keyboard&p=606426&viewfull=1#post606426).
DOX tried it and confirmed that it worked for his protoype PCB (as of
3 June 2012) [here]
(http://geekhack.org/showthread.php?22780-Interest-Check-Custom-split-ergo-keyboard&p=606865&viewfull=1#post606865).
Before adding a delay we were having [strange problems with ghosting]
(http://geekhack.org/showthread.php?22780-Interest-Check-Custom-split-ergo-keyboard&p=605857&viewfull=1#post605857).
### PWM on ports OC1(A|B|C) (see datasheet section 14.10)