Subversion Repositories FlightCtrl

Rev

Rev 1435 | Rev 1481 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1435 Rev 1438
1
#ifndef _MAIN_H
1
#ifndef _MAIN_H
2
 #define _MAIN_H
2
 #define _MAIN_H
3
 
3
 
4
#define QUADRO
4
#define QUADRO
-
 
5
 
-
 
6
//#define ACT_S3D_SUMMENSIGNAL
5
 
7
 
6
// neue Hardware
8
// neue Hardware
7
#define ROT_OFF   {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB &=~0x01; else  PORTB |= 0x01;}
9
#define ROT_OFF   {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB &=~0x01; else  PORTB |= 0x01;}
8
#define ROT_ON    {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB |= 0x01; else  PORTB &=~0x01;}
10
#define ROT_ON    {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB |= 0x01; else  PORTB &=~0x01;}
9
#define ROT_FLASH PORTB ^= 0x01
11
#define ROT_FLASH PORTB ^= 0x01
10
#define GRN_OFF   {if((PlatinenVersion < 12)) PORTB &=~0x02; else PORTB |= 0x02;}
12
#define GRN_OFF   {if((PlatinenVersion < 12)) PORTB &=~0x02; else PORTB |= 0x02;}
11
#define GRN_ON    {if((PlatinenVersion < 12)) PORTB |= 0x02; else PORTB &=~0x02;}
13
#define GRN_ON    {if((PlatinenVersion < 12)) PORTB |= 0x02; else PORTB &=~0x02;}
12
#define GRN_FLASH PORTB ^= 0x02
14
#define GRN_FLASH PORTB ^= 0x02
13
 
15
 
14
#define SYSCLK F_CPU
16
#define SYSCLK F_CPU
15
 
17
 
16
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
18
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
17
#define EE_DATENREVISION 82 // Parameter fürs Koptertool; wird angepasst, wenn sich die EEPROM-Daten geändert haben
19
#define EE_DATENREVISION 82 // Parameter fürs Koptertool; wird angepasst, wenn sich die EEPROM-Daten geändert haben
18
#define MIXER_REVISION    1 // wird angepasst, wenn sich die Mixer-Daten geändert haben
20
#define MIXER_REVISION    1 // wird angepasst, wenn sich die Mixer-Daten geändert haben
19
 
21
 
20
#define EEPROM_ADR_VALID            1
22
#define EEPROM_ADR_VALID            1
21
#define EEPROM_ADR_ACTIVE_SET       2
23
#define EEPROM_ADR_ACTIVE_SET       2
22
#define EEPROM_ADR_LAST_OFFSET      3
24
#define EEPROM_ADR_LAST_OFFSET      3
23
 
25
 
24
#define EEPROM_ADR_ACC_NICK         4
26
#define EEPROM_ADR_ACC_NICK         4
25
#define EEPROM_ADR_ACC_ROLL         6
27
#define EEPROM_ADR_ACC_ROLL         6
26
#define EEPROM_ADR_ACC_Z            8
28
#define EEPROM_ADR_ACC_Z            8
27
#define EEPROM_ADR_MINUTES         10
29
#define EEPROM_ADR_MINUTES         10
28
#define EEPROM_ADR_MINUTES2        14
30
#define EEPROM_ADR_MINUTES2        14
29
 
31
 
30
#define EEPROM_ADR_CHANNELS          80
32
#define EEPROM_ADR_CHANNELS          80
31
 
33
 
32
#define EEPROM_ADR_PARAM_LENGTH      98
34
#define EEPROM_ADR_PARAM_LENGTH      98
33
#define EEPROM_ADR_PARAM_BEGIN      100
35
#define EEPROM_ADR_PARAM_BEGIN      100
34
 
36
 
35
#define EEPROM_ADR_MIXER_TABLE     1000 // 1001 - 1100
37
#define EEPROM_ADR_MIXER_TABLE     1000 // 1001 - 1100
36
 
38
 
37
#define CFG_HOEHENREGELUNG       0x01
39
#define CFG_HOEHENREGELUNG       0x01
38
#define CFG_HOEHEN_SCHALTER      0x02
40
#define CFG_HOEHEN_SCHALTER      0x02
39
#define CFG_HEADING_HOLD         0x04
41
#define CFG_HEADING_HOLD         0x04
40
#define CFG_KOMPASS_AKTIV        0x08
42
#define CFG_KOMPASS_AKTIV        0x08
41
#define CFG_KOMPASS_FIX          0x10
43
#define CFG_KOMPASS_FIX          0x10
42
#define CFG_GPS_AKTIV            0x20
44
#define CFG_GPS_AKTIV            0x20
43
#define CFG_ACHSENKOPPLUNG_AKTIV 0x40
45
#define CFG_ACHSENKOPPLUNG_AKTIV 0x40
44
#define CFG_DREHRATEN_BEGRENZER  0x80
46
#define CFG_DREHRATEN_BEGRENZER  0x80
45
 
47
 
