void CheckTickTock( ) { if( GetTickCount() - g_uiLastPing > 12000 ) { SendTick( ); g_uiLastPing = GetTickCount( ); } }
int main( ) { int i; unsigned char wasa, wasb, isa, isb; cli(); setup_clock(); DDRB = 0; DDRB |= _BV(3) | _BV(4) | _BV(1); PORTB &= ~_BV(1); wasa = 0; wasb = 0; int suppress = 10; #define STREAM for( ;; ) { #ifdef STREAM _delay_ms(8); SendCPacket(); continue; #endif _delay_ms(8); // PORTB |= _BV(1); SendTick(); // PORTB |= _BV(1); _delay_ms(8); // SendCPacket(); //continue; i++; /* if( !suppress ) { if( isa != wasa ) { if( isa ) SendAPacket(); wasa = isa; continue; } if( isb != wasb ) { if( isb ) SendBPacket(); wasb = isb; continue; } }*/ if( i == 20 ) { SendCPacket(); // PORTB |= _BV(1); if( suppress ) suppress--; i = 0; } } return 0; }