Rev 826 | 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 |
||
750 | killagreg | 9 | #define PID_PRESSURE_OFFSET 3 // byte |
706 | killagreg | 10 | #define PID_ACC_PITCH 4 // word |
687 | killagreg | 11 | #define PID_ACC_ROLL 6 // word |
12 | #define PID_ACC_Z 8 // word |
||
13 | |||
700 | killagreg | 14 | #define PID_MM3_X_OFF 10 // byte |
15 | #define PID_MM3_Y_OFF 11 // byte |
||
16 | #define PID_MM3_Z_OFF 12 // byte |
||
17 | #define PID_MM3_X_RANGE 13 // word |
||
18 | #define PID_MM3_Y_RANGE 15 // word |
||
19 | #define PID_MM3_Z_RANGE 17 // word |
||
694 | killagreg | 20 | |
21 | |||
687 | killagreg | 22 | #define EEPROM_ADR_PARAMSET_BEGIN 100 |
23 | |||
24 | // bit mask for mk_param_struct.GlobalConfig |
||
690 | killagreg | 25 | #define CFG_HEIGHT_CONTROL 0x01 |
26 | #define CFG_HEIGHT_SWITCH 0x02 |
||
27 | #define CFG_HEADING_HOLD 0x04 |
||
28 | #define CFG_COMPASS_ACTIVE 0x08 |
||
29 | #define CFG_COMPASS_FIX 0x10 |
||
30 | #define CFG_GPS_ACTIVE 0x20 |
||
31 | #define CFG_AXIS_COUPLING_ACTIVE 0x40 |
||
32 | #define CFG_ROTARY_RATE_LIMITER 0x80 |
||
687 | killagreg | 33 | |
34 | // bit mask for mk_param_struct.LoopConfig |
||
690 | killagreg | 35 | #define CFG_LOOP_UP 0x01 |
36 | #define CFG_LOOP_DOWN 0x02 |
||
37 | #define CFG_LOOP_LEFT 0x04 |
||
38 | #define CFG_LOOP_RIGHT 0x08 |
||
687 | killagreg | 39 | |
690 | killagreg | 40 | // defines for lookup mk_param_struct.ChannelAssignment |
701 | killagreg | 41 | #define CH_PITCH 0 |
707 | killagreg | 42 | #define CH_ROLL 1 |
43 | #define CH_THRUST 2 |
||
44 | #define CH_YAW 3 |
||
45 | #define CH_POTI1 4 |
||
46 | #define CH_POTI2 5 |
||
47 | #define CH_POTI3 6 |
||
48 | #define CH_POTI4 7 |
||
687 | killagreg | 49 | |
50 | #define EEPARAM_VERSION 69 // is count up, if EE_Paramater stucture has changed (compatibility) |
||
51 | |||
703 | killagreg | 52 | // values above 250 representing poti1 to poti4 |
687 | killagreg | 53 | typedef struct |
54 | { |
||
694 | killagreg | 55 | uint8_t ChannelAssignment[8]; // see upper defines for details |
687 | killagreg | 56 | uint8_t GlobalConfig; // see upper defines for bitcoding |
761 | killagreg | 57 | uint8_t Height_MinThrust; // Wert : 0-100 |
58 | uint8_t Height_D; // Wert : 0-250 |
||
59 | uint8_t MaxHeight; // Wert : 0-32 |
||
60 | uint8_t Height_P; // Wert : 0-32 |
||
61 | uint8_t Height_Gain; // Wert : 0-50 |
||
62 | uint8_t Height_ACC_Effect; // Wert : 0-250 |
||
687 | killagreg | 63 | uint8_t Stick_P; // Wert : 1-6 |
64 | uint8_t Stick_D; // Wert : 0-64 |
||
701 | killagreg | 65 | uint8_t Yaw_P; // Wert : 1-20 |
707 | killagreg | 66 | uint8_t Trust_Min; // Wert : 0-32 |
67 | uint8_t Trust_Max; // Wert : 33-250 |
||
826 | killagreg | 68 | uint8_t GyroAccFactor; // Wert : 1-64 |
701 | killagreg | 69 | uint8_t CompassYawEffect; // Wert : 0-32 |
687 | killagreg | 70 | uint8_t Gyro_P; // Wert : 10-250 |
71 | uint8_t Gyro_I; // Wert : 0-250 |
||
690 | killagreg | 72 | uint8_t LowVoltageWarning; // Wert : 0-250 |
707 | killagreg | 73 | uint8_t EmergencyThrust; // Wert : 0-250 //Gaswert bei Empängsverlust |
74 | uint8_t EmergencyThrustDuration; // Wert : 0-250 // Zeitbis auf EmergencyThrust geschaltet wird, wg. Rx-Problemen |
||
745 | killagreg | 75 | uint8_t UfoArrangement; // x oder + Formation |
690 | killagreg | 76 | uint8_t I_Factor; // Wert : 0-250 |
687 | killagreg | 77 | uint8_t UserParam1; // Wert : 0-250 |
78 | uint8_t UserParam2; // Wert : 0-250 |
||
79 | uint8_t UserParam3; // Wert : 0-250 |
||
80 | uint8_t UserParam4; // Wert : 0-250 |
||
701 | killagreg | 81 | uint8_t ServoPitchControl; // Wert : 0-250 // Stellung des Servos |
82 | uint8_t ServoPitchComp; // Wert : 0-250 // Einfluss Gyro/Servo |
||
83 | uint8_t ServoPitchMin; // Wert : 0-250 // Anschlag |
||
84 | uint8_t ServoPitchMax; // Wert : 0-250 // Anschlag |
||
85 | uint8_t ServoPitchRefresh; // |
||
707 | killagreg | 86 | uint8_t LoopThrustLimit; // Wert: 0-250 max. Gas während Looping |
687 | killagreg | 87 | uint8_t LoopThreshold; // Wert: 0-250 Schwelle für Stickausschlag |
690 | killagreg | 88 | uint8_t LoopHysteresis; // Wert: 0-250 Hysterese für Stickausschlag |
706 | killagreg | 89 | uint8_t Yaw_PosFeedback; // Wert: 0-250 Faktor, mit dem Yaw die Achsen Roll und Pitch koppelt (PitchRollMitkopplung) |
90 | uint8_t Yaw_NegFeedback; // Wert: 0-250 Faktor, mit dem Yaw die Achsen Roll und Pitch Gegenkoppelt (PitchRollGegenkopplung) |
||
701 | killagreg | 91 | uint8_t AngleTurnOverPitch; // Wert: 0-250 180°-Punkt |
92 | uint8_t AngleTurnOverRoll; // Wert: 0-250 180°-Punkt |
||
93 | uint8_t GyroAccTrim; // 1/k (Koppel_ACC_Wirkung) |
||
690 | killagreg | 94 | uint8_t DriftComp; |
687 | killagreg | 95 | uint8_t DynamicStability; |
96 | uint8_t UserParam5; // Wert : 0-250 |
||
97 | uint8_t UserParam6; // Wert : 0-250 |
||
98 | uint8_t UserParam7; // Wert : 0-250 |
||
99 | uint8_t UserParam8; // Wert : 0-250 |
||
100 | uint8_t LoopConfig; // see upper defines for bitcoding |
||
701 | killagreg | 101 | uint8_t ServoPitchCompInvert; // Wert : 0-250 0 oder 1 // WICHTIG!!! am Ende lassen |
687 | killagreg | 102 | uint8_t Reserved[4]; |
103 | int8_t Name[12]; |
||
104 | } paramset_t; |
||
105 | |||
106 | #define PARAMSET_STRUCT_LEN sizeof(paramset_t) |
||
107 | |||
108 | extern paramset_t ParamSet; |
||
109 | |||
110 | extern void ParamSet_Init(void); |
||
111 | extern void ParamSet_ReadFromEEProm(uint8_t setnumber); |
||
112 | extern void ParamSet_WriteToEEProm(uint8_t setnumber); |
||
113 | extern uint8_t GetActiveParamSet(void); |
||
114 | extern void SetActiveParamSet(uint8_t setnumber); |
||
115 | |||
116 | |||
117 | extern uint8_t GetParamByte(uint8_t param_id); |
||
118 | extern void SetParamByte(uint8_t param_id, uint8_t value); |
||
119 | extern uint16_t GetParamWord(uint8_t param_id); |
||
120 | extern void SetParamWord(uint8_t param_id, uint16_t value); |
||
121 | |||
685 | killagreg | 122 | #endif //_EEPROM_H |