initial check in based on SVN revision 575
This commit is contained in:
88
source/eeprom.h
Normal file
88
source/eeprom.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* eeprom.h
|
||||
*
|
||||
* Created on: Nov 11, 2022
|
||||
* Author: Keith.Lloyd
|
||||
*/
|
||||
|
||||
#ifndef EEPROM_H_
|
||||
#define EEPROM_H_
|
||||
|
||||
/*
|
||||
* CAUTION: avoid writing across a 128 byte page boundary! This will cause rollover per the datasheet section 6.6
|
||||
*/
|
||||
|
||||
//EEPROM 128 byte pages
|
||||
#define EE_PAGE_SIZE 128 //Page size in bytes
|
||||
|
||||
#define EE_PAGE_BL (0 * EE_PAGE_SIZE) //Bootloader data. DO NOT USE!
|
||||
#define EE_PAGE_SYS (1 * EE_PAGE_SIZE) //System info
|
||||
#define EE_PAGE_DATA (2 * EE_PAGE_SIZE) //Saved data
|
||||
#define EE_PAGE_FREQ1 (3 * EE_PAGE_SIZE) //Frequency data page 1
|
||||
#define EE_PAGE_FREQ2 (4 * EE_PAGE_SIZE) //Frequency data page 2
|
||||
#define EE_PAGE_HW_FIXES (5 * EE_PAGE_SIZE) //END of EEPROM data. Used for EE_EraseAllData()
|
||||
|
||||
/*******************************************************************************************************************/
|
||||
//SYSTEM INFO - EE_PAGE_SYS
|
||||
/*******************************************************************************************************************/
|
||||
//defines are eeprom addresses in bytes
|
||||
#define EE_SYS_MFG (EE_PAGE_SYS + 0) //Manufacturer string SYS_INFO_LENGTH is 24 bytes
|
||||
#define EE_SYS_MODEL_NAME (EE_PAGE_SYS + 24) //Model name string SYS_INFO_LENGTH is 24 bytes
|
||||
#define EE_SYS_SERIAL (EE_PAGE_SYS + 48) //Serial Number string SYS_INFO_LENGTH is 24 bytes
|
||||
#define EE_SYS_MFG_DATE (EE_PAGE_SYS + 72) //Manufacture Date SYS_INFO_LENGTH is 24 bytes
|
||||
#define EE_SYS_MODEL_NUMBER (EE_PAGE_SYS + 96) //Model number string SYS_INFO_LENGTH is 24 bytes
|
||||
//Next available is 120
|
||||
|
||||
/*******************************************************************************************************************/
|
||||
//SAVED DATA - EE_PAGE_DATA
|
||||
/*******************************************************************************************************************/
|
||||
|
||||
#define EE_DATA_FREQUENCY (EE_PAGE_DATA + 0) //Index of operating frequency UINT32 4 bytes
|
||||
#define EE_DATA_MODE (EE_PAGE_DATA + 4) //Mode ( In Bytes)
|
||||
#define EE_DATA_TIMER (EE_PAGE_DATA + 8) //autoShutdown Timer setting UINT32 4 bytes
|
||||
#define EE_DATA_LANGUAGE (EE_PAGE_DATA + 12) //System language UINT32 4 bytes
|
||||
|
||||
/*******************************************************************************************************************/
|
||||
//FREQUENCY DATA - EE_PAGE_HARDWARE_FIXES
|
||||
/*******************************************************************************************************************/
|
||||
|
||||
#define EE_FREQ_NUM (EE_PAGE_FREQ1 + 0) //Number of frequencies
|
||||
|
||||
//Addresses 4 through 39 reserved for future use
|
||||
|
||||
#define EE_FREQ_START (EE_PAGE_FREQ1 + 40) //Start of frequency data. Freqs are save as packed UINT32
|
||||
|
||||
//Frequencies are stored as 1 packed UINT32_t per frequency, so 32 per 128 byte EEPROM page.
|
||||
//21 on page1 and up to 32 on page2 gives 53 max frequencies. Need more space if storing more than that!
|
||||
//If each frequency stored is a separate call to EE_WriteMemoryUINT32() it will not cause problems with EEPROM page wrap
|
||||
|
||||
/*******************************************************************************************************************/
|
||||
//HARDWARE FIX DATA - EE_PAGE_FREQ
|
||||
/*******************************************************************************************************************/
|
||||
|
||||
#define EE_HWFIX_INIT (EE_PAGE_HW_FIXES + 0) //Hardware fix eeprom page initialized
|
||||
#define EE_HWFIX_VBATT_CAP_021 (EE_PAGE_HW_FIXES + 4) //Add cap parallel with R6 on 208021
|
||||
#define EE_HWFIX_MAIN_PCBA_PN (EE_PAGE_HW_FIXES + 8) //Main PCBA part number
|
||||
//future hardware fixes go here
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void EE_LoadData(void);
|
||||
bool EE_LoadFrequencies(void);
|
||||
void EE_SaveData(void); // Save settings to EEPROM
|
||||
void EE_EraseAllData(void);
|
||||
|
||||
void EE_Test(void);
|
||||
void EE_TestBytes(void);
|
||||
|
||||
void EE_WriteMemoryUINT32(uint16_t address, uint32_t *pdata);
|
||||
void EE_ReadMemoryUINT32(uint16_t address, uint32_t *pdata);
|
||||
void EE_WriteUINT32(uint16_t address, uint32_t data);
|
||||
uint32_t EE_ReadUINT32(uint16_t address);
|
||||
void EE_WriteBytes(uint16_t address, uint8_t *pdata, uint16_t numBytes);
|
||||
void EE_ReadBytes(uint16_t address, uint8_t *pdata, uint16_t numBytes);
|
||||
|
||||
|
||||
#endif /* EEPROM_H_ */
|
||||
Reference in New Issue
Block a user