Added timer code for timeouts

This commit is contained in:
Sebastian 2016-11-21 13:10:14 +01:00
parent 8d5fc18076
commit d0af74c7de
1 changed files with 12 additions and 1 deletions

View File

@ -68,4 +68,15 @@ ISR(USART_TXC1_vect) {
sss7_process_tx();
}
//TODO: Setup Timer
void SSS7Wrapper::setupTimer() {
TCNT4 = 65535 - 16000; //Preload for 16000 ticks to overflow
TIMSK4 |= (1 << TOIE0);
TCCR4B = (1 << CS40); // Prescaler 1
}
ISR(TIMER4_OVF_vect) {
TCNT4 = 65535 - 16000; //Preload for 16000 ticks to overflow
sss7_process_ticks(sss7_timeout_increment);
}