ADd some docs for the scan cycle timer

pull/879/head
Jesse Vincent 4 years ago
parent ad83388ef9
commit 45ffbd9118
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -75,10 +75,15 @@ class ATmega: public kaleidoscope::driver::keyscanner::Base<_KeyScannerProps> {
OUTPUT_HIGH(_KeyScannerProps::matrix_row_pins[i]);
}
/* Set up Timer1 for 1700usec */
setScanCycleTime(_KeyScannerProps::keyscan_interval);
}
/* setScanCycleTime takes a value of between 0 and 8192. This corresponds (roughly) to the number of microseconds to wait between scanning the key matrix. Our debouncing algorithm does four checks before deciding that a result is valid. Most normal mechanical switches specify a 5ms debounce period. On an ATMega32U4, 1700 gets you about 5ms of debouncing.
Because keycanning is triggered by an interrupt but not run in that interrupt, the actual amount of time between scans is prone to a little bit of jitter.
*/
void setScanCycleTime(uint16_t c) {
TCCR1B = _BV(WGM13);
TCCR1A = 0;

Loading…
Cancel
Save