Subversion Repositories FlightCtrl

Rev

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