ESP8266 SHT21 sensor
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * storage.h
  3. *
  4. * EEPROM data history storage.
  5. *
  6. * ----------------------------------------------------------------------------
  7. * "THE BEER-WARE LICENSE" (Revision 42):
  8. * <xythobuz@xythobuz.de> & <ghost-ghost@web.de> wrote this file. As long as
  9. * you retain this notice you can do whatever you want with this stuff. If we
  10. * meet some day, and you think this stuff is worth it, you can buy us a beer
  11. * in return. Thomas Buck & Christian Högerle
  12. * ----------------------------------------------------------------------------
  13. */
  14. #ifndef __STORAGE_H__
  15. #define __STORAGE_H__
  16. #include "config.h"
  17. struct __attribute__((__packed__)) Measurement {
  18. float temperature;
  19. float humidity;
  20. };
  21. struct __attribute__((__packed__)) Header {
  22. uint16_t count;
  23. uint16_t checksum;
  24. };
  25. #define MAX_STORAGE (EEPROM_SIZE - sizeof(Header)) / sizeof(Measurement)
  26. struct __attribute__((__packed__)) PersistentStorage {
  27. Measurement data[MAX_STORAGE];
  28. Header header;
  29. };
  30. void initMemory(void);
  31. void writeMemory(PersistentStorage &s);
  32. PersistentStorage readMemory();
  33. #endif // __STORAGE_H__