Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1184 | pangu | 1 | #ifndef _MAIN_H |
2 | #define _MAIN_H |
||
3 | |||
4 | //#define QUADRO |
||
5 | //#define OCTO // 2 Arms in Front |
||
6 | //#define OCTO2 // 1 Arm in front |
||
7 | //#define OCTO3 // 1 Arm with two Motors in front or Coax |
||
8 | #define HEXA1 // 1 Arm in front (+-Config) |
||
9 | //#define HEXA2 // 2 Arms in front (X-Config) |
||
10 | //+++++++++++ |
||
11 | // Quadro: |
||
12 | // 1 |
||
13 | // 4 3 |
||
14 | // 2 |
||
15 | //+++++++++++ |
||
16 | // Reverse Props on 1 2 |
||
17 | |||
18 | //+++++++++++ |
||
19 | // Octo: |
||
20 | // 1 2 |
||
21 | // 8 3 |
||
22 | // 7 4 |
||
23 | // 6 5 |
||
24 | //+++++++++++ |
||
25 | |||
26 | //+++++++++++ |
||
27 | // Octo2: |
||
28 | // 1 |
||
29 | // 8 2 |
||
30 | // 7 3 |
||
31 | // 6 4 |
||
32 | // 5 |
||
33 | //+++++++++++ |
||
34 | |||
35 | //+++++++++++ |
||
36 | // Octo3: |
||
37 | // 1 |
||
38 | // 2 |
||
39 | // 8 7 3 4 |
||
40 | // 5 |
||
41 | // 6 |
||
42 | //+++++++++++ |
||
43 | // Reverse Props on octo: 1 3 5 7 |
||
44 | // ++++++++++ |
||
45 | // Hexa1: "+"-Configuration |
||
46 | // 6 |
||
47 | // 4 1 |
||
48 | // 2 3 |
||
49 | // 5 |
||
50 | // ++++++++++ |
||
51 | // Hexa1: "X"-Configuration |
||
52 | // 1 3 |
||
53 | // 6 5 |
||
54 | // 4 2 |
||
55 | // |
||
56 | // reverse props on Hexa: 1,4,5 |
||
57 | // ++++++++++ |
||
58 | |||
59 | //Hier die Quarz Frequenz einstellen |
||
60 | #if defined (__AVR_ATmega32__) |
||
61 | #define SYSCLK 20000000L //Quarz Frequenz in Hz |
||
62 | #endif |
||
63 | |||
64 | #if defined (__AVR_ATmega644__) |
||
65 | #define SYSCLK 20000000L //Quarz Frequenz in Hz |
||
66 | #endif |
||
67 | |||
68 | #if defined (__AVR_ATmega644P__) |
||
69 | #define SYSCLK 20000000L //Quarz Frequenz in Hz |
||
70 | #endif |
||
71 | |||
72 | // neue Hardware |
||
73 | #define ROT_OFF {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB &=~0x01; else PORTB |= 0x01;} |
||
74 | #define ROT_ON {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB |= 0x01; else PORTB &=~0x01;} |
||
75 | #define ROT_FLASH PORTB ^= 0x01 |
||
76 | #define GRN_OFF {if((PlatinenVersion < 12)) PORTB &=~0x02; else PORTB |= 0x02;} |
||
77 | #define GRN_ON {if((PlatinenVersion < 12)) PORTB |= 0x02; else PORTB &=~0x02;} |
||
78 | #define GRN_FLASH PORTB ^= 0x02 |
||
79 | |||
80 | #define F_CPU SYSCLK |
||
81 | //#ifndef F_CPU |
||
82 | //#error ################## F_CPU nicht definiert oder ungültig ############# |
||
83 | //#endif |
||
84 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
85 | #define EE_DATENREVISION 74 // wird angepasst, wenn sich die EEPROM-Daten geändert haben |
||
86 | |||
87 | #define EEPROM_ADR_VALID 1 |
||
88 | #define EEPROM_ADR_ACTIVE_SET 2 |
||
89 | #define EEPROM_ADR_LAST_OFFSET 3 |
||
90 | |||
91 | #define EEPROM_ADR_ACC_NICK 4 |
||
92 | #define EEPROM_ADR_ACC_ROLL 6 |
||
93 | #define EEPROM_ADR_ACC_Z 8 |
||
94 | |||
95 | #define EEPROM_ADR_CHANNELS 80 |
||
96 | |||
97 | #define EEPROM_ADR_PARAM_LENGTH 98 |
||
98 | #define EEPROM_ADR_PARAM_BEGIN 100 |
||
99 | |||
100 | #define CFG_HOEHENREGELUNG 0x01 |
||
101 | #define CFG_HOEHEN_SCHALTER 0x02 |
||
102 | #define CFG_HEADING_HOLD 0x04 |
||
103 | #define CFG_KOMPASS_AKTIV 0x08 |
||
104 | #define CFG_KOMPASS_FIX 0x10 |
||
105 | #define CFG_GPS_AKTIV 0x20 |
||
106 | #define CFG_ACHSENKOPPLUNG_AKTIV 0x40 |
||
107 | #define CFG_DREHRATEN_BEGRENZER 0x80 |
||
108 | |||
109 | #define CFG_LOOP_OBEN 0x01 |
||
110 | #define CFG_LOOP_UNTEN 0x02 |
||
111 | #define CFG_LOOP_LINKS 0x04 |
||
112 | #define CFG_LOOP_RECHTS 0x08 |
||
113 | #define CFG_HIGHT_3SWITCH 0x10 |
||
114 | |||
115 | #define J3High PORTD |= 0x20 |
||
116 | #define J3Low PORTD &= ~0x20 |
||
117 | #define J4High PORTD |= 0x10 |
||
118 | #define J4Low PORTD &= ~0x10 |
||
119 | #define J5High PORTD |= 0x08 |
||
120 | #define J5Low PORTD &= ~0x08 |
||
121 | |||
122 | |||
123 | //#define SYSCLK |
||
124 | //extern unsigned long SYSCLK; |
||
125 | extern volatile unsigned char SenderOkay; |
||
126 | extern unsigned char CosinusNickWinkel, CosinusRollWinkel; |
||
127 | extern unsigned char PlatinenVersion; |
||
128 | extern unsigned char SendVersionToNavi; |
||
129 | void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length); |
||
130 | void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length); |
||
131 | extern unsigned char GetActiveParamSetNumber(void); |
||
132 | void SetActiveParamSetNumber(unsigned char number); |
||
133 | extern unsigned char EEPromArray[]; |
||
134 | |||
135 | #include <stdlib.h> |
||
136 | #include <string.h> |
||
137 | #include <avr/io.h> |
||
138 | #include <avr/pgmspace.h> |
||
139 | #include <avr/interrupt.h> |
||
140 | #include <avr/eeprom.h> |
||
141 | #include <avr/boot.h> |
||
142 | #include <avr/wdt.h> |
||
143 | |||
144 | #include "old_macros.h" |
||
145 | |||
146 | #include "_Settings.h" |
||
147 | #include "printf_P.h" |
||
148 | #include "timer0.h" |
||
149 | #include "uart.h" |
||
150 | #include "analog.h" |
||
151 | #include "twimaster.h" |
||
152 | #include "menu.h" |
||
153 | #include "rc.h" |
||
154 | #include "fc.h" |
||
155 | #include "gps.h" |
||
156 | #include "spi.h" |
||
157 | #include "led.h" |
||
158 | |||
159 | #ifndef EEMEM |
||
160 | #define EEMEM __attribute__ ((section (".eeprom"))) |
||
161 | #endif |
||
162 | |||
163 | #define DEBUG_DISPLAY_INTERVALL 123 // in ms |
||
164 | |||
165 | |||
166 | #define DELAY_US(x) ((unsigned int)( (x) * 1e-6 * F_CPU )) |
||
167 | |||
168 | #endif //_MAIN_H |
||
169 | |||
170 | |||
171 | |||
172 | |||
173 | |||
174 |