Fixed timeout timers

This commit is contained in:
Sebastian 2016-11-26 22:44:56 +01:00
parent 33a3dccbf0
commit be5d5ddf1e
2 changed files with 15 additions and 3 deletions

View File

@ -61,7 +61,6 @@ uint8_t uart_get_byte() {
}
ISR(USART2_RX_vect) {
//PORTB ^= (1 << PB7);
sss7_process_rx();
}
@ -71,9 +70,15 @@ ISR(USART2_TX_vect) {
void SSS7Wrapper::setupTimer() {
TCCR4B = 0;
TCNT4 = 65535 - 16000; //Preload for 16000 ticks to overflow
TIMSK4 |= (1 << TOIE0);
// Take the Timer by force ...
TCCR4A = 0;
TCCR4B = (1 << CS40); // Prescaler 1
TCCR4C = 0;
TIMSK4 = (1 << TOIE4);
}
ISR(TIMER4_OVF_vect) {

View File

@ -28,7 +28,6 @@ void loop() {
while(1) {
Serial.println("Waiting to send");
while(!SSS7.canSend());
Serial.println("Sending ...");
@ -39,6 +38,14 @@ void loop() {
Serial.println("Send failed");
}
if(SSS7.hasReceived()) {
uint8_t msg1[SSS7_PAYLOAD_SIZE];
SSS7.getReceived(msg1);
Serial.print("Got data:");
Serial.println((char*)msg1);
}
_delay_ms(1000);
}