Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
308 | osiair | 1 | #ifndef _MAIN_H |
2 | #define _MAIN_H |
||
3 | |||
4 | //Hier die Quarz Frequenz einstellen |
||
5 | #if defined (__AVR_ATmega32__) |
||
6 | #define SYSCLK 20000000L //Quarz Frequenz in Hz |
||
7 | #endif |
||
8 | |||
9 | #if defined (__AVR_ATmega644__) |
||
10 | #define SYSCLK 20000000L //Quarz Frequenz in Hz |
||
11 | //#define SYSCLK 16000000L //Quarz Frequenz in Hz |
||
12 | #endif |
||
13 | |||
14 | |||
15 | // neue Hardware |
||
16 | #define ROT_OFF PORTB &=~0x01 |
||
17 | #define ROT_ON PORTB |= 0x01 |
||
18 | #define ROT_FLASH PORTB ^= 0x01 |
||
19 | #define GRN_OFF PORTB &=~0x02 |
||
20 | #define GRN_ON PORTB |= 0x02 |
||
21 | #define GRN_FLASH PORTB ^= 0x02 //ACHTUNG: HIER SCHIEN NOCH EIN FEHLER IM AUSGEWÄHLTEN PORT ZU BESTEHEN. URSPRÜNGLICH WAR PORTD UND NICHT PORTB DEFINIERT // (280807Kr) |
||
22 | #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) |
||
23 | #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) |
||
24 | #define LED1_FLASH PORTC ^= 0x04 //Erweiterung by 4ndreas aus mikrosvn branches // (280807Kr) |
||
25 | #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) |
||
26 | #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) |
||
27 | #define LED2_FLASH PORTC ^= 0x08 //Erweiterung by 4ndreas aus mikrosvn branches // (280807Kr) |
||
28 | |||
29 | //#ifndef F_CPU |
||
30 | //#error ################## F_CPU nicht definiert oder ungültig ############# |
||
31 | //#endif |
||
32 | |||
33 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
34 | |||
35 | //#define ANZ_MITTELWERT 4 |
||
36 | |||
37 | #define EEPROM_ADR_VALID 1 |
||
38 | #define EEPROM_ADR_ACTIVE_SET 2 |
||
39 | |||
40 | #define EEPROM_ADR_PARAM_BEGIN 100 |
||
41 | |||
42 | #define CFG_HOEHENREGELUNG 0x01 |
||
43 | #define CFG_HOEHEN_SCHALTER 0x02 |
||
44 | #define CFG_HEADING_HOLD 0x04 |
||
45 | #define CFG_KOMPASS_AKTIV 0x08 |
||
46 | #define CFG_KOMPASS_FIX 0x10 |
||
47 | #define CFG_GPS_AKTIV 0x20 |
||
48 | |||
49 | |||
50 | //#define SYSCLK |
||
51 | //extern unsigned long SYSCLK; |
||
52 | extern volatile int i_Nick[20],i_Roll[20],DiffNick,DiffRoll; |
||
53 | extern volatile unsigned char SenderOkay; |
||
54 | extern unsigned char CosinusNickWinkel, CosinusRollWinkel; |
||
55 | |||
56 | extern void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length); |
||
57 | extern void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length); |
||
58 | extern unsigned char GetActiveParamSetNumber(void); |
||
59 | extern unsigned char EEPromArray[]; |
||
60 | |||
61 | long durchschnitt_northing; |
||
62 | long durchschnitt_easting; |
||
63 | |||
64 | volatile int P_GPS_Verstaerkung; //P-Anteil (80-120) |
||
65 | volatile int D_GPS_Verstaerkung; //D-Anteil (90) |
||
66 | |||
67 | #include <stdlib.h> |
||
68 | #include <string.h> |
||
69 | #include <avr/io.h> |
||
70 | #include <avr/pgmspace.h> |
||
71 | #include <avr/interrupt.h> |
||
72 | #include <avr/eeprom.h> |
||
73 | #include <avr/boot.h> |
||
74 | #include <avr/wdt.h> |
||
75 | |||
76 | #include "old_macros.h" |
||
77 | |||
78 | #include "_Settings.h" |
||
79 | #include "printf_P.h" |
||
80 | #include "compass.h" |
||
81 | #include "timer0.h" |
||
82 | #include "uart.h" |
||
83 | #include "analog.h" |
||
84 | #include "twimaster.h" |
||
85 | #include "menu.h" |
||
86 | #include "rc.h" |
||
87 | #include "fc.h" |
||
88 | #include "gps.h" |
||
89 | #include "math.h" |
||
90 | |||
91 | #ifndef EEMEM |
||
92 | #define EEMEM __attribute__ ((section (".eeprom"))) |
||
93 | #endif |
||
94 | |||
95 | #define DEBUG_DISPLAY_INTERVALL 123 // in ms |
||
96 | |||
97 | |||
98 | #define DELAY_US(x) ((unsigned int)( (x) * 1e-6 * F_CPU )) |
||
99 | |||
100 | #endif //_MAIN_H |