Subversion Repositories Projects

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2136 - 1
/*****************************************************************************
2
 *   Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de                  *
3
 *   Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net                  *
4
 *   Copyright (C) 2012 Christian "Cebra" Brandtner, brandtner@brandtner.net *
5
 *   Copyright (C) 2012 Harald Bongartz                                      *
6
 *                                                                           *
7
 *   This program is free software; you can redistribute it and/or modify    *
8
 *   it under the terms of the GNU General Public License as published by    *
9
 *   the Free Software Foundation; either version 2 of the License.          *
10
 *                                                                           *
11
 *   This program is distributed in the hope that it will be useful,         *
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
14
 *   GNU General Public License for more details.                            *
15
 *                                                                           *
16
 *   You should have received a copy of the GNU General Public License       *
17
 *   along with this program; if not, write to the                           *
18
 *   Free Software Foundation, Inc.,                                         *
19
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.               *
20
 *                                                                           *
21
 *                                                                           *
22
 *   Credits to:                                                             *
23
 *   Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN  *
24
 *                          http://www.mikrokopter.de                        *
25
 *   Gregor "killagreg" Stobrawa for his version of the MK code              *
26
 *   Thomas Kaiser "thkais" for the original project. See                    *
27
 *                          http://www.ft-fanpage.de/mikrokopter/            *
28
 *                          http://forum.mikrokopter.de/topic-4061-1.html    *
29
 *   Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code *
30
 *                          http://www.mylifesucks.de/oss/c-osd/             *
31
 *   Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility*
32
 *****************************************************************************/
33
 
34
//############################################################################
35
//# HISTORY  mkbase.h
36
//#
37
//# 14.05.2014 OG
38
//# - chg: include "paramset.h" geaendert auf "../mksettings/paramset.h"
39
//#
40
//# 29.03.2014 OG
41
//# - del: MK_Show_LastGPS_Position() -> jetzt: OSDDATA_ShowLastGPSPosition()/osddata.c
42
//#
43
//# 28.03.2014 OG
44
//# - add: MK_Show_LastGPS_Position() - ehemals in main.c
45
//#
46
//# 16.02.2014 OG
47
//# - add: MK_SwitchToNC(), MK_SwitchToFC(), MK_SwitchToMAG(), MK_SwitchToGPS()
48
//# - add: MK_Setting_write(), MK_Setting_change()
49
//# - chg: umbenannt: MK_load_setting() zu MK_Setting_load()
50
//#
51
//# 13.02.2014 OG
52
//# - add: MKVersion_Cmp()
53
//# - add: defines zu VERSION... fuer MKVersion_Cmp()
54
//# - del: WrongFCVersion
55
//#
56
//# 10.02.2014 OG
57
//# - add: MKVersion_Setting_print()
58
//#
59
//# 09.02.2014 OG
60
//# - add: MK_Info()
61
//# - add: MKVersion_print_at
62
//#
63
//# 08.02.2014 OG
64
//# - chg: MK_load_setting() Parameter geaendert
65
//# - add: extern MKVersion_t MKVersion
66
//#
67
//# 29.01.2014 OG
68
//# - Ausgliederungen aus main.c
69
//############################################################################
70
 
71
#ifndef _MKBASE_H
72
#define _MKBASE_H
73
 
74
//#include "../mksettings/paramset.h"
75
#include "../mk-data-structs.h"
76
 
77
 
78
//-------------------------------------
79
//-------------------------------------
80
typedef struct
81
{
82
    unsigned char   isFC;                   // true / false - FC vorhanden?     -> wird gesetzt durch searchMK()
83
    unsigned char   isNC;                   // true / false - NC vorhanden?     -> wird gesetzt durch searchMK()
84
    Version_t       FCVer;                  //                                  -> wird gesetzt durch searchMK()
85
    Version_t       NCVer;                  //                                  -> wird gesetzt durch searchMK()
86
    unsigned char   paramsetOK;             // true wenn Revision in paramset.c vorhanden und initialisiert     -> wird gesetzt druch paramsetInit()/paramset.c
87
    unsigned char   paramsetRevision;       // Revision FC-Parameterset                                         -> wird gesetzt druch paramsetInit()/paramset.c
88
    uint8_t         mksetting;              //      -> wird gesetzt druch paramsetInit()/paramset.c
89
    unsigned char   mksettingName[13];      //      -> wird gesetzt druch paramsetInit()/paramset.c
90
} MKVersion_t;
91
 
92
 
93
//-------------------------------------
94
// zur Orientierung: Version_t
95
//-------------------------------------
96
//typedef struct
97
//{
98
//    unsigned char SWMajor;
99
//    unsigned char SWMinor;
100
//    unsigned char ProtoMajor;
101
//    unsigned char ProtoMinor;
102
//    unsigned char SWPatch;
103
//    unsigned char HardwareError[5];
104
//} __attribute__((packed)) Version_t;
105
 
106
//----------------------------
107
// MK-Versionsinformationen
108
// global verfuegbar
109
//----------------------------
110
extern MKVersion_t MKVersion;
111
 
112
 
113
//------------------------------------------------------
114
// defines fuer den Versionsvergleich von FC/NC
115
// siehe: MKVersion_Cmp()... (mkbase.c)
116
//------------------------------------------------------
117
#define GIVEN_VERSION       2   // das macht die Sache leserlicher fuer resultierenden Ergebnisse! => siehe Anmerkungen: MKVersion_Cmp() !
118
#define VERSION_NO          0
119
#define VERSION_LOWER       1
120
#define VERSION_EQUAL       2
121
#define VERSION_GREATER     3
122
 
123
 
124
void    MKVersion_Init( void );
125
void    MKVersion_print_at( uint8_t x, uint8_t y, uint8_t what, uint8_t drawmode, int8_t xoffs, int8_t yoffs );
126
void    MKVersion_Setting_print( uint8_t y, uint8_t drawmode, uint8_t xoffs, uint8_t yoffs );
127
uint8_t MKVersion_Cmp( Version_t ver, unsigned char SWMajor, unsigned char SWMinor, unsigned char SWPatch );
128
 
129
void    MK_SwitchToNC( void );
130
void    MK_SwitchToFC( void );
131
void    MK_SwitchToMAG( void );
132
void    MK_SwitchToGPS( void );
133
 
134
uint8_t MK_Setting_load( uint8_t lsetting, uint8_t timeout );
135
uint8_t MK_Setting_write( uint8_t wsetting, uint8_t timeout);
136
uint8_t MK_Setting_change( uint8_t setting );
137
 
138
uint8_t MK_Info( uint16_t displaytimeout, uint8_t refreshSettings );
139
 
140
uint8_t searchMK( uint8_t showMKInfo );
141
 
142
 
143
#endif  // end: #ifndef _MKBASE_H