Rev 838 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 838 | Rev 966 | ||
---|---|---|---|
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 | #endif |
11 | #endif |
12 | 12 | ||
13 | // neue Hardware |
13 | // neue Hardware |
14 | #define ROT_OFF PORTB |= 0x01; |
14 | #define ROT_OFF PORTB |= 0x01; |
15 | #define ROT_ON PORTB &=~0x01; |
15 | #define ROT_ON PORTB &=~0x01; |
16 | #define ROT_FLASH PORTB ^= 0x01 |
16 | #define ROT_FLASH PORTB ^= 0x01 |
17 | #define GRN_OFF PORTB &=~0x02 |
17 | #define GRN_OFF PORTB &=~0x02 |
18 | #define GRN_ON PORTB |= 0x02 |
18 | #define GRN_ON PORTB |= 0x02 |
19 | #define GRN_FLASH PORTB ^= 0x02 |
19 | #define GRN_FLASH PORTB ^= 0x02 |
20 | 20 | ||
21 | #define F_CPU SYSCLK |
21 | #define F_CPU SYSCLK |
22 | //#ifndef F_CPU |
22 | //#ifndef F_CPU |
23 | //#error ################## F_CPU nicht definiert oder ungültig ############# |
23 | //#error ################## F_CPU nicht definiert oder ungültig ############# |
24 | //#endif |
24 | //#endif |
25 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
25 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
26 | 26 | ||
27 | #define EEPROM_ADR_VALID 1 |
27 | #define EEPROM_ADR_VALID 1 |
28 | #define EEPROM_ADR_ACTIVE_SET 2 |
28 | #define EEPROM_ADR_ACTIVE_SET 2 |
29 | #define EEPROM_ADR_LAST_OFFSET 3 |
29 | #define EEPROM_ADR_LAST_OFFSET 3 |
30 | 30 | ||
31 | #define PID_MM3_X_OFF 10 // word |
31 | #define PID_MM3_X_OFF 10 // word |
32 | #define PID_MM3_Y_OFF 12 // word |
32 | #define PID_MM3_Y_OFF 12 // word |
33 | #define PID_MM3_Z_OFF 14 // word |
33 | #define PID_MM3_Z_OFF 14 // word |
34 | #define PID_MM3_X_RANGE 16 // word |
34 | #define PID_MM3_X_RANGE 16 // word |
35 | #define PID_MM3_Y_RANGE 18 // word |
35 | #define PID_MM3_Y_RANGE 18 // word |
36 | #define PID_MM3_Z_RANGE 20 // word |
36 | #define PID_MM3_Z_RANGE 20 // word |
37 | 37 | ||
38 | #define EEPROM_ADR_PARAM_BEGIN 100 |
38 | #define EEPROM_ADR_PARAM_BEGIN 100 |
39 | 39 | ||
40 | #define CFG_HOEHENREGELUNG 0x01 |
40 | #define CFG_HOEHENREGELUNG 0x01 |
41 | #define CFG_HOEHEN_SCHALTER 0x02 |
41 | #define CFG_HOEHEN_SCHALTER 0x02 |
42 | #define CFG_HEADING_HOLD 0x04 |
42 | #define CFG_HEADING_HOLD 0x04 |
43 | #define CFG_KOMPASS_AKTIV 0x08 |
43 | #define CFG_KOMPASS_AKTIV 0x08 |
44 | #define CFG_KOMPASS_FIX 0x10 |
44 | #define CFG_KOMPASS_FIX 0x10 |
45 | #define CFG_GPS_AKTIV 0x20 |
45 | #define CFG_GPS_AKTIV 0x20 |
46 | #define CFG_ACHSENKOPPLUNG_AKTIV 0x40 |
46 | #define CFG_ACHSENKOPPLUNG_AKTIV 0x40 |
47 | #define CFG_DREHRATEN_BEGRENZER 0x80 |
47 | #define CFG_DREHRATEN_BEGRENZER 0x80 |
48 | 48 | ||
49 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) |
49 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) |
50 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) |
50 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) |
51 | 51 | ||
52 | extern unsigned char SenderOkay; |
52 | extern unsigned char SenderOkay; |
53 | extern unsigned char GetActiveParamSetNumber(void); |
53 | extern unsigned char GetActiveParamSetNumber(void); |
54 | extern unsigned char EEPromArray[]; |
54 | extern unsigned char EEPromArray[]; |
55 | 55 | ||
56 | void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length); |
56 | void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length); |
57 | void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length); |
57 | void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length); |
58 | 58 | ||
59 | 59 | ||
60 | #include <stdlib.h> |
60 | #include <stdlib.h> |
61 | #include <string.h> |
61 | #include <string.h> |
62 | #include <avr/io.h> |
62 | #include <avr/io.h> |
63 | #include <avr/pgmspace.h> |
63 | #include <avr/pgmspace.h> |
64 | #include <avr/interrupt.h> |
64 | #include <avr/interrupt.h> |
65 | #include <avr/eeprom.h> |
65 | #include <avr/eeprom.h> |
66 | #include <avr/boot.h> |
66 | #include <avr/boot.h> |
67 | #include <avr/wdt.h> |
67 | #include <avr/wdt.h> |
68 | 68 | ||
69 | #include "old_macros.h" |
69 | #include "old_macros.h" |
70 | 70 | ||
71 | #include "_Settings.h" |
71 | #include "_Settings.h" |
72 | #include "printf_P.h" |
72 | #include "printf_P.h" |
73 | #include "timer0.h" |
73 | #include "timer0.h" |
74 | #include "uart.h" |
74 | #include "uart.h" |
75 | #include "analog.h" |
75 | #include "analog.h" |
76 | #include "twimaster.h" |
76 | #include "twimaster.h" |
77 | #include "menu.h" |
77 | #include "menu.h" |
78 | #include "rc.h" |
78 | #include "rc.h" |
79 | #include "fc.h" |
79 | #include "fc.h" |
80 | #include "gps.h" |
80 | #include "gps.h" |
81 | 81 | ||
82 | 82 | ||
83 | #ifndef EEMEM |
83 | #ifndef EEMEM |
84 | #define EEMEM __attribute__ ((section (".eeprom"))) |
84 | #define EEMEM __attribute__ ((section (".eeprom"))) |
85 | #endif |
85 | #endif |
86 | - | ||
87 | 86 | ||
88 | #endif //_MAIN_H |
87 | #endif //_MAIN_H |
89 | 88 | ||
90 | 89 | ||
91 | 90 | ||
92 | 91 | ||
93 | 92 | ||
94 | 93 | ||
95 | 94 |