52 lines
1.1 KiB
C
52 lines
1.1 KiB
C
#ifndef _CONFIG_H_
|
|
#define _CONFIG_H_
|
|
|
|
#include <Arduino.h>
|
|
#include <Wire.h>
|
|
#include <I2C_eeprom.h>
|
|
|
|
#include "globals.h"
|
|
#include "dtc.h"
|
|
|
|
#define EEPROM_SIZE_BYTES I2C_DEVICESIZE_24LC256
|
|
|
|
typedef enum
|
|
{
|
|
NONE,
|
|
FACTION_1,
|
|
FACTION_2,
|
|
FACTION_3
|
|
} factions_t;
|
|
|
|
typedef struct
|
|
{
|
|
uint16_t writeCycleCounter = 0;
|
|
uint32_t faction_1_timer = 0;
|
|
uint32_t faction_2_timer = 0;
|
|
uint32_t faction_3_timer = 0;
|
|
factions_t activeFaction = NONE;
|
|
uint32_t checksum = 0;
|
|
} persistenceData_t;
|
|
|
|
typedef struct
|
|
{
|
|
uint32_t checksum = 0;
|
|
} configData_t;
|
|
|
|
void InitEEPROM();
|
|
void EEPROM_Process();
|
|
void StoreConfig_EEPROM();
|
|
void GetConfig_EEPROM();
|
|
void StorePersistence_EEPROM();
|
|
void GetPersistence_EEPROM();
|
|
void FormatConfig_EEPROM();
|
|
void FormatPersistence_EEPROM();
|
|
uint32_t Checksum_EEPROM(uint8_t const *data, size_t len);
|
|
void dumpEEPROM(uint16_t memoryAddress, uint16_t length);
|
|
void MovePersistencePage_EEPROM(boolean reset);
|
|
uint16_t getPersistanceAddress();
|
|
|
|
extern configData_t ConfigData;
|
|
extern persistenceData_t PersistenceData;
|
|
extern uint16_t eePersistenceMarker;
|
|
#endif // _CONFIG_H_
|