Subversion Repositories FlightCtrl

Rev

Rev 2159 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2159 Rev 2189
1
#ifndef _EEPROM_H
1
#ifndef _EEPROM_H
2
#define _EEPROM_H
2
#define _EEPROM_H
3
 
3
 
4
#include <inttypes.h>
4
#include <inttypes.h>
5
#include "configuration.h"
5
#include "configuration.h"
6
#include "analog.h"
-
 
7
 
6
 
8
#define EEPROM_ADR_PARAM_BEGIN  0
7
#define EEPROM_ADR_PARAM_BEGIN  0
9
#define EEPROM_CHECKSUMMED_BLOCK_OVERHEAD 3
8
#define EEPROM_CHECKSUMMED_BLOCK_OVERHEAD 3
10
 
9
 
11
#define PID_ACTIVE_SET                  0   // byte
10
#define PID_ACTIVE_SET                  0   // byte
12
//#define EEPROM_ADR_ACCOFFSET          1
11
//#define EEPROM_ADR_ACCOFFSET          1
13
//#define EEPROM_ADR_GYROOFFSET         (EEPROM_ADR_ACCOFFSET+sizeof(SensorOffset_t)+EEPROM_CHECKSUMMED_BLOCK_OVERHEAD)
12
//#define EEPROM_ADR_GYROOFFSET         (EEPROM_ADR_ACCOFFSET+sizeof(SensorOffset_t)+EEPROM_CHECKSUMMED_BLOCK_OVERHEAD)
14
//#define EEPROM_ADR_GYROAMPLIFIER      (EEPROM_ADR_GYROOFFSET+sizeof(SensorOffset_t)+EEPROM_CHECKSUMMED_BLOCK_OVERHEAD)
13
//#define EEPROM_ADR_GYROAMPLIFIER      (EEPROM_ADR_GYROOFFSET+sizeof(SensorOffset_t)+EEPROM_CHECKSUMMED_BLOCK_OVERHEAD)
15
//#define EEPROM_ADR_CHANNELMAP             (EEPROM_ADR_GYROAMPLIFIER+sizeof(SensorOffset_t)+EEPROM_CHECKSUMMED_BLOCK_OVERHEAD)
14
//#define EEPROM_ADR_CHANNELMAP             (EEPROM_ADR_GYROAMPLIFIER+sizeof(SensorOffset_t)+EEPROM_CHECKSUMMED_BLOCK_OVERHEAD)
16
//#define EEPROM_ADR_MIXER_TABLE                (EEPROM_ADR_CHANNELMAP+sizeof(ChannelMap_t)+EEPROM_CHECKSUMMED_BLOCK_OVERHEAD)
15
//#define EEPROM_ADR_MIXER_TABLE                (EEPROM_ADR_CHANNELMAP+sizeof(ChannelMap_t)+EEPROM_CHECKSUMMED_BLOCK_OVERHEAD)
17
//#define EEPROM_ADR_PARAMSET_BEGIN     (EEPROM_ADR_MIXER_TABLE+sizeof(MixerMatrix_t)+EEPROM_CHECKSUMMED_BLOCK_OVERHEAD)
16
//#define EEPROM_ADR_PARAMSET_BEGIN     (EEPROM_ADR_MIXER_TABLE+sizeof(MixerMatrix_t)+EEPROM_CHECKSUMMED_BLOCK_OVERHEAD)
18
 
17
 
19
#define EEPROM_ADR_ACCOFFSET            16
18
#define EEPROM_ADR_ACCELOFFSET          16
20
#define EEPROM_ADR_GYROOFFSET           32
19
#define EEPROM_ADR_GYROOFFSET           32
21
#define EEPROM_ADR_GYROAMPLIFIER    48
20
#define EEPROM_ADR_GYROAMPLIFIER    48
22
#define EEPROM_ADR_CHANNELMAP           64
21
#define EEPROM_ADR_CHANNELMAP           64
23
#define EEPROM_ADR_IMU_CONFIG       100
22
#define EEPROM_ADR_IMU_CONFIG       100
24
#define EEPROM_ADR_MIXER_TABLE      128
23
#define EEPROM_ADR_MIXER_TABLE      128
25
#define EEPROM_ADR_PARAMSET_BEGIN   256
24
#define EEPROM_ADR_PARAMSET_BEGIN   384
26
 
