Subversion Repositories FlightCtrl

Rev

Rev 861 | 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
 
4
//Hier die Quarz Frequenz einstellen
5
#if defined (__AVR_ATmega32__)
6
#define SYSCLK  20000000L       //Quarz Frequenz in Hz
7
#endif
8
 
9
#if defined (__AVR_ATmega644__)
10
#define SYSCLK  20000000L       //Quarz Frequenz in Hz
11
//#define SYSCLK        16000000L       //Quarz Frequenz in Hz
12
#endif
13
 
864 DarkRider 14
#define MAJOR_DARKMOD 0
15
#define MINOR_DARKMOD 1
16
 
1 ingob 17
// neue Hardware
173 holgerb 18
#define ROT_OFF   {if(PlatinenVersion == 10) PORTB &=~0x01; else  PORTB |= 0x01;}
19
#define ROT_ON    {if(PlatinenVersion == 10) PORTB |= 0x01; else  PORTB &=~0x01;}
1 ingob 20
#define ROT_FLASH PORTB ^= 0x01
21
#define GRN_OFF   PORTB &=~0x02 
22
#define GRN_ON    PORTB |= 0x02 
173 holgerb 23
#define GRN_FLASH PORTB ^= 0x02
1 ingob 24
 
861 DarkRider 25
#define EXT1OUT_ON PORTC |= 0x04
26
#define EXT1OUT_OFF PORTC &=~ 0x04
27
#define EXT2OUT_ON PORTC |= 0x08
28
#define EXT2OUT_OFF PORTC &=~ 0x08
29
 
30
#define EXT1OUT_INV_ON EXT1OUT_OFF
31
#define EXT1OUT_INV_OFF EXT1OUT_ON
32
#define EXT2OUT_INV_ON EXT2OUT_OFF
33
#define EXT2OUT_INV_OFF EXT2OUT_ON
597 ingob 34
 
35
 
304 ingob 36
#define F_CPU SYSCLK
1 ingob 37
//#ifndef F_CPU
38
//#error ################## F_CPU nicht definiert oder ungültig #############
39
//#endif
40
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
41
 
42
#define EEPROM_ADR_VALID            1
43
#define EEPROM_ADR_ACTIVE_SET       2
173 holgerb 44
#define EEPROM_ADR_LAST_OFFSET      3
1 ingob 45
 
513 hbuss 46
#define EEPROM_ADR_ACC_NICK         4
47
#define EEPROM_ADR_ACC_ROLL         6
48
#define EEPROM_ADR_ACC_Z            8
49
 
1 ingob 50
#define EEPROM_ADR_PARAM_BEGIN      100
51
 
395 hbuss 52
#define CFG_HOEHENREGELUNG       0x01
53
#define CFG_HOEHEN_SCHALTER      0x02
54
#define CFG_HEADING_HOLD         0x04
55
#define CFG_KOMPASS_AKTIV        0x08
56
#define CFG_KOMPASS_FIX          0x10
57
#define CFG_GPS_AKTIV            0x20
58
#define CFG_ACHSENKOPPLUNG_AKTIV 0x40
59
#define CFG_DREHRATEN_BEGRENZER  0x80
1 ingob 60
 
173 holgerb 61
#define CFG_LOOP_OBEN       0x01
62
#define CFG_LOOP_UNTEN      0x02
63
#define CFG_LOOP_LINKS      0x04
64
#define CFG_LOOP_RECHTS     0x08
1 ingob 65
 
66
//#define  SYSCLK  
67
//extern unsigned long SYSCLK;
68
extern volatile int i_Nick[20],i_Roll[20],DiffNick,DiffRoll;
69
extern volatile unsigned char SenderOkay;
70
extern unsigned char CosinusNickWinkel, CosinusRollWinkel;
173 holgerb 71
extern unsigned char PlatinenVersion;
1 ingob 72
 
304 ingob 73
void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length);
74
void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length);
1 ingob 75
extern unsigned char GetActiveParamSetNumber(void);
76
extern unsigned char EEPromArray[];
77
 
78
#include <stdlib.h>
79
#include <string.h>
80
#include <avr/io.h>
81
#include <avr/pgmspace.h>
82
#include <avr/interrupt.h>
83
#include <avr/eeprom.h>
84
#include <avr/boot.h>
85
#include <avr/wdt.h>
86
 
87
#include "old_macros.h"
88
 
395 hbuss 89
#include "_Settings.h"
1 ingob 90
#include "printf_P.h"
91
#include "timer0.h"
92
#include "uart.h"
93
#include "analog.h"
94
#include "twimaster.h"
95
#include "menu.h"
96
#include "rc.h"
97
#include "fc.h"
98
#include "gps.h"
304 ingob 99
#include "spi.h"
1 ingob 100
 
304 ingob 101
 
1 ingob 102
#ifndef EEMEM
103
#define EEMEM __attribute__ ((section (".eeprom")))
104
#endif
105
 
106
#define DEBUG_DISPLAY_INTERVALL  123 // in ms
107
 
108
 
109
#define DELAY_US(x)     ((unsigned int)( (x) * 1e-6 * F_CPU ))
110
 
111
#endif //_MAIN_H
112
 
113
 
114
 
115
 
116
 
117