X-Git-Url: http://git.droids-corp.org/?p=protos%2Frc_servos.git;a=blobdiff_plain;f=main.c;fp=main.c;h=dd983459482f98be839bd593e2908bc3931ba8f1;hp=c729bbf0fcf159532211b394baaca5ae1b06db87;hb=36eab4271a8545846fa02afe14dd036fba72d3e6;hpb=809de0a09e20d0eee4188fa2db36fdc9be990526 diff --git a/main.c b/main.c index c729bbf..dd98345 100644 --- a/main.c +++ b/main.c @@ -7,16 +7,24 @@ struct servo { static struct servo servo_table[] = { { - .bit = 0, + .bit = 3, .command = 0, }, { - .bit = 1, + .bit = 4, .command = 512, }, { - .bit = 2, - .command = 1023, + .bit = 5, + .command = 512, + }, + { + .bit = 6, + .command = 512, + }, + { + .bit = 7, + .command = 512, }, }; #define NB_SERVO (sizeof(servo_table)/sizeof(*servo_table)) @@ -61,7 +69,7 @@ static volatile union { SIGNAL(TIMER1_COMPA_vect) { - PORTC = portval; + PORTD = portval; TIMSK1 &= ~_BV(OCIE1A); done = 1; } @@ -147,7 +155,8 @@ int main(void) DDRB = 0x20; /* servo outputs */ - DDRC = 0x7; + DDRD = 0xf8; + DDRB |= 0x01; /* start timer1 at clk/1 (8Mhz) */ TCNT1 = 0; @@ -177,7 +186,7 @@ int main(void) } /* bypass mode */ while (bypass == 1) { - PORTC = PORTB; + PORTD = ((PINC & 0x0f) << 3) | ((PINB & 0x01) << 7); poll_spi(); } }