25
 
27
#define CHANNELMAP_REVISION         0
26
#define CHANNELMAP_REVISION         0
28
#define EEPARAM_REVISION                3
27
#define EEPARAM_REVISION                5
29
#define EEMIXER_REVISION                1
28
#define EEMIXER_REVISION                3
30
#define SENSOROFFSET_REVISION       0
29
#define SENSOROFFSET_REVISION       0
31
#define IMUCONFIG_REVISION          0
30
#define IMUCONFIG_REVISION          0
32
 
31
 
33
void paramSet_readOrDefault(void);
32
void paramSet_readOrDefault(void);
34
void channelMap_readOrDefault(void);
33
void channelMap_readOrDefault(void);
35
void motorMixer_readOrDefault(void);
34
void outputMixer_readOrDefault(void);
36
void IMUConfig_readOrDefault(void);
35
void IMUConfig_readOrDefault(void);
37
void IMUConfig_writeToEEprom(void);
36
void IMUConfig_writeToEEprom(void);
38
 
37
 
39
uint8_t paramSet_readFromEEProm(uint8_t setnumber);
38
uint8_t paramSet_readFromEEProm(uint8_t setnumber);
40
void paramSet_writeToEEProm(uint8_t setnumber);
39
void paramSet_writeToEEProm(uint8_t setnumber);
41
 
40
 
42
//uint8_t channelMap_readFromEEProm(void);
41
//uint8_t channelMap_readFromEEProm(void);
43
void channelMap_writeToEEProm(void);
42
void channelMap_writeToEEProm(void);
44
 
43
 
45
//uint8_t motorMixer_readFromEEProm(void);
44
//uint8_t motorMixer_readFromEEProm(void);
46
void motorMixer_writeToEEProm(void);
45
void outputMixer_writeToEEProm(void);
47
 
46
 
48
uint8_t gyroAmplifierOffset_readFromEEProm(void);
47
uint8_t gyroAmplifierOffset_readFromEEProm(void);
49
void gyroAmplifierOffset_writeToEEProm(void);
48
void gyroAmplifierOffset_writeToEEProm(void);
50
 
49
 
51
uint8_t gyroOffset_readFromEEProm(void);
50
uint8_t gyroOffset_readFromEEProm(void);
52
void gyroOffset_writeToEEProm(void);
51
void gyroOffset_writeToEEProm(void);
53
 
52
 
54
uint8_t accOffset_readFromEEProm(void);
53
uint8_t accelOffset_readFromEEProm(void);
55
void accOffset_writeToEEProm(void);
54
void accelOffset_writeToEEProm(void);
56
 
55
 
57
uint8_t getParamByte(uint16_t param_id);
56
uint8_t getParamByte(uint16_t param_id);
58
void setParamByte(uint16_t param_id, uint8_t value);
57
void setParamByte(uint16_t param_id, uint8_t value);
59
//uint16_t getParamWord(uint16_t param_id);
58
//uint16_t getParamWord(uint16_t param_id);
60
//void setParamWord(uint16_t param_id, uint16_t value);
59
//void setParamWord(uint16_t param_id, uint16_t value);
61
 
60
 
62
uint8_t getActiveParamSet(void);
61
uint8_t getActiveParamSet(void);
63
void setActiveParamSet(uint8_t setnumber);
62
void setActiveParamSet(uint8_t setnumber);
64
 
63
 
65
#endif //_EEPROM_H
64
#endif //_EEPROM_H
66
 
65