Subversion Repositories FlightCtrl

Rev

Rev 2002 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2002 Rev 2006
1
#ifndef _MAIN_H
1
#ifndef _MAIN_H
2
#define _MAIN_H
2
#define _MAIN_H
3
 
3
 
4
//#define DEBUG                                                 // use to activate debug output to MK-Tool: use Debug(text);
4
//#define DEBUG                                                 // use to activate debug output to MK-Tool: use Debug(text);
5
//#define ACT_S3D_SUMMENSIGNAL
5
//#define ACT_S3D_SUMMENSIGNAL
6
//#define RECEIVER_SPEKTRUM_DX7EXP
6
//#define RECEIVER_SPEKTRUM_DX7EXP
7
//#define RECEIVER_SPEKTRUM_DX8EXP
7
//#define RECEIVER_SPEKTRUM_DX8EXP
8
 
8
 
9
 
9
 
10
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))        ///MartinW
10
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))        ///MartinW
11
        #define WITH_MKTOOL_Display
11
        #define WITH_MKTOOL_Display
12
        #define WITH_JETI_SIMULATION
12
        #define WITH_JETI_SIMULATION
13
        #define WITH_ExternControl
13
        #define WITH_ExternControl
14
        #define WITH_FULL_ANALOG_TEXT
14
        #define WITH_FULL_ANALOG_TEXT
15
        #define WITHSPECTRUM
15
        #define WITHSPECTRUM
16
        #define WITH_REMAINCAPACITY
16
        #define WITH_REMAINCAPACITY
17
#else
17
#else
18
#endif
18
#endif
19
 
19
 
20
//#define WITH_MKTOOL_Display                   /// MartinW;  with MKTool Display 70604-63130
20
//#define WITH_MKTOOL_Display                   /// MartinW;  with MKTool Display 70604-63130
21
//#define WITHSPECTRUM                                  /// MartinW;  memsave
21
//#define WITHSPECTRUM                                  /// MartinW;  memsave
22
//#define WITH_FULL_ANALOG_TEXT                 /// MartinW;  memsave
22
//#define WITH_FULL_ANALOG_TEXT                 /// MartinW;  memsave
23
//#define WITH_ExternControl                    /// MartinW;  memsave
23
//#define WITH_ExternControl                    /// MartinW;  memsave
24
//#define WITH_ORIGINAL_MOTORSMOOTHING  /// MartinW;  memsave 63312-63164
24
//#define WITH_ORIGINAL_MOTORSMOOTHING  /// MartinW;  memsave 63312-63164
25
//#define WITH_JETI_SIMULATION                  /// MartinW;  memsave 63312-63016
25
//#define WITH_JETI_SIMULATION                  /// MartinW;  memsave 63312-63016
26
#define WITH_JETI_BEEP                                  /// MartinW;  63072-63038; 63216-63050
-
 
27
//#define WITH_PANOTRIGGER                              /// MartinW;  64336-64112
26
//#define WITH_PANOTRIGGER                              /// MartinW;  64336-64112
28
//#define WITH_HOTTMENU                                 /// Metro; 
27
//#define WITH_HOTTMENU                                 /// Metro; 
29
//#define WITH_REMAINCAPACITY                   /// Metro;
28
//#define WITH_REMAINCAPACITY                   /// Metro;
30
 
29
 
31
 
30
 
32
 
31
 
33
 
32
 
34
 
33
 
35
 
34
 
36
 
35
 
37
// neue Hardware
36
// neue Hardware
38
#define ROT_OFF   {if((PlatinenVersion == 10)||(PlatinenVersion >= 20)) PORTB &=~0x01; else  PORTB |= 0x01;}
37
#define ROT_OFF   {if((PlatinenVersion == 10)||(PlatinenVersion >= 20)) PORTB &=~0x01; else  PORTB |= 0x01;}
39
#define ROT_ON    {if((PlatinenVersion == 10)||(PlatinenVersion >= 20)) PORTB |= 0x01; else  PORTB &=~0x01;}
38
#define ROT_ON    {if((PlatinenVersion == 10)||(PlatinenVersion >= 20)) PORTB |= 0x01; else  PORTB &=~0x01;}
40
#define ROT_FLASH PORTB ^= 0x01
39
#define ROT_FLASH PORTB ^= 0x01
41
#define GRN_OFF   {if((PlatinenVersion < 12)) PORTB &=~0x02; else PORTB |= 0x02;}
40
#define GRN_OFF   {if((PlatinenVersion < 12)) PORTB &=~0x02; else PORTB |= 0x02;}
42
#define GRN_ON    {if((PlatinenVersion < 12)) PORTB |= 0x02; else PORTB &=~0x02;}
41
#define GRN_ON    {if((PlatinenVersion < 12)) PORTB |= 0x02; else PORTB &=~0x02;}
43
#define GRN_FLASH PORTB ^= 0x02
42
#define GRN_FLASH PORTB ^= 0x02
44
 
