Subversion Repositories FlightCtrl

Rev

Rev 1338 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1338 Rev 1356
Line 3... Line 3...
3
#######################################################################################*/
3
#######################################################################################*/
4
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5
// + Copyright (c) Holger Buss, Ingo Busker
5
// + Copyright (c) Holger Buss, Ingo Busker
6
// + only for non-profit use
6
// + only for non-profit use
7
// + www.MikroKopter.com
7
// + www.MikroKopter.com
-
 
8
// + porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed
8
// + see the File "License.txt" for further Informations
9
// + see the File "License.txt" for further Informations
9
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Line 10... Line 11...
10
 
11
 
11
#include "rc.h"
12
#include "rc.h"
-
 
13
#include "main.h"
Line 12... Line 14...
12
#include "main.h"
14
//#define ACT_S3D_SUMMENSIGNAL
13
 
15
 
14
volatile int PPM_in[11];
16
volatile int PPM_in[11];
15
volatile int PPM_diff[11];  // das diffenzierte Stick-Signal
17
volatile int PPM_diff[11];  // das diffenzierte Stick-Signal
Line 20... Line 22...
20
//zum decodieren des PPM-Signals wird Timer1 mit seiner Input
22
//zum decodieren des PPM-Signals wird Timer1 mit seiner Input
21
//Capture Funktion benutzt:
23
//Capture Funktion benutzt:
22
void rc_sum_init (void)
24
void rc_sum_init (void)
23
//############################################################################
25
//############################################################################
24
{
26
{
-
 
27
#ifndef ACT_S3D_SUMMENSIGNAL
25
        TCCR1B=(1<<CS11)|(1<<CS10)|(1<<ICES1)|(1<<ICNC1);//|(1 << WGM12); //timer1 prescale 64
28
        TCCR1B=(1<<CS11)|(1<<CS10)|(1<<ICES1)|(1<<ICNC1);//|(1 << WGM12); //timer1 prescale 64
-
 
29
#else 
-
 
30
        TCCR1B=(1<<CS11)|(0<<CS10)|(1<<ICES1)|(1<<ICNC1); //timer1 prescale 64
-
 
31
#endif
26
    TIMSK1 |= _BV(ICIE1);
32
    TIMSK1 |= _BV(ICIE1);
27
    AdNeutralGier = 0;
33
    AdNeutralGier = 0;
28
    AdNeutralRoll = 0;
34
    AdNeutralRoll = 0;
29
    AdNeutralNick = 0;
35
    AdNeutralNick = 0;
30
    return;
36
    return;
31
}
37
}
Line -... Line 38...
-
 
38
 
32
 
39
#ifndef ACT_S3D_SUMMENSIGNAL
33
//############################################################################
40
//############################################################################
34
//Diese Routine startet und inizialisiert den Timer für RC
41
//Diese Routine startet und inizialisiert den Timer für RC
35
SIGNAL(SIG_INPUT_CAPTURE1)
42
SIGNAL(SIG_INPUT_CAPTURE1)
36
//############################################################################
43
//############################################################################
Line 157... Line 164...
157
                  }
164
                  }
158
            }
165
            }
159
 }
166
 }
160
}
167
}
Line -... Line 168...
-
 
168
 
161
 
169
#else 
162
/*
170
 
163
//############################################################################
171
//############################################################################
164
//Diese Routine startet und inizialisiert den Timer für RC
172
//Diese Routine startet und inizialisiert den Timer für RC
165
SIGNAL(SIG_INPUT_CAPTURE1)
173
SIGNAL(SIG_INPUT_CAPTURE1)
Line 166... Line 174...
166
//############################################################################
174
//############################################################################
167
 
175
 
168
{
176
{
169
        static unsigned int AltICR=0;
177
        static unsigned int AltICR=0;
170
    signed int signal = 0,tmp;
178
    signed int signal = 0,tmp;
171
        static int index;              
179
        static int index;              
172
               
180
       
173
        signal = (unsigned int) ICR1 - AltICR;         
181
        signal = (unsigned int) ICR1 - AltICR;         
174
DebugOut.Analog[16] = signal;
182
DebugOut.Analog[16] = signal;
175
        signal /= 2;
183
        signal /= 2;
Line 195... Line 203...
195
                if(SenderOkay >= 195)  PPM_diff[index] = ((tmp - PPM_in[index]) / 3) * 3;
203
                if(SenderOkay >= 195)  PPM_diff[index] = ((tmp - PPM_in[index]) / 3) * 3;
196
                else PPM_diff[index] = 0;
204
                else PPM_diff[index] = 0;
197
                PPM_in[index] = tmp;
205
                PPM_in[index] = tmp;
198
                }
206
                }
199
            index++;  
207
            index++;  
200
         if(index == 5) J3High; else J3Low;  // Servosignal an J3 anlegen
-
 
201
         if(index == 2) J4High; else J4Low;  // Servosignal an J4 anlegen
-
 
202
         if(index == 7) J5High; else J5Low;  // Servosignal an J5 anlegen
-
 
203
        }
208
        }
204
        }
209
        }
205
}
210
}
206
*/
211
#endif
207
 
-
 
208
 
-