Subversion Repositories FlightCtrl

Rev

Rev 685 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
685 killagreg 1
#ifndef _EEPROM_H
2
#define _EEPROM_H
3
 
687 killagreg 4
#include <inttypes.h>
685 killagreg 5
 
687 killagreg 6
#define EEPROM_ADR_PARAM_BEGIN                  0
7
#define PID_VERSION          1 // byte
8
#define PID_ACTIVE_SET       2 // byte
9
#define PID_LAST_OFFSET      3 // byte
10
#define PID_ACC_NICK         4 // word
11
#define PID_ACC_ROLL         6 // word
12
#define PID_ACC_Z            8 // word
13
 
14
#define EEPROM_ADR_PARAMSET_BEGIN      100
15
 
16
// bit mask for mk_param_struct.GlobalConfig
17
#define CFG_HOEHENREGELUNG       0x01
18
#define CFG_HOEHEN_SCHALTER      0x02
19
#define CFG_HEADING_HOLD         0x04
20
#define CFG_KOMPASS_AKTIV        0x08
21
#define CFG_KOMPASS_FIX          0x10
22
#define CFG_GPS_AKTIV            0x20
23
#define CFG_ACHSENKOPPLUNG_AKTIV 0x40
24
#define CFG_DREHRATEN_BEGRENZER  0x80
25
 
26
// bit mask for mk_param_struct.LoopConfig
27
#define CFG_LOOP_OBEN       0x01
28
#define CFG_LOOP_UNTEN      0x02
29
#define CFG_LOOP_LINKS      0x04
30
#define CFG_LOOP_RECHTS     0x08
31
 
32
// defines for lookup mk_param_struct.Kanalbelegung
33
#define K_NICK    0
34
#define K_ROLL    1
35
#define K_GAS     2
36
#define K_GIER    3
37
#define K_POTI1   4
38
#define K_POTI2   5
39
#define K_POTI3   6
40
#define K_POTI4   7
41
 
42
#define EEPARAM_VERSION 69 // is count up, if EE_Paramater stucture has changed (compatibility)
43
 
44
typedef struct
45
 {
46
   uint8_t Kanalbelegung[8];       // see upper defines for details
47
   uint8_t GlobalConfig;           // see upper defines for bitcoding
48
   uint8_t Hoehe_MinGas;           // Wert : 0-100
49
   uint8_t Luftdruck_D;            // Wert : 0-250
50
   uint8_t MaxHoehe;               // Wert : 0-32
51
   uint8_t Hoehe_P;                // Wert : 0-32
52
   uint8_t Hoehe_Verstaerkung;     // Wert : 0-50
53
   uint8_t Hoehe_ACC_Wirkung;      // Wert : 0-250
54
   uint8_t Stick_P;                // Wert : 1-6
55
   uint8_t Stick_D;                // Wert : 0-64
56
   uint8_t Gier_P;                 // Wert : 1-20
57
   uint8_t Gas_Min;                // Wert : 0-32
58
   uint8_t Gas_Max;                // Wert : 33-250
59
   uint8_t GyroAccFaktor;          // Wert : 1-64
60
   uint8_t KompassWirkung;         // Wert : 0-32
61
   uint8_t Gyro_P;                 // Wert : 10-250
62
   uint8_t Gyro_I;                 // Wert : 0-250
63
   uint8_t UnterspannungsWarnung;  // Wert : 0-250
64
   uint8_t NotGas;                 // Wert : 0-250     //Gaswert bei Empängsverlust
65
   uint8_t NotGasZeit;             // Wert : 0-250     // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen
66
   uint8_t UfoAusrichtung;         // X oder + Formation
67
   uint8_t I_Faktor;               // Wert : 0-250
68
   uint8_t UserParam1;             // Wert : 0-250
69
   uint8_t UserParam2;             // Wert : 0-250
70
   uint8_t UserParam3;             // Wert : 0-250
71
   uint8_t UserParam4;             // Wert : 0-250
72
   uint8_t ServoNickControl;       // Wert : 0-250     // Stellung des Servos
73
   uint8_t ServoNickComp;          // Wert : 0-250     // Einfluss Gyro/Servo
74
   uint8_t ServoNickMin;           // Wert : 0-250     // Anschlag
75
   uint8_t ServoNickMax;           // Wert : 0-250     // Anschlag
76
   uint8_t ServoNickRefresh;       //
77
   uint8_t LoopGasLimit;           // Wert: 0-250  max. Gas während Looping
78
   uint8_t LoopThreshold;          // Wert: 0-250  Schwelle für Stickausschlag
79
   uint8_t LoopHysterese;          // Wert: 0-250  Hysterese für Stickausschlag
80
   uint8_t AchsKopplung1;          // Wert: 0-250  Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung)
81
   uint8_t AchsGegenKopplung1;     // Wert: 0-250  Faktor, mit dem Gier die Achsen Roll und Nick Gegenkoppelt (NickRollGegenkopplung)
82
   uint8_t WinkelUmschlagNick;     // Wert: 0-250  180°-Punkt
83
   uint8_t WinkelUmschlagRoll;     // Wert: 0-250  180°-Punkt
84
   uint8_t GyroAccAbgleich;        // 1/k  (Koppel_ACC_Wirkung)
85
   uint8_t Driftkomp;
86
   uint8_t DynamicStability;
87
   uint8_t UserParam5;             // Wert : 0-250
88
   uint8_t UserParam6;             // Wert : 0-250
89
   uint8_t UserParam7;             // Wert : 0-250
90
   uint8_t UserParam8;             // Wert : 0-250
91
   uint8_t LoopConfig;             // see upper defines for bitcoding
92
   uint8_t ServoNickCompInvert;    // Wert : 0-250   0 oder 1  // WICHTIG!!! am Ende lassen
93
   uint8_t Reserved[4];
94
   int8_t Name[12];
95
 } paramset_t;
96
 
97
#define  PARAMSET_STRUCT_LEN  sizeof(paramset_t)
98
 
99
extern paramset_t ParamSet;
100
 
101
extern void ParamSet_Init(void);
102
extern void ParamSet_ReadFromEEProm(uint8_t setnumber);
103
extern void ParamSet_WriteToEEProm(uint8_t setnumber);
104
extern uint8_t GetActiveParamSet(void);
105
extern void SetActiveParamSet(uint8_t setnumber);
106
 
107
 
108
extern uint8_t GetParamByte(uint8_t param_id);
109
extern void SetParamByte(uint8_t param_id, uint8_t value);
110
extern uint16_t GetParamWord(uint8_t param_id);
111
extern void SetParamWord(uint8_t param_id, uint16_t value);
112
 
685 killagreg 113
#endif //_EEPROM_H