您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

50 行
1.2 KiB

  1. #ifndef DATA_SAVE_LOAD_H
  2. #define DATA_SAVE_LOAD_H
  3. #include "DataTypes.h"
  4. #include <EEPROM.h>
  5. namespace DataSaveLoad
  6. {
  7. // The numbers are indexes of each data in EEPROM
  8. // it needs to take in in account each data memory size in bytes
  9. enum EEPROM_INDEX
  10. {
  11. INITIALIZED = 0, // bool
  12. CURRENT_MODE_NB = 1, // uint8_t
  13. BOOT_NB = 2, // uint64_t
  14. THERMOMETER_ADJUSTEMENT = 10, // float
  15. HEATING_PERCENTAGE = 14, // uint8_t
  16. SCREENSAVE = 15, // bool
  17. CUSTOM_MODE = 16 // ModeParameters (struct of 7 bytes ? just put it as last element..)
  18. };
  19. void InitEEPROM();
  20. void Clear();
  21. uint8_t Load(int index);
  22. void Write(int index, uint8_t data);
  23. void SetDeviceInitialized(bool initialized);
  24. bool ReadDeviceInitialized();
  25. void SetCurrentMode(uint8_t mode_nb);
  26. uint8_t ReadCurrentMode();
  27. void SetBootNb(uint64_t boot_nb);
  28. uint64_t ReadBootNb();
  29. void SetThermometerAdjustement(float adjustement);
  30. float ReadThermometerAdjustement();
  31. void SetCurrentHeatingPercentage(uint8_t heating_percentage);
  32. uint8_t ReadCurrentHeatingPercentage();
  33. void SetCanScreenSave(bool canScreenSave);
  34. bool ReadCanScreenSave();
  35. void SetCustomMode(ModeParameters mode);
  36. ModeParameters ReadCustomMode();
  37. }
  38. #endif