Subversion Repositories FlightCtrl

Rev

Rev 1960 | Rev 1965 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef _EEPROM_H
#define _EEPROM_H

#include <inttypes.h>
#include "configuration.h"
#include "analog.h"

#define EEPROM_ADR_PARAM_BEGIN  0

#define PID_ACTIVE_SET       2 // byte
//#define PID_PRESSURE_OFFSET  3 // byte
//#define PID_ACC_PITCH        4 // word
//#define PID_ACC_ROLL         6 // word
//#define PID_ACC_Z            8 // word

#define EEPROM_ADR_ACCOFFSET    20
#define EEPROM_ADR_GYROOFFSET   40
#define EEPROM_ADR_CHANNELMAP   80

#define EEPROM_ADR_PARAMSET_BEGIN       100

#define EEPROM_ADR_MIXER_TABLE          1000

#define CHANNELMAP_REVISION     0
#define EEPARAM_REVISION        0
#define EEMIXER_REVISION        0
#define SENSOROFFSET_REVISION   0

extern void paramSet_readOrDefault(void);
extern void channelMap_readOrDefault(void);
extern void mixerMatrix_readOrDefault(void);

extern uint8_t paramSet_readFromEEProm(uint8_t setnumber);
extern void paramSet_writeToEEProm(uint8_t setnumber);

extern uint8_t channelMap_readFromEEProm(void);
extern void channelMap_writeToEEProm(void);

extern uint8_t mixerMatrix_eeadFromEEProm(void);
extern void mixerMatrix_writeToEEProm(void);

extern uint8_t accOffset_readFromEEProm(void);
extern void accOffset_writeToEEProm(void);

extern uint8_t gyroOffset_readFromEEProm(void);
extern void gyroOffset_writeToEEProm(void);

extern uint8_t getParamByte(uint16_t param_id);
extern void setParamByte(uint16_t param_id, uint8_t value);
extern uint16_t getParamWord(uint16_t param_id);
extern void setParamWord(uint16_t param_id, uint16_t value);

extern uint8_t getActiveParamSet(void);
extern void setActiveParamSet(uint8_t setnumber);

#endif //_EEPROM_H