Subversion Repositories FlightCtrl

Rev

Rev 1654 | Rev 1662 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1654 Rev 1657
Line 1... Line 1...
1
#ifndef _EEPROM_H
1
#ifndef _EEPROM_H
2
#define _EEPROM_H
2
#define _EEPROM_H
Line 3... Line 3...
3
 
3
 
-
 
4
#include <inttypes.h>
Line 4... Line 5...
4
#include <inttypes.h>
5
#include "twimaster.h"
5
 
6
 
6
#define EEPROM_ADR_PARAM_BEGIN          0
7
#define EEPROM_ADR_PARAM_BEGIN          0
7
#define PID_EE_REVISION                 1 // byte
8
#define PID_EE_REVISION                 1 // byte
Line 13... Line 14...
13
#define PID_ACC_TOP                     8 // word
14
#define PID_ACC_TOP                     8 // word
Line 14... Line 15...
14
 
15
 
15
#define PID_FLIGHT_MINUTES_TOTAL        10 // word
16
#define PID_FLIGHT_MINUTES_TOTAL        10 // word
Line 16... Line -...
16
#define PID_FLIGHT_MINUTES                      14 // word
-
 
17
 
-
 
18
#define EEPROM_ADR_CHANNELS                     80      // 12 bytes + 1crc
-
 
Line -... Line 17...
-
 
17
#define PID_FLIGHT_MINUTES                      14 // word
-
 
18
 
-
 
19
 
-
 
20
#define EEPROM_ADR_CHANNELS                     80      // 80 - 93, 12 bytes + 1 byte crc
Line 19... Line 21...
19
#define EEPROM_ADR_PARAMSET                     100
21
#define EEPROM_ADR_PARAMSET                     100 // 100 - 650, 5 * 110 bytes
20
#define EEPROM_ADR_MIXERTABLE           1000 // 1000 - 1077
22
#define EEPROM_ADR_MIXERTABLE           1000 // 1000 - 1078, 78 bytes
21
 
23
#define EEPROM_ADR_BLCONFIG                     1200 // 1200 - 1296, 12 * 8 bytes
22
 
24
 
Line 34... Line 36...
34
} __attribute__((packed)) MixerTable_t;
36
} __attribute__((packed)) MixerTable_t;
Line 35... Line 37...
35
 
37
 
36
extern MixerTable_t Mixer;
38
extern MixerTable_t Mixer;
Line -... Line 39...
-
 
39
extern uint8_t RequiredMotors;
-
 
40
 
-
 
41
#define MASK_SET_PWM_SCALING            0x01
-
 
42
#define MASK_SET_CURRENT_LIMIT          0x02
-
 
43
#define MASK_SET_TEMP_LIMIT                     0x04
-
 
44
#define MASK_SET_CURRENT_SCALING        0x08
-
 
45
#define MASK_SET_BITCONFIG                      0x10
-
 
46
#define MASK_RESET_CAPCOUNTER           0x20
-
 
47
#define MASK_SET_DEFAULT_PARAMS         0x40
-
 
48
#define MASK_SET_SAVE_EEPROM            0x80
-
 
49
 
-
 
50
#define BITCONF_REVERSE_ROTATION 0x01
-
 
51
#define BITCONF_RES1 0x02
-
 
52
#define BITCONF_RES2 0x04
-
 
53
#define BITCONF_RES3 0x08
-
 
54
#define BITCONF_RES4 0x10
-
 
55
#define BITCONF_RES5 0x20
-
 
56
#define BITCONF_RES6 0x40
-
 
57
#define BITCONF_RES7 0x80
-
 
58
 
-
 
59
typedef struct
-
 
60
{
-
 
61
        uint8_t Revision;                       // must be BL_REVISION
-
 
62
        uint8_t SetMask;                        // settings mask
-
 
63
        uint8_t PwmScaling;                     // maximum value of control pwm, acts like a thrust limit
-
 
64
        uint8_t CurrentLimit;           // current limit in A
-
 
65
        uint8_t TempLimit;                      // in °C
-
 
66
        uint8_t CurrentScaling;         // scaling factor for current measurement
-
 
67
        uint8_t BitConfig;                      // see defines above
-
 
68
        uint8_t crc;                            // checksum
-
 
69
}  __attribute__((packed)) BLConfig_t;
-
 
70
 
37
extern uint8_t RequiredMotors;
71
extern BLConfig_t BLConfig[MAX_MOTORS];
38
 
72
 
39
#define CFG_HOEHENREGELUNG       0x01
73
#define CFG_HOEHENREGELUNG       0x01
40
#define CFG_HOEHEN_SCHALTER      0x02
74
#define CFG_HOEHEN_SCHALTER      0x02
41
#define CFG_HEADING_HOLD         0x04
75
#define CFG_HEADING_HOLD         0x04
Line 92... Line 126...
92
#define K_POTI8   11
126
#define K_POTI8   11
Line 93... Line 127...
93
 
127
 
94
 
128
 
-
 
129
#define EEPARAM_REVISION        82 // is count up, if paramater stucture has changed (compatibility)
Line 95... Line 130...
95
#define EEPARAM_REVISION        82 // is count up, if paramater stucture has changed (compatibility)
130
#define EEMIXER_REVISION         1 // is count up, if mixer stucture has changed (compatibility)
96
#define EEMIXER_REVISION         1 // is count up, if mixer stucture has changed (compatibility)
131
#define EEBLCONFIG_REVISON      35 // is count up, if blconfig stucture has changed (compatibility to BLs!)
97
 
132
 
98
// values above 247 representing poti1 to poti8
133
// values above 247 representing poti1 to poti8
Line 207... Line 242...
207
 
242
 
Line 208... Line 243...
208
#define  PARAMSET_STRUCT_LEN  sizeof(paramset_t)
243
#define  PARAMSET_STRUCT_LEN  sizeof(paramset_t)
Line -... Line 244...
-
 
244
 
-
 
245
extern paramset_t EE_Parameter;
209
 
246
 
-
 
247
extern uint8_t RAM_Checksum(uint8_t* pBuffer, uint16_t len);
210
extern paramset_t EE_Parameter;
248
 
211
 
249
extern void ParamSet_Init(void);
Line 212... Line 250...
212
extern void ParamSet_Init(void);
250
 
213
extern uint8_t ParamSet_ReadFromEEProm(uint8_t setnumber);
251
extern uint8_t ParamSet_ReadFromEEProm(uint8_t setnumber);
Line 214... Line 252...
214
extern uint8_t ParamSet_WriteToEEProm(uint8_t setnumber);
252
extern uint8_t ParamSet_WriteToEEProm(uint8_t setnumber);
215
 
253
 
Line -... Line 254...
-
 
254
extern uint8_t GetActiveParamSet(void);
-
 
255
extern void SetActiveParamSet(uint8_t setnumber);
-
 
256
 
Line 216... Line 257...
216
extern uint8_t GetActiveParamSet(void);
257
extern uint8_t MixerTable_ReadFromEEProm(void);
217
extern void SetActiveParamSet(uint8_t setnumber);
258
extern uint8_t MixerTable_WriteToEEProm(void);
218
 
259
 
219
extern uint8_t MixerTable_ReadFromEEProm(void);
260
extern uint8_t BLConfig_ReadFromEEProm(uint8_t index);