Subversion Repositories FlightCtrl

Rev

Rev 1211 | Rev 1232 | 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
 
1176 hbuss 4
#define QUADRO
1174 hbuss 5
//#define OCTO  // 2 Arms in Front
6
//#define OCTO2 // 1 Arm in front
1176 hbuss 7
//#define OCTO3 // 1 Arm with two Motors in front or Coax
1111 hbuss 8
 
1174 hbuss 9
//+++++++++++
10
//  Quadro:
1216 killagreg 11
//    1
1174 hbuss 12
//  4   3
1216 killagreg 13
//    2
1174 hbuss 14
//+++++++++++
1216 killagreg 15
// Reverse Props on 1 2
1166 hbuss 16
 
1174 hbuss 17
//+++++++++++
18
//   Octo:
19
//    1 2
20
//  8     3
21
//  7     4
1216 killagreg 22
//    6 5
1174 hbuss 23
//+++++++++++
24
 
25
//+++++++++++
26
//   Octo2:
1216 killagreg 27
//      1
1174 hbuss 28
//    8   2
29
//  7       3
1216 killagreg 30
//    6   4
1174 hbuss 31
//      5
32
//+++++++++++
33
 
34
//+++++++++++
35
//   Octo3:
1216 killagreg 36
//      1
1174 hbuss 37
//      2
38
// 8 7     3 4
39
//      5
40
//      6
41
//+++++++++++
42
// Reverse Props on octo: 1 3 5 7
43
 
44
 
1 ingob 45
//Hier die Quarz Frequenz einstellen
46
#if defined (__AVR_ATmega32__)
47
#define SYSCLK  20000000L       //Quarz Frequenz in Hz
48
#endif
49
 
50
#if defined (__AVR_ATmega644__)
51
#define SYSCLK  20000000L       //Quarz Frequenz in Hz
52
#endif
53
 
1171 hbuss 54
#if defined (__AVR_ATmega644P__)
55
#define SYSCLK  20000000L       //Quarz Frequenz in Hz
56
#endif
57
 
1 ingob 58
// neue Hardware
1021 hbuss 59
#define ROT_OFF   {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB &=~0x01; else  PORTB |= 0x01;}
60
#define ROT_ON    {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB |= 0x01; else  PORTB &=~0x01;}
1 ingob 61
#define ROT_FLASH PORTB ^= 0x01
1058 killagreg 62
#define GRN_OFF   {if((PlatinenVersion < 12)) PORTB &=~0x02; else PORTB |= 0x02;}
63
#define GRN_ON    {if((PlatinenVersion < 12)) PORTB |= 0x02; else PORTB &=~0x02;}
173 holgerb 64
#define GRN_FLASH PORTB ^= 0x02
1 ingob 65
 
304 ingob 66
#define F_CPU SYSCLK
1 ingob 67
//#ifndef F_CPU
68
//#error ################## F_CPU nicht definiert oder ungültig #############
69
//#endif
70
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1211 hbuss 71
#define EE_DATENREVISION 75 // wird angepasst, wenn sich die EEPROM-Daten geändert haben
72
#define MIXER_REVISION    1 // wird angepasst, wenn sich die Mixer-Daten geändert haben
1 ingob 73
 
74
#define EEPROM_ADR_VALID            1
75
#define EEPROM_ADR_ACTIVE_SET       2
173 holgerb 76
#define EEPROM_ADR_LAST_OFFSET      3
1 ingob 77
 
513 hbuss 78
#define EEPROM_ADR_ACC_NICK         4
79
#define EEPROM_ADR_ACC_ROLL         6
80
#define EEPROM_ADR_ACC_Z            8
81
 
1171 hbuss 82
#define EEPROM_ADR_CHANNELS          80
83
 
84
#define EEPROM_ADR_PARAM_LENGTH      98
1 ingob 85
#define EEPROM_ADR_PARAM_BEGIN      100
86
 
1211 hbuss 87
#define EEPROM_ADR_MIXER_TABLE     1000 // 1001 - 1100
1209 hbuss 88
 
395 hbuss 89
#define CFG_HOEHENREGELUNG       0x01
90
#define CFG_HOEHEN_SCHALTER      0x02
91
#define CFG_HEADING_HOLD         0x04
92
#define CFG_KOMPASS_AKTIV        0x08
93
#define CFG_KOMPASS_FIX          0x10
94
#define CFG_GPS_AKTIV            0x20
95
#define CFG_ACHSENKOPPLUNG_AKTIV 0x40
96
#define CFG_DREHRATEN_BEGRENZER  0x80
1 ingob 97
 
173 holgerb 98
#define CFG_LOOP_OBEN       0x01
99
#define CFG_LOOP_UNTEN      0x02
100
#define CFG_LOOP_LINKS      0x04
101
#define CFG_LOOP_RECHTS     0x08
1216 killagreg 102
#define CFG_RES1                    0x10
103
#define CFG_RES2                    0x20
104
#define CFG_RES3                    0x40
105
#define CFG_RES4                    0x80
1 ingob 106
 
1155 hbuss 107
#define J3High    PORTD |= 0x20
108
#define J3Low     PORTD &= ~0x20
109
#define J4High    PORTD |= 0x10
110
#define J4Low     PORTD &= ~0x10
111
#define J5High    PORTD |= 0x08
112
#define J5Low     PORTD &= ~0x08
113
 
114
 
1058 killagreg 115
//#define  SYSCLK
1 ingob 116
//extern unsigned long SYSCLK;
117
extern volatile unsigned char SenderOkay;
118
extern unsigned char CosinusNickWinkel, CosinusRollWinkel;
173 holgerb 119
extern unsigned char PlatinenVersion;
723 hbuss 120
extern unsigned char SendVersionToNavi;
304 ingob 121
void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length);
122
void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length);
1 ingob 123
extern unsigned char GetActiveParamSetNumber(void);
1063 killagreg 124
void SetActiveParamSetNumber(unsigned char number);
1 ingob 125
extern unsigned char EEPromArray[];
126
 
127
#include <stdlib.h>
128
#include <string.h>
129
#include <avr/io.h>
130
#include <avr/pgmspace.h>
131
#include <avr/interrupt.h>
132
#include <avr/eeprom.h>
133
#include <avr/boot.h>
134
#include <avr/wdt.h>
135
 
136
#include "old_macros.h"
137
 
395 hbuss 138
#include "_Settings.h"
1 ingob 139
#include "printf_P.h"
140
#include "timer0.h"
141
#include "uart.h"
142
#include "analog.h"
143
#include "twimaster.h"
144
#include "menu.h"
145
#include "rc.h"
146
#include "fc.h"
147
#include "gps.h"
304 ingob 148
#include "spi.h"
921 hbuss 149
#include "led.h"
1 ingob 150
 
151
#ifndef EEMEM
152
#define EEMEM __attribute__ ((section (".eeprom")))
153
#endif
154
 
155
#define DEBUG_DISPLAY_INTERVALL  123 // in ms
156
 
157
 
158
#define DELAY_US(x)     ((unsigned int)( (x) * 1e-6 * F_CPU ))
1058 killagreg 159
 
1 ingob 160
#endif //_MAIN_H
161
 
162
 
163
 
164
 
165
 
166