Rev 1739 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1739 | Rev 1749 | ||
---|---|---|---|
Line 6... | Line 6... | ||
6 | #include "main.h" |
6 | #include "main.h" |
7 | // Achtung: RECEIVER_SPEKTRUM_EXP wird in der Main.h gesetzt |
7 | // Achtung: RECEIVER_SPEKTRUM_EXP wird in der Main.h gesetzt |
Line 8... | Line 8... | ||
8 | 8 | ||
Line 9... | Line 9... | ||
9 | unsigned char SpektrumTimer = 0; |
9 | unsigned char SpektrumTimer = 0; |
10 | 10 | ||
11 | #ifdef RECEIVER_SPEKTRUM_EXP |
11 | #ifdef RECEIVER_SPEKTRUM_EXP //#endif |
12 | unsigned char s_excnt = 0; // Counter for Spektrum-Expander |
12 | unsigned char s_excnt = 0; // Counter for Spektrum-Expander |
13 | unsigned char s_exparity = 0; // Parity Bit for Spektrum-Expander |
13 | unsigned char s_exparity = 0; // Parity Bit for Spektrum-Expander |
14 | signed char s_exdata[11]; // Data for Spektrum-Expander |
14 | signed char s_exdata[11]; // Data for Spektrum-Expander |
15 | #endif |
15 | //#endif |
16 | //--------------------------------------------------------------// |
16 | //--------------------------------------------------------------// |
17 | //--------------------------------------------------------------// |
17 | //--------------------------------------------------------------// |
18 | void SpektrumBinding(void) |
18 | void SpektrumBinding(void) |
Line 66... | Line 66... | ||
66 | DDRD &= ~(1 << DDD2); // RX as input |
66 | DDRD &= ~(1 << DDD2); // RX as input |
67 | PORTD &= ~(1 << PORTD2); |
67 | PORTD &= ~(1 << PORTD2); |
Line 68... | Line 68... | ||
68 | 68 | ||
69 | SpektrumUartInit(); // init Uart again |
69 | SpektrumUartInit(); // init Uart again |
70 | } |
70 | } |
71 | 71 | #endif |
|
72 | //############################################################################ |
72 | //############################################################################ |
73 | // USART1 initialisation from killagreg |
73 | // USART1 initialisation from killagreg |
74 | void SpektrumUartInit(void) |
74 | void SpektrumUartInit(void) |
75 | //############################################################################ |
75 | //############################################################################ |
- | 76 | { |
|
- | 77 | #ifdef RECEIVER_SPEKTRUM_EXP //#endif |
|
76 | { |
78 | |
77 | // -- Start of USART1 initialisation for Spekturm seriell-mode |
79 | // -- Start of USART1 initialisation for Spekturm seriell-mode |
78 | // USART1 Control and Status Register A, B, C and baud rate register |
80 | // USART1 Control and Status Register A, B, C and baud rate register |
Line 79... | Line 81... | ||
79 | uint8_t sreg = SREG; |
81 | uint8_t sreg = SREG; |
Line 126... | Line 128... | ||
126 | // -- End of USART1 initialisation |
128 | // -- End of USART1 initialisation |
127 | // restore global interrupt flags |
129 | // restore global interrupt flags |
Line 128... | Line 130... | ||
128 | 130 | ||
129 | SREG = sreg; |
131 | SREG = sreg; |
- | 132 | return; |
|
130 | return; |
133 | #endif |
Line 131... | Line 134... | ||
131 | } |
134 | } |
132 | 135 | ||
133 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
136 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
Line 207... | Line 210... | ||
207 | //############################################################################ |
210 | //############################################################################ |
208 | // Wird im UART-Interrupt aufgerufen |
211 | // Wird im UART-Interrupt aufgerufen |
209 | //############################################################################ |
212 | //############################################################################ |
210 | void SpektrumParser(unsigned char c) |
213 | void SpektrumParser(unsigned char c) |
211 | { |
214 | { |
- | 215 | #ifdef RECEIVER_SPEKTRUM_EXP //#endif |
|
- | 216 | ||
212 | static unsigned char Sync=0, FrameCnt=0, ByteHigh=0, ReSync=1, Frame2=0; |
217 | static unsigned char Sync=0, FrameCnt=0, ByteHigh=0, ReSync=1, Frame2=0; |
213 | unsigned int Channel, index = 0; |
218 | unsigned int Channel, index = 0; |
214 | signed int signal = 0, tmp; |
219 | signed int signal = 0, tmp; |
215 | int bCheckDelay; |
220 | int bCheckDelay; |
216 | // c = UDR1; // get data byte |
221 | // c = UDR1; // get data byte |
Line 401... | Line 406... | ||
401 | Frame2 = 0; |
406 | Frame2 = 0; |
402 | Sync = 0; |
407 | Sync = 0; |
403 | SpektrumTimer = MIN_FRAMEGAP; |
408 | SpektrumTimer = MIN_FRAMEGAP; |
404 | } |
409 | } |
405 | } |
410 | } |
- | 411 | #endif |
|
406 | } |
412 | } |