ESP8266 SHT21 sensor
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

storage.h 561B

12345678910111213141516171819202122232425262728
  1. #ifndef __STORAGE_H__
  2. #define __STORAGE_H__
  3. #include "config.h"
  4. struct __attribute__((__packed__)) Measurement {
  5. float temperature;
  6. float humidity;
  7. };
  8. struct __attribute__((__packed__)) Header {
  9. uint16_t count;
  10. uint16_t checksum;
  11. };
  12. #define MAX_STORAGE (EEPROM_SIZE - sizeof(Header)) / sizeof(Measurement)
  13. struct __attribute__((__packed__)) PersistentStorage {
  14. Measurement data[MAX_STORAGE];
  15. Header header;
  16. };
  17. void initMemory(void);
  18. void writeMemory(PersistentStorage &s);
  19. PersistentStorage readMemory();
  20. #endif // __STORAGE_H__