Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
550 | walter | 1 | #ifndef _MAIN_H |
2 | #define _MAIN_H |
||
3 | |||
4 | |||
5 | #define MM3IS 0x01 //iuf define is set MM3 is used, put in comment to switch back to cmps Compass module |
||
6 | |||
7 | //Hier die Quarz Frequenz einstellen |
||
8 | #if defined (__AVR_ATmega32__) |
||
9 | #define SYSCLK 20000000L //Quarz Frequenz in Hz |
||
10 | #endif |
||
11 | |||
12 | #if defined (__AVR_ATmega644__) |
||
13 | #define SYSCLK 20000000L //Quarz Frequenz in Hz |
||
14 | //#define SYSCLK 16000000L //Quarz Frequenz in Hz |
||
15 | #endif |
||
16 | |||
17 | #if defined (__AVR_ATmega644P__) |
||
18 | #define SYSCLK 20000000L //Quarz Frequenz in Hz |
||
19 | //#define SYSCLK 16000000L //Quarz Frequenz in Hz |
||
20 | #endif |
||
21 | |||
22 | // neue Hardware |
||
23 | #define ROT_OFF {if(PlatinenVersion == 10) PORTB &=~0x01; else PORTB |= 0x01;} |
||
24 | #define ROT_ON {if(PlatinenVersion == 10) PORTB |= 0x01; else PORTB &=~0x01;} |
||
25 | #define ROT_FLASH PORTB ^= 0x01 |
||
26 | #define GRN_OFF PORTB &=~0x02 |
||
27 | #define GRN_ON PORTB |= 0x02 |
||
28 | #define GRN_FLASH PORTB ^= 0x02 |
||
29 | #define LED1_OFF PORTC &=~0x04 //Erweiterung von Smartie aus dem MK-Forum vom 14.06.07. Dadurch können die Transistorausgänge J16 und J17 geschaltet werden. // (160607Kr) |
||
30 | #define LED1_ON PORTC |= 0x04 //Erweiterung von Smartie aus dem MK-Forum vom 14.06.07. Dadurch können die Transistorausgänge J16 und J17 geschaltet werden. // (160607Kr) |
||
31 | #define LED1_FLASH PORTC ^= 0x04 //Erweiterung by 4ndreas aus mikrosvn branches // (280807Kr) |
||
32 | #define LED2_OFF PORTC &=~0x08 //Erweiterung von Smartie aus dem MK-Forum vom 14.06.07. Dadurch können die Transistorausgänge J16 und J17 geschaltet werden. // (160607Kr) |
||
33 | #define LED2_ON PORTC |= 0x08 //Erweiterung von Smartie aus dem MK-Forum vom 14.06.07. Dadurch können die Transistorausgänge J16 und J17 geschaltet werden. // (160607Kr) |
||
34 | #define LED2_FLASH PORTC ^= 0x08 //Erweiterung by 4ndreas aus mikrosvn branches // (280807Kr) |
||
35 | |||
36 | #define F_CPU SYSCLK |
||
37 | //#ifndef F_CPU |
||
38 | //#error ################## F_CPU nicht definiert oder ungültig ############# |
||
39 | //#endif |
||
40 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
41 | |||
42 | #define EEPROM_ADR_VALID 1 |
||
43 | #define EEPROM_ADR_ACTIVE_SET 2 |
||
44 | #define EEPROM_ADR_LAST_OFFSET 3 |
||
45 | |||
46 | #define EEPROM_ADR_ACC_NICK 4 |
||
47 | #define EEPROM_ADR_ACC_ROLL 6 |
||
48 | #define EEPROM_ADR_ACC_Z 8 |
||
49 | |||
50 | #define EEPROM_ADR_PARAM_BEGIN 100 |
||
51 | |||
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 |
||
60 | |||
61 | #define CFG_LOOP_OBEN 0x01 |
||
62 | #define CFG_LOOP_UNTEN 0x02 |
||
63 | #define CFG_LOOP_LINKS 0x04 |
||
64 | #define CFG_LOOP_RECHTS 0x08 |
||
65 | |||
66 | //#define SYSCLK |
||
67 | //extern unsigned long SYSCLK; |
||
68 | extern volatile int i_Nick[20],i_Roll[20],DiffNick,DiffRoll; |
||
69 | extern volatile unsigned char SenderOkay; |
||
70 | extern unsigned char CosinusNickWinkel, CosinusRollWinkel; |
||
71 | extern unsigned char PlatinenVersion; |
||
72 | |||
73 | void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length); |
||
74 | void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length); |
||
75 | extern unsigned char GetActiveParamSetNumber(void); |
||
76 | extern unsigned char EEPromArray[]; |
||
77 | |||
78 | volatile int P_GPS_Verstaerkung; //P-Anteil (80-120) |
||
79 | volatile int D_GPS_Verstaerkung; //D-Anteil (90) |
||
80 | |||
81 | #include <stdlib.h> |
||
82 | #include <string.h> |
||
83 | #include <avr/io.h> |
||
84 | #include <avr/pgmspace.h> |
||
85 | #include <avr/interrupt.h> |
||
86 | #include <avr/eeprom.h> |
||
87 | #include <avr/boot.h> |
||
88 | #include <avr/wdt.h> |
||
89 | |||
90 | #include "old_macros.h" |
||
91 | |||
92 | #include "_Settings.h" |
||
93 | #include "printf_P.h" |
||
94 | #include "timer0.h" |
||
95 | #include "uart.h" |
||
96 | #include "analog.h" |
||
97 | #include "twimaster.h" |
||
98 | #include "menu.h" |
||
99 | #include "rc.h" |
||
100 | #include "fc.h" |
||
101 | #include "gps.h" |
||
102 | #include "spi.h" |
||
103 | #include "mymath.h" |
||
104 | |||
105 | |||
106 | #ifdef MM3IS |
||
107 | #include "compass.h" |
||
108 | #endif |
||
109 | |||
110 | |||
111 | #ifndef EEMEM |
||
112 | #define EEMEM __attribute__ ((section (".eeprom"))) |
||
113 | #endif |
||
114 | |||
115 | #define DEBUG_DISPLAY_INTERVALL 123 // in ms |
||
116 | |||
117 | |||
118 | #define DELAY_US(x) ((unsigned int)( (x) * 1e-6 * F_CPU )) |
||
119 | |||
120 | #endif //_MAIN_H |
||
121 | |||
122 | |||
123 | |||
124 | |||
125 | |||
126 |