Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | ingob | 1 | #ifndef _MAIN_H |
2 | #define _MAIN_H |
||
3 | |||
1176 | hbuss | 4 | #define QUADRO |
1111 | hbuss | 5 | |
1 | ingob | 6 | //Hier die Quarz Frequenz einstellen |
7 | #if defined (__AVR_ATmega32__) |
||
8 | #define SYSCLK 20000000L //Quarz Frequenz in Hz |
||
9 | #endif |
||
10 | |||
11 | #if defined (__AVR_ATmega644__) |
||
12 | #define SYSCLK 20000000L //Quarz Frequenz in Hz |
||
13 | #endif |
||
14 | |||
1171 | hbuss | 15 | #if defined (__AVR_ATmega644P__) |
16 | #define SYSCLK 20000000L //Quarz Frequenz in Hz |
||
17 | #endif |
||
18 | |||
1 | ingob | 19 | // neue Hardware |
1021 | hbuss | 20 | #define ROT_OFF {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB &=~0x01; else PORTB |= 0x01;} |
21 | #define ROT_ON {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB |= 0x01; else PORTB &=~0x01;} |
||
1 | ingob | 22 | #define ROT_FLASH PORTB ^= 0x01 |
1058 | killagreg | 23 | #define GRN_OFF {if((PlatinenVersion < 12)) PORTB &=~0x02; else PORTB |= 0x02;} |
24 | #define GRN_ON {if((PlatinenVersion < 12)) PORTB |= 0x02; else PORTB &=~0x02;} |
||
173 | holgerb | 25 | #define GRN_FLASH PORTB ^= 0x02 |
1 | ingob | 26 | |
304 | ingob | 27 | #define F_CPU SYSCLK |
1 | ingob | 28 | //#ifndef F_CPU |
29 | //#error ################## F_CPU nicht definiert oder ungültig ############# |
||
30 | //#endif |
||
31 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
1283 | hbuss | 32 | #define EE_DATENREVISION 78 // wird angepasst, wenn sich die EEPROM-Daten geändert haben |
1211 | hbuss | 33 | #define MIXER_REVISION 1 // wird angepasst, wenn sich die Mixer-Daten geändert haben |
1 | ingob | 34 | |
35 | #define EEPROM_ADR_VALID 1 |
||
36 | #define EEPROM_ADR_ACTIVE_SET 2 |
||
173 | holgerb | 37 | #define EEPROM_ADR_LAST_OFFSET 3 |
1 | ingob | 38 | |
513 | hbuss | 39 | #define EEPROM_ADR_ACC_NICK 4 |
40 | #define EEPROM_ADR_ACC_ROLL 6 |
||
41 | #define EEPROM_ADR_ACC_Z 8 |
||
1298 | hbuss | 42 | #define EEPROM_ADR_MINUTES 10 |
43 | #define EEPROM_ADR_MINUTES2 14 |
||
513 | hbuss | 44 | |
1171 | hbuss | 45 | #define EEPROM_ADR_CHANNELS 80 |
46 | |||
47 | #define EEPROM_ADR_PARAM_LENGTH 98 |
||
1 | ingob | 48 | #define EEPROM_ADR_PARAM_BEGIN 100 |
49 | |||
1211 | hbuss | 50 | #define EEPROM_ADR_MIXER_TABLE 1000 // 1001 - 1100 |
1209 | hbuss | 51 | |
395 | hbuss | 52 | #define CFG_HOEHENREGELUNG 0x01 |
53 | #define CFG_HOEHEN_SCHALTER 0x02 |
||
54 | #define CFG_HEADING_HOLD 0x04 |
||
55 | #define CFG_KOMPASS_AKTIV 0x08 |
||
56 | #define CFG_KOMPASS_FIX 0x10 |
||
57 | #define CFG_GPS_AKTIV 0x20 |
||
58 | #define CFG_ACHSENKOPPLUNG_AKTIV 0x40 |
||
59 | #define CFG_DREHRATEN_BEGRENZER 0x80 |
||
1 | ingob | 60 | |
173 | holgerb | 61 | #define CFG_LOOP_OBEN 0x01 |
62 | #define CFG_LOOP_UNTEN 0x02 |
||
63 | #define CFG_LOOP_LINKS 0x04 |
||
64 | #define CFG_LOOP_RECHTS 0x08 |
||
1272 | hbuss | 65 | #define CFG_MOTOR_BLINK 0x10 |
1216 | killagreg | 66 | #define CFG_RES2 0x20 |
67 | #define CFG_RES3 0x40 |
||
68 | #define CFG_RES4 0x80 |
||
1 | ingob | 69 | |
1155 | hbuss | 70 | #define J3High PORTD |= 0x20 |
71 | #define J3Low PORTD &= ~0x20 |
||
72 | #define J4High PORTD |= 0x10 |
||
73 | #define J4Low PORTD &= ~0x10 |
||
74 | #define J5High PORTD |= 0x08 |
||
75 | #define J5Low PORTD &= ~0x08 |
||
76 | |||
77 | |||
1058 | killagreg | 78 | //#define SYSCLK |
1 | ingob | 79 | //extern unsigned long SYSCLK; |
80 | extern volatile unsigned char SenderOkay; |
||
1236 | killagreg | 81 | extern unsigned char BattLowVoltageWarning; |
1 | ingob | 82 | extern unsigned char CosinusNickWinkel, CosinusRollWinkel; |
173 | holgerb | 83 | extern unsigned char PlatinenVersion; |
723 | hbuss | 84 | extern unsigned char SendVersionToNavi; |
304 | ingob | 85 | void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length); |
86 | void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length); |
||
1 | ingob | 87 | extern unsigned char GetActiveParamSetNumber(void); |
1063 | killagreg | 88 | void SetActiveParamSetNumber(unsigned char number); |
1268 | hbuss | 89 | void LipoDetection(unsigned char print); |
1 | ingob | 90 | extern unsigned char EEPromArray[]; |
1298 | hbuss | 91 | extern unsigned int FlugMinuten,FlugMinutenGesamt; |
1 | ingob | 92 | |
93 | #include <stdlib.h> |
||
94 | #include <string.h> |
||
95 | #include <avr/io.h> |
||
96 | #include <avr/pgmspace.h> |
||
97 | #include <avr/interrupt.h> |
||
98 | #include <avr/eeprom.h> |
||
99 | #include <avr/boot.h> |
||
100 | #include <avr/wdt.h> |
||
101 | |||
102 | #include "old_macros.h" |
||
103 | |||
395 | hbuss | 104 | #include "_Settings.h" |
1 | ingob | 105 | #include "printf_P.h" |
106 | #include "timer0.h" |
||
107 | #include "uart.h" |
||
108 | #include "analog.h" |
||
109 | #include "twimaster.h" |
||
110 | #include "menu.h" |
||
111 | #include "rc.h" |
||
112 | #include "fc.h" |
||
113 | #include "gps.h" |
||
304 | ingob | 114 | #include "spi.h" |
921 | hbuss | 115 | #include "led.h" |
1 | ingob | 116 | |
117 | #ifndef EEMEM |
||
118 | #define EEMEM __attribute__ ((section (".eeprom"))) |
||
119 | #endif |
||
120 | |||
121 | #define DEBUG_DISPLAY_INTERVALL 123 // in ms |
||
122 | |||
123 | |||
124 | #define DELAY_US(x) ((unsigned int)( (x) * 1e-6 * F_CPU )) |
||
1058 | killagreg | 125 | |
1 | ingob | 126 | #endif //_MAIN_H |
127 | |||
128 | |||
129 | |||
130 | |||
131 | |||
132 |