This will be useful for PPM decoding
//portval = PORTC | (1 << s->bit);
portval = (1 << s->bit);
t = TCNT1;
- load_timer_at(t + 150);
+ load_timer_at(t + 20);
while (done == 0)
poll_spi();
done = 0;
portval = 0;
//portval = PORTC & (~(1 << s->bit));
- load_timer_at(t + 150 + 8000 + s->command * 8);
+ load_timer_at(t + 20 + 1000 + s->command);
while (done == 0)
poll_spi();
}
/* servo outputs PD2-PD7 */
DDRD = 0xfc;
- /* start timer1 at clk/1 (8Mhz) */
+ /* start timer1 at clk/8 (1Mhz) */
TCNT1 = 0;
- TCCR1B = _BV(CS10);
+ TCCR1B = _BV(CS11);
/* start timer0 at clk/1024 (~8Khz) */
TCNT0 = 0;