configuration.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 MAX7219_DIG_MASK 0xDB
  24. // ^^ reverse of -- 11011 011 -- без BCD декодирования 2, 5
  25. #define CLOCK_CONFIG_FILE ".clock.conf" // leading point for security reasons :)
  26. struct ClockConfig
  27. {
  28. ClockConfig ()
  29. {
  30. AddTZ = 2;
  31. LightTrhLow = 341;
  32. LightTrhHigh = 683;
  33. BrightnessLow = 1;
  34. BrightnessMiddle = 7;
  35. BrightnessHigh = 15;
  36. }
  37. String NetworkSSID;
  38. String NetworkPassword;
  39. float AddTZ; // TimeZone - local time offset
  40. uint16_t LightTrhLow; // Low Light level
  41. uint16_t LightTrhHigh; // High Light level
  42. int8_t BrightnessLow; // Low LED brightness level
  43. int8_t BrightnessMiddle; // Middle LED brightness level
  44. int8_t BrightnessHigh; // High LED brightness level
  45. };
  46. ClockConfig
  47. loadConfig ();
  48. void
  49. saveConfig (ClockConfig& cfg);
  50. extern ClockConfig ActiveConfig;
  51. #endif /* INCLUDE_CONFIGURATION_H_ */