Subversion Repositories FlightCtrl

Rev

Rev 1964 | Rev 1968 | 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          0   // byte
#define EEPROM_ADR_ACCOFFSET    1
#define EEPROM_ADR_GYROOFFSET   (EEPROM_ADR_ACCOFFSET+sizeof(sensorOffset_t)+2)
#define EEPROM_ADR_DACVALUES    (EEPROM_ADR_GYROOFFSET+sizeof(sensorOffset_t)+2)
#define EEPROM_ADR_CHANNELMAP   (EEPROM_ADR_GYROOFFSET+sizeof(sensorOffset_t)+2)
#define EEPROM_ADR_MIXER_TABLE  (EEPROM_ADR_CHANNELMAP+sizeof(channelMap_t)+2)
#define EEPROM_ADR_PARAMSET_BEGIN (EEPROM_ADR_CHANNELMAP+sizeof(mixerMatrix_t)+2)

#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