configuration.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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, ((uint16_t)1<<(pin)))
  11. #define PinRes(pin) GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, ((uint16_t)1<<(pin)))
  12. #define PinOut(pin, val) GPIO_REG_WRITE((((val != LOW) ? GPIO_OUT_W1TS_ADDRESS : GPIO_OUT_W1TC_ADDRESS)), (1<<pin));
  13. #define Pin16Set WRITE_PERI_REG(RTC_GPIO_OUT, (READ_PERI_REG(RTC_GPIO_OUT) & (uint32)0xffffffff))
  14. #define Pin16Res WRITE_PERI_REG(RTC_GPIO_OUT, (READ_PERI_REG(RTC_GPIO_OUT) & (uint32)0xfffffffe))
  15. #define Pin16Out(pin, val) WRITE_PERI_REG(RTC_GPIO_OUT, (READ_PERI_REG(RTC_GPIO_OUT) & (uint32)0xfffffffe) | (uint32)(val & 1));
  16. // Pin for communication with DHT sensor
  17. #define DHT_PIN 2
  18. // MAX7219
  19. #define PIN_DIN 14
  20. #define PIN_CLK 13
  21. #define PIN_LOAD 12
  22. #define MAX7219_DIGITS 8
  23. #define CLOCK_CONFIG_FILE ".clock.conf" // leading point for security reasons :)
  24. struct ClockConfig
  25. {
  26. ClockConfig()
  27. {
  28. AddTZ = 2;
  29. LightTrhLow = 341;
  30. LightTrhHigh = 683;
  31. BrightnessLow = 1;
  32. BrightnessMiddle = 7;
  33. BrightnessHigh = 15;
  34. }
  35. String NetworkSSID;
  36. String NetworkPassword;
  37. float AddTZ; // TimeZone - local time offset
  38. uint16_t LightTrhLow; // Low Light level
  39. uint16_t LightTrhHigh; // High Light level
  40. int8_t BrightnessLow; // Low LED brightness level
  41. int8_t BrightnessMiddle; // Middle LED brightness level
  42. int8_t BrightnessHigh; // High LED brightness level
  43. };
  44. ClockConfig loadConfig();
  45. void saveConfig(ClockConfig& cfg);
  46. extern ClockConfig ActiveConfig;
  47. #endif /* INCLUDE_CONFIGURATION_H_ */