Subversion Repositories FlightCtrl

Rev

Rev 712 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 712 Rev 732
Line 11... Line 11...
11
#include <stdlib.h>
11
#include <stdlib.h>
12
#include <avr/io.h>
12
#include <avr/io.h>
13
#include <avr/interrupt.h>
13
#include <avr/interrupt.h>
Line 14... Line 14...
14
 
14
 
-
 
15
#include "rc.h"
Line 15... Line 16...
15
#include "rc.h"
16
#include "main.h"
16
 
17
 
17
volatile int16_t PPM_in[11];
18
volatile int16_t PPM_in[11];
18
volatile int16_t PPM_diff[11];
19
volatile int16_t PPM_diff[11];
Line 37... Line 38...
37
        // set as output
38
        // set as output
38
        DDRD |= (1<<DDD5)|(1<<DDD4)|(1<<DDD3);
39
        DDRD |= (1<<DDD5)|(1<<DDD4)|(1<<DDD3);
39
        // low level
40
        // low level
40
        PORTD &= ~((1<<PORTD5)|(1<<PORTD4)|(1<<PORTD3));
41
        PORTD &= ~((1<<PORTD5)|(1<<PORTD4)|(1<<PORTD3));
Line -... Line 42...
-
 
42
 
-
 
43
        // PD3 can't be used in FC 1.1 if 2nd UART is activated
-
 
44
        // becouse TXD1 is at that port
-
 
45
        if(BoardRelease == 10)
-
 
46
        {
-
 
47
                DDRD |= (1<<PORTD3);
-
 
48
                PORTD &= ~(1<<PORTD3);
-
 
49
        }
41
 
50
 
Line 42... Line 51...
42
        // Timer/Counter1 Control Register A, B, C
51
        // Timer/Counter1 Control Register A, B, C
43
 
52
 
44
        // Normal Mode (bits: WGM13=0, WGM12=0, WGM11=0, WGM10=0)
53
        // Normal Mode (bits: WGM13=0, WGM12=0, WGM11=0, WGM10=0)
Line 131... Line 140...
131
            }
140
            }
132
            index++; // next channel
141
            index++; // next channel
133
            // demux sum signal for channels 5 to 7 to J3, J4, J5
142
            // demux sum signal for channels 5 to 7 to J3, J4, J5
134
                if(index == 5) PORTD |= (1<<PORTD5); else PORTD &= ~(1<<PORTD5);
143
                if(index == 5) PORTD |= (1<<PORTD5); else PORTD &= ~(1<<PORTD5);
135
                if(index == 6) PORTD |= (1<<PORTD4); else PORTD &= ~(1<<PORTD4);
144
                if(index == 6) PORTD |= (1<<PORTD4); else PORTD &= ~(1<<PORTD4);
-
 
145
                if(BoardRelease == 10)
-
 
146
                {
136
                if(index == 7) PORTD |= (1<<PORTD3); else PORTD &= ~(1<<PORTD3);
147
                                if(index == 7) PORTD |= (1<<PORTD3); else PORTD &= ~(1<<PORTD3);
-
 
148
                }
137
        }
149
        }
138
        }
150
        }
139
}
151
}