Subversion Repositories Projects

Rev

Blame | Last modification | View Log | RSS feed

/*****************************************************************************
 *   Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de                  *
 *   Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net                  *
 *   Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net *
 *   Copyright (C) 2011 Harald Bongartz                                      *
 *                                                                           *
 *   This program is free software; you can redistribute it and/or modify    *
 *   it under the terms of the GNU General Public License as published by    *
 *   the Free Software Foundation; either version 2 of the License.          *
 *                                                                           *
 *   This program is distributed in the hope that it will be useful,         *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
 *   GNU General Public License for more details.                            *
 *                                                                           *
 *   You should have received a copy of the GNU General Public License       *
 *   along with this program; if not, write to the                           *
 *   Free Software Foundation, Inc.,                                         *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.               *
 *                                                                           *
 *                                                                           *
 *   Credits to:                                                             *
 *   Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN  *
 *                          http://www.mikrokopter.de                        *
 *   Gregor "killagreg" Stobrawa for his version of the MK code              *
 *   Thomas Kaiser "thkais" for the original project. See                    *
 *                          http://www.ft-fanpage.de/mikrokopter/            *
 *                          http://forum.mikrokopter.de/topic-4061-1.html    *
 *   Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code *
 *                          http://www.mylifesucks.de/oss/c-osd/             *
 *   Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility*
 *****************************************************************************/



#ifndef _EEPROM_H
#define _EEPROM_H

#include <stdbool.h>
#include "mk-data-structs.h"
#include "connect.h"




//[General]
//FileVersion = 2
//NumberOfWaypoints = 15
//UsePOI = 0
//POI_CAM_NICK_CTRL = 0

//[POI]
//Altitude = 1
//Latitude = 46.7140763
//Longitude = 19.2507334

//[Waypoint1]
//Latitude = 46.7145686
//Longitude = 19.2515702
//Radius = 10
//Altitude = 15
//ClimbRate = 0
//DelayTime = 4
//WP_Event_Channel_Value = 96
//Heading = 180


#define EEpromVersion           0x58  //Summe aus Soft.vers. ohne erste Ziffer zB 3.5.5 = 55

#define NumberOfWaypoints       55      //Anzahl der Waypoints in der EEPromliste
#define NumberOfWPLists         5       //Anzahl WP Listen im PKT
#define bt_pin_length           4
#define bt_name_length          10


#define POINT_TYPE_INVALID      255
#define POINT_TYPE_WP           0
#define POINT_TYPE_POI          1
#define INVALID                         0x00
#define MAX_WPLIST_LEN          31





typedef struct
{
        uint8_t WPIndex;        // Index in der EEpromliste
        Point_t Waypoint;       // Waypoint
} WayPoints;

typedef struct
{
        uint8_t WPListnumber;           // Nummer der WP Liste im PKT
        uint8_t WPListAktiv;            // Liste aktiv
        uint8_t WPDirectory[31];        // Enthält die Indexe der Waypoints im EEPROM
        uint8_t UsePOI;
        uint8_t POI_CAM_NICK_CTR;

} WPListHeader;

typedef struct
{
        WPListHeader    WPList;         // Waypointliste im PKT
} WPListDirectory;






void ReadParameter (void);
void WriteParameter (void);
void ReadLastPosition(void);
void WriteLastPosition(uint32_t ELongitude,uint32_t ELatitude);
void WriteWiInitFlag(void);
void WriteBTInitFlag(void);
void Delete_EEPROM(void);
void EEWayPointList_Clear(void);        // l�schen der Waypointliste im EEProm


uint8_t MK_LowBat;
extern volatile uint8_t LCD_ORIENTATION;
extern volatile uint8_t LCD_DisplayMode;
extern volatile uint8_t LCD_Kontrast;
extern volatile uint8_t LCD_Helligkeit;
extern volatile uint8_t DisplayTimeout;
extern volatile uint8_t DisplayLanguage;
extern volatile uint8_t WiTXRXChannel;
extern volatile uint8_t WiNetworkGroup;
extern volatile uint8_t WiNetworkMode;
extern volatile uint8_t WiTXTO;
extern volatile uint8_t WiUartMTU;
extern volatile uint8_t USBBT;
extern volatile uint8_t U02SV2;
extern volatile uint8_t Debug;
extern volatile uint8_t UseWi;                                                  // Wi232 wird genutzt
extern volatile uint8_t UseBT;                                                  // BT wird genutzt
extern volatile uint8_t WiIsSet;                                                // Wi232 ist initialisiert
extern volatile uint8_t BTIsSet;                                                // BT ist initialisiert
extern char bt_pin[bt_pin_length + 1];                                  // BT Pinnummer
extern char bt_name[bt_name_length + 1];                                // BT Name
extern volatile uint32_t LastLongitude;
extern volatile uint32_t LastLatitude;
extern volatile uint8_t PKT_IdleBeep;
extern volatile uint8_t PKT_StartInfo;
extern volatile uint16_t Lipo_UOffset;          // Offset für die Lipospannugsmessung
extern volatile uint8_t PKT_Accutyp;
#endif