Subversion Repositories FlightCtrl

Rev

Rev 1166 | Rev 1174 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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