]> git.droids-corp.org - protos/rc_servos.git/commitdiff
rc_servos: fix servo description to match board topology
authorFabrice Desclaux <serpilliere@droids-corp.org>
Thu, 22 Mar 2012 19:52:57 +0000 (20:52 +0100)
committerFabrice Desclaux <serpilliere@droids-corp.org>
Thu, 22 Mar 2012 19:52:57 +0000 (20:52 +0100)
main.c

diff --git a/main.c b/main.c
index c729bbf0fcf159532211b394baaca5ae1b06db87..dd983459482f98be839bd593e2908bc3931ba8f1 100644 (file)
--- 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();
                }
        }