43
 
45
#define SYSCLK F_CPU
44
#define SYSCLK F_CPU
46
 
45
 
47
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
46
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
48
 
47
 
49
#define J3High    PORTD |= 0x20
48
#define J3High    PORTD |= 0x20
50
#define J3Low     PORTD &= ~0x20
49
#define J3Low     PORTD &= ~0x20
51
#define J4High    PORTD |= 0x10
50
#define J4High    PORTD |= 0x10
52
#define J4Low     PORTD &= ~0x10
51
#define J4Low     PORTD &= ~0x10
53
#define J5High    PORTD |= 0x08
52
#define J5High    PORTD |= 0x08
54
#define J5Low     PORTD &= ~0x08
53
#define J5Low     PORTD &= ~0x08
55
 
54
 
56
extern volatile unsigned char SenderOkay;
55
extern volatile unsigned char SenderOkay;
57
extern unsigned char BattLowVoltageWarning;
56
extern unsigned char BattLowVoltageWarning;
58
extern unsigned char CosinusNickWinkel, CosinusRollWinkel;
57
extern unsigned char CosinusNickWinkel, CosinusRollWinkel;
59
extern unsigned char PlatinenVersion;
58
extern unsigned char PlatinenVersion;
60
extern unsigned char SendVersionToNavi;
59
extern unsigned char SendVersionToNavi;
61
extern unsigned char FoundMotors;
60
extern unsigned char FoundMotors;
62
extern unsigned char JetiBeep;
61
extern unsigned char JetiBeep;
63
void LipoDetection(unsigned char print);
62
void LipoDetection(unsigned char print);
64
extern unsigned int FlugMinuten,FlugMinutenGesamt,FlugSekunden;
63
extern unsigned int FlugMinuten,FlugMinutenGesamt,FlugSekunden;
65
#include <avr/pgmspace.h>
64
#include <avr/pgmspace.h>
66
 
65
 
67
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
66
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
68
 
67
 
69
#endif
68
#endif
70
 
69
 
71
#include <stdlib.h>
70
#include <stdlib.h>
72
#include <string.h>
71
#include <string.h>
73
#include <avr/io.h>
72
#include <avr/io.h>
74
#include <avr/pgmspace.h>
73
#include <avr/pgmspace.h>
75
#include <avr/interrupt.h>
74
#include <avr/interrupt.h>
76
#include <avr/eeprom.h>
75
#include <avr/eeprom.h>
77
#include <avr/boot.h>
76
#include <avr/boot.h>
78
#include <avr/wdt.h>
77
#include <avr/wdt.h>
79
 
78
 
80
#include "old_macros.h"
79
#include "old_macros.h"
81
 
80
 
82
#include "printf_P.h"
81
#include "printf_P.h"
83
#include "timer0.h"
82
#include "timer0.h"
84
#include "uart.h"
83
#include "uart.h"
85
#include "analog.h"
84
#include "analog.h"
86
#include "twimaster.h"
85
#include "twimaster.h"
87
#include "menu.h"
86
#include "menu.h"
88
#include "rc.h"
87
#include "rc.h"
89
#include "fc.h"
88
#include "fc.h"
90
#include "gps.h"
89
#include "gps.h"
91
#include "spi.h"
90
#include "spi.h"
92
#include "led.h"
91
#include "led.h"
93
#include "spektrum.h"
92
#include "spektrum.h"
94
#include "capacity.h"
93
#include "capacity.h"
95
#include "eeprom.h"
94
#include "eeprom.h"
96
#include "libfc.h"
95
#include "libfc.h"
97
#include "hottmenu.h"
96
#include "hottmenu.h"
98
#include "debug.h"
97
#include "debug.h"
99
 
98
 
100
 
99
 
101
#endif //_MAIN_H
100
#endif //_MAIN_H
102
 
101
 
103
 
102
 
104
 
103
 
105
 
104
 
106
 
105
 
107
 
106
 
108
 
107