Rev 931 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 931 | Rev 938 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | // *************************************************************** |
1 | // *************************************************************** |
2 | // ** Spektrum Diversity v2.0 - use up to 4 satellite receivers ** |
2 | // ** Spektrum Diversity v2.1 - use up to 4 satellite receivers ** |
3 | // *************************************************************** |
3 | // *************************************************************** |
- | 4 | // ** Spektrum DSMX Binding Extension by Johannes Stein 2011/03 ** |
|
- | 5 | // ** ** |
|
- | 6 | // ** 3 Pulses = DSM2 1024/22ms ** |
|
- | 7 | // ** 5 Pulses = DSM2 2048/11ms ** |
|
- | 8 | // ** 7 Pulses = DSMX 22ms ** |
|
- | 9 | // ** 9 Pulses = DSMX 11ms ** |
|
- | 10 | // ** ** |
|
4 | // ** Target: An Atmel ATtiny2313 (RC-Oscillator @ 8 MHz) ** |
11 | // ** Target: An Atmel ATtiny2313 (RC-Oscillator @ 8 MHz) ** |
5 | // ** controls a 74HC151 Multiplexer ** |
12 | // ** controls a 74HC151 Multiplexer ** |
6 | // *************************************************************** |
13 | // *************************************************************** |
7 | // ** It monitors the data from 4 satellite receivers and ** |
14 | // ** It monitors the data from 4 satellite receivers and ** |
8 | // ** connects a valid one to the output via the multiplexer ** |
15 | // ** connects a valid one to the output via the multiplexer ** |
Line 116... | Line 123... | ||
116 | _delay_ms(250); |
123 | _delay_ms(250); |
117 | } |
124 | } |
Line 118... | Line 125... | ||
118 | 125 | ||
Line 119... | Line 126... | ||
119 | DDRB = 0b00000000; // Sat-Pins to input again |
126 | DDRB = 0b00000000; // Sat-Pins to input again |
120 | 127 | ||
121 | bind++; // Save increased bind-pulse-counter for next binding. |
128 | bind += 2; |
122 | if (bind > 6) bind = 3; // 3 pulses are for DX7+AR6200, 4-6 pulses have been seen... |
129 | if (bind > 9) bind = 3; // 3, 5, 7, 9 pulses, then start with 3 again |
123 | eeprom_write_byte(&eebind, bind); // around the world for other combinations. Hopefully it works for them. |
130 | eeprom_write_byte(&eebind, bind); // Save increased bind-pulse-counter for next binding. |
Line 196... | Line 203... | ||
196 | DDRB = 0b00000000; // Port B Input for satellites and feedback |
203 | DDRB = 0b00000000; // Port B Input for satellites and feedback |
197 | DDRD = 0b0011001; // Port D Output for MUX and LED, Input for Switch & Test |
204 | DDRD = 0b0011001; // Port D Output for MUX and LED, Input for Switch & Test |
198 | PORTB = 0b11110000; // Port B Pullup's for (unused) satellites |
205 | PORTB = 0b11110000; // Port B Pullup's for (unused) satellites |
199 | PORTD = 0b1100001; // Port D Pullup's for Switch & Test, LED off |
206 | PORTD = 0b1100001; // Port D Pullup's for Switch & Test, LED off |
Line 200... | Line 207... | ||
200 | 207 | ||
201 | if (eeprom_read_byte(&eecheck) != 0x42) // Invalid Data in EEPROM -> initialize |
208 | if (eeprom_read_byte(&eecheck) != 0x84) // Invalid Data in EEPROM -> initialize |
202 | { |
209 | { |
203 | eeprom_write_byte(&eecheck, 0x42); |
210 | eeprom_write_byte(&eecheck, 0x84); |
204 | bind = 3; |
211 | bind = 3; |
205 | eeprom_write_byte(&eebind, bind); |
212 | eeprom_write_byte(&eebind, bind); |
206 | } |
213 | } |