From: Fabrice Desclaux Date: Thu, 22 Mar 2012 19:52:57 +0000 (+0100) Subject: rc_servos: fix servo description to match board topology X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=36eab4271a8545846fa02afe14dd036fba72d3e6;p=protos%2Frc_servos.git rc_servos: fix servo description to match board topology --- 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(); } }