Subversion Repositories FlightCtrl

Rev

Rev 1965 | 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_GYROAMPLIFIER  (EEPROM_ADR_GYROOFFSET+sizeof(sensorOffset_t)+2)
//#define EEPROM_ADR_CHANNELMAP   (EEPROM_ADR_GYROAMPLIFIER+sizeof(sensorOffset_t)+2)
//#define EEPROM_ADR_MIXER_TABLE          (EEPROM_ADR_CHANNELMAP+sizeof(channelMap_t)+2)
//#define EEPROM_ADR_PARAMSET_BEGIN (EEPROM_ADR_MIXER_TABLE+sizeof(mixerMatrix_t)+2)

#define EEPROM_ADR_ACCOFFSET    10
#define EEPROM_ADR_GYROOFFSET   20
#define EEPROM_ADR_GYROAMPLIFIER  30
#define EEPROM_ADR_CHANNELMAP     40
#define EEPROM_ADR_MIXER_TABLE    60
#define EEPROM_ADR_PARAMSET_BEGIN 200

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

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

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

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

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

uint8_t gyroAmplifierOffset_readFromEEProm(void);
void gyroAmplifierOffset_writeToEEProm(void);

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

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

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

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

#endif //_EEPROM_H