configuration.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef INCLUDE_CONFIGURATION_H_
  2. #define INCLUDE_CONFIGURATION_H_
  3. #include <user_config.h>
  4. #include <SmingCore/SmingCore.h>
  5. // If you want, you can define WiFi settings globally in Eclipse Environment Variables
  6. #ifndef WIFI_SSID
  7. #define WIFI_SSID "Heaven-WiFi" // Put you SSID and Password here
  8. #define WIFI_PWD "Heaven-32847"
  9. #endif
  10. #define PinSet(pin) GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, pin)
  11. #define PinRes(pin) GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, pin)
  12. #define Pin16Set WRITE_PERI_REG(RTC_GPIO_OUT, (READ_PERI_REG(RTC_GPIO_OUT) & (uint32)0xffffffff))
  13. #define Pin16Res WRITE_PERI_REG(RTC_GPIO_OUT, (READ_PERI_REG(RTC_GPIO_OUT) & (uint32)0xfffffffe))
  14. // Pin for communication with DHT sensor
  15. #define DHT_PIN 2
  16. // Pin for trigger control output
  17. #define CONTROL_PIN 16
  18. // MAX7219
  19. #define PIN_SCK 14
  20. #define PIN_MOSI 13
  21. #define PIN_SS 12
  22. #define METEO_CONFIG_FILE ".meteo.conf" // leading point for security reasons :)
  23. enum TriggerType
  24. {
  25. eTT_None = 0,
  26. eTT_Temperature,
  27. eTT_Humidity
  28. };
  29. struct MeteoConfig
  30. {
  31. MeteoConfig()
  32. {
  33. AddT = 0;
  34. AddRH = 0;
  35. AddTZ = 2;
  36. Trigger = eTT_Humidity;
  37. RangeMin = 30;
  38. RangeMax = 50;
  39. }
  40. String NetworkSSID;
  41. String NetworkPassword;
  42. float AddT; // Temperature adjustment
  43. float AddRH; // Humidity adjustment
  44. float AddTZ; // TimeZone - local time offset
  45. TriggerType Trigger; // Sensor trigger type
  46. float RangeMin;
  47. float RangeMax;
  48. };
  49. MeteoConfig loadConfig();
  50. void saveConfig(MeteoConfig& cfg);
  51. extern MeteoConfig ActiveConfig;
  52. #endif /* INCLUDE_CONFIGURATION_H_ */