Subversion Repositories FlightCtrl

Rev

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

Rev Author Line No. Line
2108 - 1
#ifndef _EEPROM_H
2
#define _EEPROM_H
3
 
4
#include <inttypes.h>
5
#include "configuration.h"
6
#include "analog.h"
7
 
8
#define EEPROM_ADR_PARAM_BEGIN  0
9
#define EEPROM_CHECKSUMMED_BLOCK_OVERHEAD 3
10
 
11
#define PID_ACTIVE_SET                  0   // byte
12
//#define EEPROM_ADR_ACCOFFSET          1
13
//#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)
15
//#define EEPROM_ADR_CHANNELMAP             (EEPROM_ADR_GYROAMPLIFIER+sizeof(sensorOffset_t)+EEPROM_CHECKSUMMED_BLOCK_OVERHEAD)
16
//#define EEPROM_ADR_PARAMSET_BEGIN     (EEPROM_ADR_MIXER_TABLE+sizeof(mixerMatrix_t)+EEPROM_CHECKSUMMED_BLOCK_OVERHEAD)
17
 
18
#define EEPROM_ADR_AIRSPEEDOFFSET   16
19
 
20
#define EEPROM_ADR_GYROOFFSET           32
21
#define EEPROM_ADR_GYROAMPLIFIER    48
22
#define EEPROM_ADR_CHANNELMAP           64
2132 - 23
#define EEPROM_ADR_RCTRIM           96
24
#define EEPROM_ADR_IMU_CONFIG       128
2108 - 25
#define EEPROM_ADR_PARAMSET_BEGIN   256
26
 
2116 - 27
#define CHANNELMAP_REVISION         1
2114 - 28
#define EEPARAM_REVISION                100
2108 - 29
#define EEMIXER_REVISION                0
30
#define SENSOROFFSET_REVISION       0
2132 - 31
#define IMUCONFIG_REVISION          1
2108 - 32
 
33
void paramSet_readOrDefault(void);
34
void channelMap_readOrDefault(void);
2132 - 35
void rcTrim_readOrDefault(void);
2108 - 36
void IMUConfig_readOrDefault(void);
37
void IMUConfig_writeToEEprom(void);
2141 - 38
void rcTrim_writeToEEProm(void);
2108 - 39
 
40
uint8_t paramSet_readFromEEProm(uint8_t setnumber);
41
void paramSet_writeToEEProm(uint8_t setnumber);
42
 
43
void channelMap_writeToEEProm(void);
44
 
45
uint8_t gyroOffset_readFromEEProm(void);
46
void gyroOffset_writeToEEProm(void);
47
 
48
uint8_t airpressureOffset_readFromEEProm(void);
49
void airpressureOffset_writeToEEProm(void);
50
 
51
//uint8_t accOffset_readFromEEProm(void);
52
//void accOffset_writeToEEProm(void);
53
 
54
uint8_t getParamByte(uint16_t param_id);
55
void setParamByte(uint16_t param_id, uint8_t value);
56
 
57
// We have only a single param set here.
58
// uint8_t getActiveParamSet(void);
59
// void setActiveParamSet(uint8_t setnumber);
60
 
61
#endif //_EEPROM_H