Subversion Repositories FlightCtrl

Rev

Rev 1486 | Rev 1533 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef _MAIN_H
 #define _MAIN_H

#define QUADRO

//#define ACT_S3D_SUMMENSIGNAL

// neue Hardware
#define ROT_OFF   {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB &=~0x01; else  PORTB |= 0x01;}
#define ROT_ON    {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB |= 0x01; else  PORTB &=~0x01;}
#define ROT_FLASH PORTB ^= 0x01
#define GRN_OFF   {if((PlatinenVersion < 12)) PORTB &=~0x02; else PORTB |= 0x02;}
#define GRN_ON    {if((PlatinenVersion < 12)) PORTB |= 0x02; else PORTB &=~0x02;}
#define GRN_FLASH PORTB ^= 0x02

#define SYSCLK F_CPU

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#define EE_DATENREVISION 82 // Parameter fürs Koptertool; wird angepasst, wenn sich die EEPROM-Daten geändert haben
#define MIXER_REVISION    1 // wird angepasst, wenn sich die Mixer-Daten geändert haben

#define EEPROM_ADR_VALID            1
#define EEPROM_ADR_ACTIVE_SET       2
#define EEPROM_ADR_LAST_OFFSET      3

#define EEPROM_ADR_ACC_NICK         4
#define EEPROM_ADR_ACC_ROLL         6
#define EEPROM_ADR_ACC_Z            8
#define EEPROM_ADR_MINUTES         10
#define EEPROM_ADR_MINUTES2        14

#define EEPROM_ADR_CHANNELS          80

#define EEPROM_ADR_PARAM_LENGTH      98
#define EEPROM_ADR_PARAM_BEGIN      100

#define EEPROM_ADR_MIXER_TABLE     1000 // 1001 - 1100

#define CFG_HOEHENREGELUNG       0x01
#define CFG_HOEHEN_SCHALTER      0x02
#define CFG_HEADING_HOLD         0x04
#define CFG_KOMPASS_AKTIV        0x08
#define CFG_KOMPASS_FIX          0x10
#define CFG_GPS_AKTIV            0x20
#define CFG_ACHSENKOPPLUNG_AKTIV 0x40
#define CFG_DREHRATEN_BEGRENZER  0x80

#define CFG_LOOP_OBEN            0x01
#define CFG_LOOP_UNTEN           0x02
#define CFG_LOOP_LINKS           0x04
#define CFG_LOOP_RECHTS          0x08
#define CFG_MOTOR_BLINK          0x10
#define CFG_MOTOR_OFF_LED1       0x20
#define CFG_MOTOR_OFF_LED2       0x40
#define CFG_RES4                         0x80

#define CFG2_HEIGHT_LIMIT        0x01
#define CFG2_VARIO_BEEP          0x02
#define CFG_SENSITIVE_RC         0x04

#define RECEIVER_PPM                            0
#define RECEIVER_SPEKTRUM                       1
#define RECEIVER_SPEKTRUM_HI_RES        2
#define RECEIVER_SPEKTRUM_LOW_RES       3
#define RECEIVER_JETI                           4
#define RECEIVER_ACT_DSL                        5
#define RECEIVER_UNKNOWN        0xFF

#define J3High    PORTD |= 0x20
#define J3Low     PORTD &= ~0x20
#define J4High    PORTD |= 0x10
#define J4Low     PORTD &= ~0x10
#define J5High    PORTD |= 0x08
#define J5Low     PORTD &= ~0x08

extern volatile unsigned char SenderOkay;
extern unsigned char BattLowVoltageWarning;
extern unsigned char CosinusNickWinkel, CosinusRollWinkel;
extern unsigned char PlatinenVersion;
extern unsigned char SendVersionToNavi;
void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length);
void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length);
extern unsigned char GetActiveParamSetNumber(void);
void SetActiveParamSetNumber(unsigned char number);
void LipoDetection(unsigned char print);
extern unsigned char EEPromArray[];
extern unsigned int FlugMinuten,FlugMinutenGesamt,FlugSekunden;

#include <stdlib.h>
#include <string.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include <avr/eeprom.h>
#include <avr/boot.h>
#include <avr/wdt.h>


#include "old_macros.h"

#include "_Settings.h"
#include "printf_P.h"
#include "timer0.h"
#include "uart.h"
#include "analog.h"
#include "twimaster.h"
#include "menu.h"
#include "rc.h"
#include "fc.h"
#include "gps.h"
#include "spi.h"
#include "led.h"
#include "spektrum.h"
#include "capacity.h"
#include "libfc.h"



#ifndef EEMEM
#define EEMEM __attribute__ ((section (".eeprom")))
#endif

#define DEBUG_DISPLAY_INTERVALL  123 // in ms


#define DELAY_US(x)     ((unsigned int)( (x) * 1e-6 * F_CPU ))

#endif //_MAIN_H