git.droids-corp.org
/
protos
/
rc_servos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
transmit 6 servos instead of 3
[protos/rc_servos.git]
/
main.c
diff --git
a/main.c
b/main.c
index
e434690
..
f06bc44
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-120,7
+120,7
@@
static void poll_spi(void)
SPDR = byte1_tx.u8;
}
spi_out_idx ++;
SPDR = byte1_tx.u8;
}
spi_out_idx ++;
- if (spi_out_idx >= NB_SERVO)
+ if (spi_out_idx >= NB_SERVO
* 2
)
spi_out_idx = 0;
/* RX */
spi_out_idx = 0;
/* RX */
@@
-173,16
+173,16
@@
static void poll_input_capture(void)
if ((TIFR1 & _BV(ICF1)) == 0)
return;
if ((TIFR1 & _BV(ICF1)) == 0)
return;
- sei();
- icp = ICR1;
cli();
cli();
+ icp = ICR1;
+ sei();
- rising =
TCCR1B & _BV(ICES1
);
+ rising =
!!(TCCR1B & _BV(ICES1)
);
/* change the edge type */
TCCR1B ^= _BV(ICES1);
/* change the edge type */
TCCR1B ^= _BV(ICES1);
- /* clear the flag */
+ /* clear the flag
by writing a one
*/
TIFR1 = TIFR1 | _BV(ICF1);
diff = icp - icp_prev;
TIFR1 = TIFR1 | _BV(ICF1);
diff = icp - icp_prev;