46
#define CFG_LOOP_OBEN            0x01
48
#define CFG_LOOP_OBEN            0x01
47
#define CFG_LOOP_UNTEN           0x02
49
#define CFG_LOOP_UNTEN           0x02
48
#define CFG_LOOP_LINKS           0x04
50
#define CFG_LOOP_LINKS           0x04
49
#define CFG_LOOP_RECHTS          0x08
51
#define CFG_LOOP_RECHTS          0x08
50
#define CFG_MOTOR_BLINK          0x10
52
#define CFG_MOTOR_BLINK          0x10
51
#define CFG_MOTOR_OFF_LED1       0x20
53
#define CFG_MOTOR_OFF_LED1       0x20
52
#define CFG_MOTOR_OFF_LED2       0x40
54
#define CFG_MOTOR_OFF_LED2       0x40
53
#define CFG_RES4                         0x80
55
#define CFG_RES4                         0x80
54
 
56
 
55
#define CFG2_HEIGHT_LIMIT        0x01
57
#define CFG2_HEIGHT_LIMIT        0x01
56
#define CFG2_VARIO_BEEP          0x02
58
#define CFG2_VARIO_BEEP          0x02
57
#define CFG_SENSITIVE_RC         0x04
59
#define CFG_SENSITIVE_RC         0x04
58
 
60
 
59
#define J3High    PORTD |= 0x20
61
#define J3High    PORTD |= 0x20
60
#define J3Low     PORTD &= ~0x20
62
#define J3Low     PORTD &= ~0x20
61
#define J4High    PORTD |= 0x10
63
#define J4High    PORTD |= 0x10
62
#define J4Low     PORTD &= ~0x10
64
#define J4Low     PORTD &= ~0x10
63
#define J5High    PORTD |= 0x08
65
#define J5High    PORTD |= 0x08
64
#define J5Low     PORTD &= ~0x08
66
#define J5Low     PORTD &= ~0x08
65
 
67
 
66
extern volatile unsigned char SenderOkay;
68
extern volatile unsigned char SenderOkay;
67
extern unsigned char BattLowVoltageWarning;
69
extern unsigned char BattLowVoltageWarning;
68
extern unsigned char CosinusNickWinkel, CosinusRollWinkel;
70
extern unsigned char CosinusNickWinkel, CosinusRollWinkel;
69
extern unsigned char PlatinenVersion;
71
extern unsigned char PlatinenVersion;
70
extern unsigned char SendVersionToNavi;
72
extern unsigned char SendVersionToNavi;
71
void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length);
73
void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length);
72
void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length);
74
void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length);
73
extern unsigned char GetActiveParamSetNumber(void);
75
extern unsigned char GetActiveParamSetNumber(void);
74
void SetActiveParamSetNumber(unsigned char number);
76
void SetActiveParamSetNumber(unsigned char number);
75
void LipoDetection(unsigned char print);
77
void LipoDetection(unsigned char print);
76
extern unsigned char EEPromArray[];
78
extern unsigned char EEPromArray[];
77
extern unsigned int FlugMinuten,FlugMinutenGesamt;
79
extern unsigned int FlugMinuten,FlugMinutenGesamt;
78
 
80
 
79
#include <stdlib.h>
81
#include <stdlib.h>
80
#include <string.h>
82
#include <string.h>
81
#include <avr/io.h>
83
#include <avr/io.h>
82
#include <avr/pgmspace.h>
84
#include <avr/pgmspace.h>
83
#include <avr/interrupt.h>
85
#include <avr/interrupt.h>
84
#include <avr/eeprom.h>
86
#include <avr/eeprom.h>
85
#include <avr/boot.h>
87
#include <avr/boot.h>
86
#include <avr/wdt.h>
88
#include <avr/wdt.h>
-
 
89
 
87
 
90
 
88
#include "old_macros.h"
91
#include "old_macros.h"
89
 
92
 
90
#include "_Settings.h"
93
#include "_Settings.h"
91
#include "printf_P.h"
94
#include "printf_P.h"
92
#include "timer0.h"
95
#include "timer0.h"
93
#include "uart.h"
96
#include "uart.h"
94
#include "analog.h"
97
#include "analog.h"
95
#include "twimaster.h"
98
#include "twimaster.h"
96
#include "menu.h"
99
#include "menu.h"
97
#include "rc.h"
100
#include "rc.h"
98
#include "fc.h"
101
#include "fc.h"
99
#include "gps.h"
102
#include "gps.h"
100
#include "spi.h"
103
#include "spi.h"
101
#include "led.h"
104
#include "led.h"
102
#include "spektrum.h"
105
#include "spektrum.h"
103
#include "libfc.h"
106
#include "libfc.h"
-
 
107
 
104
 
108
 
105
 
109
 
106
#ifndef EEMEM
110
#ifndef EEMEM
107
#define EEMEM __attribute__ ((section (".eeprom")))
111
#define EEMEM __attribute__ ((section (".eeprom")))
108
#endif
112
#endif
109
 
113
 
110
#define DEBUG_DISPLAY_INTERVALL  123 // in ms
114
#define DEBUG_DISPLAY_INTERVALL  123 // in ms
111
 
115
 
112
 
116
 
113
#define DELAY_US(x)     ((unsigned int)( (x) * 1e-6 * F_CPU ))
117
#define DELAY_US(x)     ((unsigned int)( (x) * 1e-6 * F_CPU ))
114
 
118
 
115
#endif //_MAIN_H
119
#endif //_MAIN_H
116
 
120
 
117
 
121
 
118
 
122
 
119
 
123
 
120
 
124
 
121
 
125
 
122
 
126