Rev 1486 | Rev 1595 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1486 | Rev 1512 | ||
---|---|---|---|
1 | #ifndef _MAIN_H |
1 | #ifndef _MAIN_H |
2 | #define _MAIN_H |
2 | #define _MAIN_H |
3 | 3 | ||
4 | #define QUADRO |
4 | #define QUADRO |
5 | 5 | ||
6 | //#define ACT_S3D_SUMMENSIGNAL |
6 | //#define ACT_S3D_SUMMENSIGNAL |
7 | 7 | ||
8 | // neue Hardware |
8 | // neue Hardware |
9 | #define ROT_OFF {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB &=~0x01; else PORTB |= 0x01;} |
9 | #define ROT_OFF {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB &=~0x01; else PORTB |= 0x01;} |
10 | #define ROT_ON {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB |= 0x01; else PORTB &=~0x01;} |
10 | #define ROT_ON {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB |= 0x01; else PORTB &=~0x01;} |
11 | #define ROT_FLASH PORTB ^= 0x01 |
11 | #define ROT_FLASH PORTB ^= 0x01 |
12 | #define GRN_OFF {if((PlatinenVersion < 12)) PORTB &=~0x02; else PORTB |= 0x02;} |
12 | #define GRN_OFF {if((PlatinenVersion < 12)) PORTB &=~0x02; else PORTB |= 0x02;} |
13 | #define GRN_ON {if((PlatinenVersion < 12)) PORTB |= 0x02; else PORTB &=~0x02;} |
13 | #define GRN_ON {if((PlatinenVersion < 12)) PORTB |= 0x02; else PORTB &=~0x02;} |
14 | #define GRN_FLASH PORTB ^= 0x02 |
14 | #define GRN_FLASH PORTB ^= 0x02 |
15 | 15 | ||
16 | #define SYSCLK F_CPU |
16 | #define SYSCLK F_CPU |
17 | 17 | ||
18 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
18 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
19 | #define EE_DATENREVISION 82 // Parameter fürs Koptertool; wird angepasst, wenn sich die EEPROM-Daten geändert haben |
19 | #define EE_DATENREVISION 82 // Parameter fürs Koptertool; wird angepasst, wenn sich die EEPROM-Daten geändert haben |
20 | #define MIXER_REVISION 1 // wird angepasst, wenn sich die Mixer-Daten geändert haben |
20 | #define MIXER_REVISION 1 // wird angepasst, wenn sich die Mixer-Daten geändert haben |
21 | 21 | ||
22 | #define EEPROM_ADR_VALID 1 |
22 | #define EEPROM_ADR_VALID 1 |
23 | #define EEPROM_ADR_ACTIVE_SET 2 |
23 | #define EEPROM_ADR_ACTIVE_SET 2 |
24 | #define EEPROM_ADR_LAST_OFFSET 3 |
24 | #define EEPROM_ADR_LAST_OFFSET 3 |
25 | 25 | ||
26 | #define EEPROM_ADR_ACC_NICK 4 |
26 | #define EEPROM_ADR_ACC_NICK 4 |
27 | #define EEPROM_ADR_ACC_ROLL 6 |
27 | #define EEPROM_ADR_ACC_ROLL 6 |
28 | #define EEPROM_ADR_ACC_Z 8 |
28 | #define EEPROM_ADR_ACC_Z 8 |
29 | #define EEPROM_ADR_MINUTES 10 |
29 | #define EEPROM_ADR_MINUTES 10 |
30 | #define EEPROM_ADR_MINUTES2 14 |
30 | #define EEPROM_ADR_MINUTES2 14 |
31 | 31 | ||
32 | #define EEPROM_ADR_CHANNELS 80 |
32 | #define EEPROM_ADR_CHANNELS 80 |
33 | 33 | ||
34 | #define EEPROM_ADR_PARAM_LENGTH 98 |
34 | #define EEPROM_ADR_PARAM_LENGTH 98 |
35 | #define EEPROM_ADR_PARAM_BEGIN 100 |
35 | #define EEPROM_ADR_PARAM_BEGIN 100 |
36 | 36 | ||
37 | #define EEPROM_ADR_MIXER_TABLE 1000 // 1001 - 1100 |
37 | #define EEPROM_ADR_MIXER_TABLE 1000 // 1001 - 1100 |
38 | 38 | ||
39 | #define CFG_HOEHENREGELUNG 0x01 |
39 | #define CFG_HOEHENREGELUNG 0x01 |
40 | #define CFG_HOEHEN_SCHALTER 0x02 |
40 | #define CFG_HOEHEN_SCHALTER 0x02 |
41 | #define CFG_HEADING_HOLD 0x04 |
41 | #define CFG_HEADING_HOLD 0x04 |
42 | #define CFG_KOMPASS_AKTIV 0x08 |
42 | #define CFG_KOMPASS_AKTIV 0x08 |
43 | #define CFG_KOMPASS_FIX 0x10 |
43 | #define CFG_KOMPASS_FIX 0x10 |
44 | #define CFG_GPS_AKTIV 0x20 |
44 | #define CFG_GPS_AKTIV 0x20 |
45 | #define CFG_ACHSENKOPPLUNG_AKTIV 0x40 |
45 | #define CFG_ACHSENKOPPLUNG_AKTIV 0x40 |
46 | #define CFG_DREHRATEN_BEGRENZER 0x80 |
46 | #define CFG_DREHRATEN_BEGRENZER 0x80 |
47 | 47 | ||
48 | #define CFG_LOOP_OBEN 0x01 |
48 | #define CFG_LOOP_OBEN 0x01 |
49 | #define CFG_LOOP_UNTEN 0x02 |
49 | #define CFG_LOOP_UNTEN 0x02 |
50 | #define CFG_LOOP_LINKS 0x04 |
50 | #define CFG_LOOP_LINKS 0x04 |
51 | #define CFG_LOOP_RECHTS 0x08 |
51 | #define CFG_LOOP_RECHTS 0x08 |
52 | #define CFG_MOTOR_BLINK 0x10 |
52 | #define CFG_MOTOR_BLINK 0x10 |
53 | #define CFG_MOTOR_OFF_LED1 0x20 |
53 | #define CFG_MOTOR_OFF_LED1 0x20 |
54 | #define CFG_MOTOR_OFF_LED2 0x40 |
54 | #define CFG_MOTOR_OFF_LED2 0x40 |
55 | #define CFG_RES4 0x80 |
55 | #define CFG_RES4 0x80 |
56 | 56 | ||
57 | #define CFG2_HEIGHT_LIMIT 0x01 |
57 | #define CFG2_HEIGHT_LIMIT 0x01 |
58 | #define CFG2_VARIO_BEEP 0x02 |
58 | #define CFG2_VARIO_BEEP 0x02 |
59 | #define CFG_SENSITIVE_RC 0x04 |
59 | #define CFG_SENSITIVE_RC 0x04 |
60 | 60 | ||
61 | #define RECEIVER_PPM 0 |
61 | #define RECEIVER_PPM 0 |
62 | #define RECEIVER_SPEKTRUM 1 |
62 | #define RECEIVER_SPEKTRUM 1 |
63 | #define RECEIVER_SPEKTRUM_HI_RES 2 |
63 | #define RECEIVER_SPEKTRUM_HI_RES 2 |
64 | #define RECEIVER_SPEKTRUM_LOW_RES 3 |
64 | #define RECEIVER_SPEKTRUM_LOW_RES 3 |
65 | #define RECEIVER_JETI 4 |
65 | #define RECEIVER_JETI 4 |
66 | #define RECEIVER_ACT_DSL 5 |
66 | #define RECEIVER_ACT_DSL 5 |
67 | #define RECEIVER_UNKNOWN 0xFF |
67 | #define RECEIVER_UNKNOWN 0xFF |
68 | 68 | ||
69 | #define J3High PORTD |= 0x20 |
69 | #define J3High PORTD |= 0x20 |
70 | #define J3Low PORTD &= ~0x20 |
70 | #define J3Low PORTD &= ~0x20 |
71 | #define J4High PORTD |= 0x10 |
71 | #define J4High PORTD |= 0x10 |
72 | #define J4Low PORTD &= ~0x10 |
72 | #define J4Low PORTD &= ~0x10 |
73 | #define J5High PORTD |= 0x08 |
73 | #define J5High PORTD |= 0x08 |
74 | #define J5Low PORTD &= ~0x08 |
74 | #define J5Low PORTD &= ~0x08 |
75 | 75 | ||
76 | extern volatile unsigned char SenderOkay; |
76 | extern volatile unsigned char SenderOkay; |
77 | extern unsigned char BattLowVoltageWarning; |
77 | extern unsigned char BattLowVoltageWarning; |
78 | extern unsigned char CosinusNickWinkel, CosinusRollWinkel; |
78 | extern unsigned char CosinusNickWinkel, CosinusRollWinkel; |
79 | extern unsigned char PlatinenVersion; |
79 | extern unsigned char PlatinenVersion; |
80 | extern unsigned char SendVersionToNavi; |
80 | extern unsigned char SendVersionToNavi; |
81 | void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length); |
81 | void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length); |
82 | void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length); |
82 | void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length); |
83 | extern unsigned char GetActiveParamSetNumber(void); |
83 | extern unsigned char GetActiveParamSetNumber(void); |
84 | void SetActiveParamSetNumber(unsigned char number); |
84 | void SetActiveParamSetNumber(unsigned char number); |
85 | void LipoDetection(unsigned char print); |
85 | void LipoDetection(unsigned char print); |
86 | extern unsigned char EEPromArray[]; |
86 | extern unsigned char EEPromArray[]; |
87 | extern unsigned int FlugMinuten,FlugMinutenGesamt; |
87 | extern unsigned int FlugMinuten,FlugMinutenGesamt,FlugSekunden; |
88 | 88 | ||
89 | #include <stdlib.h> |
89 | #include <stdlib.h> |
90 | #include <string.h> |
90 | #include <string.h> |
91 | #include <avr/io.h> |
91 | #include <avr/io.h> |
92 | #include <avr/pgmspace.h> |
92 | #include <avr/pgmspace.h> |
93 | #include <avr/interrupt.h> |
93 | #include <avr/interrupt.h> |
94 | #include <avr/eeprom.h> |
94 | #include <avr/eeprom.h> |
95 | #include <avr/boot.h> |
95 | #include <avr/boot.h> |
96 | #include <avr/wdt.h> |
96 | #include <avr/wdt.h> |
97 | 97 | ||
98 | 98 | ||
99 | #include "old_macros.h" |
99 | #include "old_macros.h" |
100 | 100 | ||
101 | #include "_Settings.h" |
101 | #include "_Settings.h" |
102 | #include "printf_P.h" |
102 | #include "printf_P.h" |
103 | #include "timer0.h" |
103 | #include "timer0.h" |
104 | #include "uart.h" |
104 | #include "uart.h" |
105 | #include "analog.h" |
105 | #include "analog.h" |
106 | #include "twimaster.h" |
106 | #include "twimaster.h" |
107 | #include "menu.h" |
107 | #include "menu.h" |
108 | #include "rc.h" |
108 | #include "rc.h" |
109 | #include "fc.h" |
109 | #include "fc.h" |
110 | #include "gps.h" |
110 | #include "gps.h" |
111 | #include "spi.h" |
111 | #include "spi.h" |
112 | #include "led.h" |
112 | #include "led.h" |
113 | #include "spektrum.h" |
113 | #include "spektrum.h" |
114 | #include "capacity.h" |
114 | #include "capacity.h" |
115 | #include "libfc.h" |
115 | #include "libfc.h" |
116 | 116 | ||
117 | 117 | ||
118 | 118 | ||
119 | #ifndef EEMEM |
119 | #ifndef EEMEM |
120 | #define EEMEM __attribute__ ((section (".eeprom"))) |
120 | #define EEMEM __attribute__ ((section (".eeprom"))) |
121 | #endif |
121 | #endif |
122 | 122 | ||
123 | #define DEBUG_DISPLAY_INTERVALL 123 // in ms |
123 | #define DEBUG_DISPLAY_INTERVALL 123 // in ms |
124 | 124 | ||
125 | 125 | ||
126 | #define DELAY_US(x) ((unsigned int)( (x) * 1e-6 * F_CPU )) |
126 | #define DELAY_US(x) ((unsigned int)( (x) * 1e-6 * F_CPU )) |
127 | 127 | ||
128 | #endif //_MAIN_H |
128 | #endif //_MAIN_H |
129 | 129 | ||
130 | 130 | ||
131 | 131 | ||
132 | 132 | ||
133 | 133 | ||
134 | 134 | ||
135 | 135 |