Rev 861 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 861 | Rev 864 | ||
---|---|---|---|
1 | #ifndef _MAIN_H |
1 | #ifndef _MAIN_H |
2 | #define _MAIN_H |
2 | #define _MAIN_H |
3 | 3 | ||
4 | //Hier die Quarz Frequenz einstellen |
4 | //Hier die Quarz Frequenz einstellen |
5 | #if defined (__AVR_ATmega32__) |
5 | #if defined (__AVR_ATmega32__) |
6 | #define SYSCLK 20000000L //Quarz Frequenz in Hz |
6 | #define SYSCLK 20000000L //Quarz Frequenz in Hz |
7 | #endif |
7 | #endif |
8 | 8 | ||
9 | #if defined (__AVR_ATmega644__) |
9 | #if defined (__AVR_ATmega644__) |
10 | #define SYSCLK 20000000L //Quarz Frequenz in Hz |
10 | #define SYSCLK 20000000L //Quarz Frequenz in Hz |
11 | //#define SYSCLK 16000000L //Quarz Frequenz in Hz |
11 | //#define SYSCLK 16000000L //Quarz Frequenz in Hz |
12 | #endif |
12 | #endif |
- | 13 | ||
- | 14 | #define MAJOR_DARKMOD 0 |
|
- | 15 | #define MINOR_DARKMOD 1 |
|
13 | 16 | ||
14 | // neue Hardware |
17 | // neue Hardware |
15 | #define ROT_OFF {if(PlatinenVersion == 10) PORTB &=~0x01; else PORTB |= 0x01;} |
18 | #define ROT_OFF {if(PlatinenVersion == 10) PORTB &=~0x01; else PORTB |= 0x01;} |
16 | #define ROT_ON {if(PlatinenVersion == 10) PORTB |= 0x01; else PORTB &=~0x01;} |
19 | #define ROT_ON {if(PlatinenVersion == 10) PORTB |= 0x01; else PORTB &=~0x01;} |
17 | #define ROT_FLASH PORTB ^= 0x01 |
20 | #define ROT_FLASH PORTB ^= 0x01 |
18 | #define GRN_OFF PORTB &=~0x02 |
21 | #define GRN_OFF PORTB &=~0x02 |
19 | #define GRN_ON PORTB |= 0x02 |
22 | #define GRN_ON PORTB |= 0x02 |
20 | #define GRN_FLASH PORTB ^= 0x02 |
23 | #define GRN_FLASH PORTB ^= 0x02 |
21 | 24 | ||
22 | #define EXT1OUT_ON PORTC |= 0x04 |
25 | #define EXT1OUT_ON PORTC |= 0x04 |
23 | #define EXT1OUT_OFF PORTC &=~ 0x04 |
26 | #define EXT1OUT_OFF PORTC &=~ 0x04 |
24 | #define EXT2OUT_ON PORTC |= 0x08 |
27 | #define EXT2OUT_ON PORTC |= 0x08 |
25 | #define EXT2OUT_OFF PORTC &=~ 0x08 |
28 | #define EXT2OUT_OFF PORTC &=~ 0x08 |
26 | 29 | ||
27 | #define EXT1OUT_INV_ON EXT1OUT_OFF |
30 | #define EXT1OUT_INV_ON EXT1OUT_OFF |
28 | #define EXT1OUT_INV_OFF EXT1OUT_ON |
31 | #define EXT1OUT_INV_OFF EXT1OUT_ON |
29 | #define EXT2OUT_INV_ON EXT2OUT_OFF |
32 | #define EXT2OUT_INV_ON EXT2OUT_OFF |
30 | #define EXT2OUT_INV_OFF EXT2OUT_ON |
33 | #define EXT2OUT_INV_OFF EXT2OUT_ON |
31 | 34 | ||
32 | 35 | ||
33 | #define F_CPU SYSCLK |
36 | #define F_CPU SYSCLK |
34 | //#ifndef F_CPU |
37 | //#ifndef F_CPU |
35 | //#error ################## F_CPU nicht definiert oder ungültig ############# |
38 | //#error ################## F_CPU nicht definiert oder ungültig ############# |
36 | //#endif |
39 | //#endif |
37 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
40 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
38 | 41 | ||
39 | #define EEPROM_ADR_VALID 1 |
42 | #define EEPROM_ADR_VALID 1 |
40 | #define EEPROM_ADR_ACTIVE_SET 2 |
43 | #define EEPROM_ADR_ACTIVE_SET 2 |
41 | #define EEPROM_ADR_LAST_OFFSET 3 |
44 | #define EEPROM_ADR_LAST_OFFSET 3 |
42 | 45 | ||
43 | #define EEPROM_ADR_ACC_NICK 4 |
46 | #define EEPROM_ADR_ACC_NICK 4 |
44 | #define EEPROM_ADR_ACC_ROLL 6 |
47 | #define EEPROM_ADR_ACC_ROLL 6 |
45 | #define EEPROM_ADR_ACC_Z 8 |
48 | #define EEPROM_ADR_ACC_Z 8 |
46 | 49 | ||
47 | #define EEPROM_ADR_PARAM_BEGIN 100 |
50 | #define EEPROM_ADR_PARAM_BEGIN 100 |
48 | 51 | ||
49 | #define CFG_HOEHENREGELUNG 0x01 |
52 | #define CFG_HOEHENREGELUNG 0x01 |
50 | #define CFG_HOEHEN_SCHALTER 0x02 |
53 | #define CFG_HOEHEN_SCHALTER 0x02 |
51 | #define CFG_HEADING_HOLD 0x04 |
54 | #define CFG_HEADING_HOLD 0x04 |
52 | #define CFG_KOMPASS_AKTIV 0x08 |
55 | #define CFG_KOMPASS_AKTIV 0x08 |
53 | #define CFG_KOMPASS_FIX 0x10 |
56 | #define CFG_KOMPASS_FIX 0x10 |
54 | #define CFG_GPS_AKTIV 0x20 |
57 | #define CFG_GPS_AKTIV 0x20 |
55 | #define CFG_ACHSENKOPPLUNG_AKTIV 0x40 |
58 | #define CFG_ACHSENKOPPLUNG_AKTIV 0x40 |
56 | #define CFG_DREHRATEN_BEGRENZER 0x80 |
59 | #define CFG_DREHRATEN_BEGRENZER 0x80 |
57 | 60 | ||
58 | #define CFG_LOOP_OBEN 0x01 |
61 | #define CFG_LOOP_OBEN 0x01 |
59 | #define CFG_LOOP_UNTEN 0x02 |
62 | #define CFG_LOOP_UNTEN 0x02 |
60 | #define CFG_LOOP_LINKS 0x04 |
63 | #define CFG_LOOP_LINKS 0x04 |
61 | #define CFG_LOOP_RECHTS 0x08 |
64 | #define CFG_LOOP_RECHTS 0x08 |
62 | 65 | ||
63 | //#define SYSCLK |
66 | //#define SYSCLK |
64 | //extern unsigned long SYSCLK; |
67 | //extern unsigned long SYSCLK; |
65 | extern volatile int i_Nick[20],i_Roll[20],DiffNick,DiffRoll; |
68 | extern volatile int i_Nick[20],i_Roll[20],DiffNick,DiffRoll; |
66 | extern volatile unsigned char SenderOkay; |
69 | extern volatile unsigned char SenderOkay; |
67 | extern unsigned char CosinusNickWinkel, CosinusRollWinkel; |
70 | extern unsigned char CosinusNickWinkel, CosinusRollWinkel; |
68 | extern unsigned char PlatinenVersion; |
71 | extern unsigned char PlatinenVersion; |
69 | 72 | ||
70 | void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length); |
73 | void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length); |
71 | void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length); |
74 | void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length); |
72 | extern unsigned char GetActiveParamSetNumber(void); |
75 | extern unsigned char GetActiveParamSetNumber(void); |
73 | extern unsigned char EEPromArray[]; |
76 | extern unsigned char EEPromArray[]; |
74 | 77 | ||
75 | #include <stdlib.h> |
78 | #include <stdlib.h> |
76 | #include <string.h> |
79 | #include <string.h> |
77 | #include <avr/io.h> |
80 | #include <avr/io.h> |
78 | #include <avr/pgmspace.h> |
81 | #include <avr/pgmspace.h> |
79 | #include <avr/interrupt.h> |
82 | #include <avr/interrupt.h> |
80 | #include <avr/eeprom.h> |
83 | #include <avr/eeprom.h> |
81 | #include <avr/boot.h> |
84 | #include <avr/boot.h> |
82 | #include <avr/wdt.h> |
85 | #include <avr/wdt.h> |
83 | 86 | ||
84 | #include "old_macros.h" |
87 | #include "old_macros.h" |
85 | 88 | ||
86 | #include "_Settings.h" |
89 | #include "_Settings.h" |
87 | #include "printf_P.h" |
90 | #include "printf_P.h" |
88 | #include "timer0.h" |
91 | #include "timer0.h" |
89 | #include "uart.h" |
92 | #include "uart.h" |
90 | #include "analog.h" |
93 | #include "analog.h" |
91 | #include "twimaster.h" |
94 | #include "twimaster.h" |
92 | #include "menu.h" |
95 | #include "menu.h" |
93 | #include "rc.h" |
96 | #include "rc.h" |
94 | #include "fc.h" |
97 | #include "fc.h" |
95 | #include "gps.h" |
98 | #include "gps.h" |
96 | #include "spi.h" |
99 | #include "spi.h" |
97 | 100 | ||
98 | 101 | ||
99 | #ifndef EEMEM |
102 | #ifndef EEMEM |
100 | #define EEMEM __attribute__ ((section (".eeprom"))) |
103 | #define EEMEM __attribute__ ((section (".eeprom"))) |
101 | #endif |
104 | #endif |
102 | 105 | ||
103 | #define DEBUG_DISPLAY_INTERVALL 123 // in ms |
106 | #define DEBUG_DISPLAY_INTERVALL 123 // in ms |
104 | 107 | ||
105 | 108 | ||
106 | #define DELAY_US(x) ((unsigned int)( (x) * 1e-6 * F_CPU )) |
109 | #define DELAY_US(x) ((unsigned int)( (x) * 1e-6 * F_CPU )) |
107 | 110 | ||
108 | #endif //_MAIN_H |
111 | #endif //_MAIN_H |
109 | 112 | ||
110 | 113 | ||
111 | 114 | ||
112 | 115 | ||
113 | 116 | ||
114 | 117 | ||
115 | 118 |