eeprom.h 1.4 KB

12345678910111213141516171819202122232425
  1. #ifndef __EEPROM_H
  2. #define __EEPROM_H
  3. #include "stm32f1xx_hal.h"
  4. #include "crc_cal.h"
  5. #include "var.h"
  6. #define EEPROM_BEGIN_ADDRESS 0x0800FC00
  7. #define EEPROM_END_ADDRESS 0x0800FFFF
  8. #define EEPROM_FLAG_ADDR_OFFSET EEPROM_BEGIN_ADDRESS + (uint32_t)0 //Flash数据写入标志 4bytes + 4bytes
  9. #define EEPROM_CHECK_CODE_ADDR_OFFSET EEPROM_BEGIN_ADDRESS + (uint32_t)8 //校验码 12bytes + 4bytes
  10. #define EEPROM_USER_PARAM_ADDR_OFFSET EEPROM_BEGIN_ADDRESS + (uint32_t)24 //出厂参数 16bytes + 4bytes
  11. #define EEPROM_MODE_ADDR_OFFSET EEPROM_BEGIN_ADDRESS + (uint32_t)44 //型号 16bytes + 4bytes
  12. #define EEPROM_SN_ADDR_OFFSET EEPROM_BEGIN_ADDRESS + (uint32_t)64 //序列号 16bytes + 4bytes
  13. #define EEPROM_MAC_INFO_ADDR_OFFSET EEPROM_BEGIN_ADDRESS + (uint32_t)84 //生产信息 32bytes + 4bytes
  14. #define EEPROM_LOG_INFO_ADDR_OFFSET EEPROM_BEGIN_ADDRESS + (uint32_t)120 //历史信息 16bytes + 4bytes
  15. #define EEPROM_USER_INFO1_ADDR_OFFSET EEPROM_BEGIN_ADDRESS + (uint32_t)140 //自定义字符串1 16bytes + 4bytes
  16. #define EEPROM_USER_INFO2_ADDR_OFFSET EEPROM_BEGIN_ADDRESS + (uint32_t)160 //自定义字符串2 16bytes + 4bytes
  17. #define EEPROM_USER_INFO3_ADDR_OFFSET EEPROM_BEGIN_ADDRESS + (uint32_t)180 //自定义字符串3 16bytes + 4bytes
  18. extern void EEPROM_Check(void);
  19. extern void EEPROM_DataUpdate(void);
  20. #endif