mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Добавляем модуль-драйвер для RTC часов
This commit is contained in:
@@ -7,9 +7,24 @@
|
|||||||
"header": "Расширения"
|
"header": "Расширения"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "1. Расширитель портов Mcp23017",
|
"name": "1. Поддержка DS1302(1), DS1307(2), DS3231(3), RX8025(4)",
|
||||||
"num": 1,
|
"num": 1,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
|
"subtype": "IarduinoRTC",
|
||||||
|
"id": "RTC",
|
||||||
|
"widget": "",
|
||||||
|
"page": "",
|
||||||
|
"descr": "",
|
||||||
|
"int": "0",
|
||||||
|
"chipNum": 1,
|
||||||
|
"rst": 16,
|
||||||
|
"clk": 5,
|
||||||
|
"dat": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "2. Расширитель портов Mcp23017",
|
||||||
|
"num": 2,
|
||||||
|
"type": "Reading",
|
||||||
"subtype": "Mcp23017",
|
"subtype": "Mcp23017",
|
||||||
"id": "Mcp",
|
"id": "Mcp",
|
||||||
"widget": "",
|
"widget": "",
|
||||||
@@ -20,8 +35,8 @@
|
|||||||
"index": 1
|
"index": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "2. Доп. функции системы",
|
"name": "3. Доп. функции системы",
|
||||||
"num": 2,
|
"num": 3,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "SysExt",
|
"subtype": "SysExt",
|
||||||
"id": "SysExt",
|
"id": "SysExt",
|
||||||
@@ -31,8 +46,8 @@
|
|||||||
"int": 15
|
"int": 15
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "3. Переменная",
|
"name": "4. Переменная",
|
||||||
"num": 3,
|
"num": 4,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Variable",
|
"subtype": "Variable",
|
||||||
"id": "var",
|
"id": "var",
|
||||||
@@ -46,8 +61,8 @@
|
|||||||
"header": "Модули управления"
|
"header": "Модули управления"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "4. Кнопка (подключенная физически)",
|
"name": "5. Кнопка (подключенная физически)",
|
||||||
"num": 4,
|
"num": 5,
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "ButtonIn",
|
"subtype": "ButtonIn",
|
||||||
"id": "btn",
|
"id": "btn",
|
||||||
@@ -62,8 +77,8 @@
|
|||||||
"fixState": 1
|
"fixState": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "5. Кнопка управляющая пином (Реле с кнопкой)",
|
"name": "6. Кнопка управляющая пином (Реле с кнопкой)",
|
||||||
"num": 5,
|
"num": 6,
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "ButtonOut",
|
"subtype": "ButtonOut",
|
||||||
"id": "btn",
|
"id": "btn",
|
||||||
@@ -75,8 +90,8 @@
|
|||||||
"pin": 2
|
"pin": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "6. Таймер",
|
"name": "7. Таймер",
|
||||||
"num": 6,
|
"num": 7,
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "Timer",
|
"subtype": "Timer",
|
||||||
"id": "timer",
|
"id": "timer",
|
||||||
@@ -85,14 +100,16 @@
|
|||||||
"descr": "",
|
"descr": "",
|
||||||
"int": 1,
|
"int": 1,
|
||||||
"countDown": 15,
|
"countDown": 15,
|
||||||
"ticker": 0
|
"ticker": 0,
|
||||||
|
"repeat": 0,
|
||||||
|
"needSave": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"header": "Сенсоры"
|
"header": "Сенсоры"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "7. Датчик напряжения ADS1115",
|
"name": "8. Датчик напряжения ADS1115",
|
||||||
"num": 7,
|
"num": 8,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Ads1115",
|
"subtype": "Ads1115",
|
||||||
"id": "Ads3",
|
"id": "Ads3",
|
||||||
@@ -108,8 +125,8 @@
|
|||||||
"int": 10
|
"int": 10
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "8. Cенсор температуры AHT20",
|
"name": "9. Cенсор температуры AHT20",
|
||||||
"num": 8,
|
"num": 9,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Aht20t",
|
"subtype": "Aht20t",
|
||||||
"id": "Temp20",
|
"id": "Temp20",
|
||||||
@@ -121,8 +138,8 @@
|
|||||||
"round": 1
|
"round": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "9. Cенсор влажности AHT20",
|
"name": "10. Cенсор влажности AHT20",
|
||||||
"num": 9,
|
"num": 10,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Aht20h",
|
"subtype": "Aht20h",
|
||||||
"id": "Hum20",
|
"id": "Hum20",
|
||||||
@@ -134,8 +151,8 @@
|
|||||||
"round": 1
|
"round": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "10. Аналоговый сенсор",
|
"name": "11. Аналоговый сенсор",
|
||||||
"num": 10,
|
"num": 11,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "AnalogAdc",
|
"subtype": "AnalogAdc",
|
||||||
"id": "t",
|
"id": "t",
|
||||||
@@ -150,8 +167,8 @@
|
|||||||
"int": 15
|
"int": 15
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "11. Cенсор температуры Bme280",
|
"name": "12. Cенсор температуры Bme280",
|
||||||
"num": 11,
|
"num": 12,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Bme280t",
|
"subtype": "Bme280t",
|
||||||
"id": "tmp3",
|
"id": "tmp3",
|
||||||
@@ -163,8 +180,8 @@
|
|||||||
"round": 1
|
"round": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "12. Cенсор давления Bme280",
|
"name": "13. Cенсор давления Bme280",
|
||||||
"num": 12,
|
"num": 13,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Bme280p",
|
"subtype": "Bme280p",
|
||||||
"id": "Press3",
|
"id": "Press3",
|
||||||
@@ -176,8 +193,8 @@
|
|||||||
"round": 1
|
"round": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "13. Cенсор влажности Bme280",
|
"name": "14. Cенсор влажности Bme280",
|
||||||
"num": 13,
|
"num": 14,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Bme280h",
|
"subtype": "Bme280h",
|
||||||
"id": "Hum3",
|
"id": "Hum3",
|
||||||
@@ -189,8 +206,8 @@
|
|||||||
"round": 1
|
"round": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "14. Cенсор температуры Bmp280",
|
"name": "15. Cенсор температуры Bmp280",
|
||||||
"num": 14,
|
"num": 15,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Bmp280t",
|
"subtype": "Bmp280t",
|
||||||
"id": "tmp3",
|
"id": "tmp3",
|
||||||
@@ -202,8 +219,8 @@
|
|||||||
"round": 1
|
"round": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "15. Cенсор давления Bmp280",
|
"name": "16. Cенсор давления Bmp280",
|
||||||
"num": 15,
|
"num": 16,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Bmp280p",
|
"subtype": "Bmp280p",
|
||||||
"id": "Press3",
|
"id": "Press3",
|
||||||
@@ -215,8 +232,8 @@
|
|||||||
"round": 1
|
"round": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "16. Cенсор температуры dht11",
|
"name": "17. Cенсор температуры dht11",
|
||||||
"num": 16,
|
"num": 17,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Dht1122t",
|
"subtype": "Dht1122t",
|
||||||
"id": "tmp3",
|
"id": "tmp3",
|
||||||
@@ -228,8 +245,8 @@
|
|||||||
"senstype": "dht11"
|
"senstype": "dht11"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "17. Cенсор влажности dht11",
|
"name": "18. Cенсор влажности dht11",
|
||||||
"num": 17,
|
"num": 18,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Dht1122h",
|
"subtype": "Dht1122h",
|
||||||
"id": "Hum3",
|
"id": "Hum3",
|
||||||
@@ -241,8 +258,8 @@
|
|||||||
"senstype": "dht11"
|
"senstype": "dht11"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "18. Cенсор температуры ds18b20",
|
"name": "19. Cенсор температуры ds18b20",
|
||||||
"num": 18,
|
"num": 19,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Ds18b20",
|
"subtype": "Ds18b20",
|
||||||
"id": "dstmp",
|
"id": "dstmp",
|
||||||
@@ -256,8 +273,8 @@
|
|||||||
"round": 1
|
"round": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "19. Cенсор температуры GY21",
|
"name": "20. Cенсор температуры GY21",
|
||||||
"num": 19,
|
"num": 20,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "GY21t",
|
"subtype": "GY21t",
|
||||||
"id": "tmp4",
|
"id": "tmp4",
|
||||||
@@ -268,8 +285,8 @@
|
|||||||
"int": 15
|
"int": 15
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "20. Cенсор влажности GY21",
|
"name": "21. Cенсор влажности GY21",
|
||||||
"num": 20,
|
"num": 21,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "GY21h",
|
"subtype": "GY21h",
|
||||||
"id": "Hum4",
|
"id": "Hum4",
|
||||||
@@ -280,8 +297,8 @@
|
|||||||
"int": 15
|
"int": 15
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "21. Cенсор температуры HDC1080",
|
"name": "22. Cенсор температуры HDC1080",
|
||||||
"num": 21,
|
"num": 22,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Hdc1080t",
|
"subtype": "Hdc1080t",
|
||||||
"id": "Temp1080",
|
"id": "Temp1080",
|
||||||
@@ -293,8 +310,8 @@
|
|||||||
"round": 1
|
"round": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "22. Cенсор влажности HDC1080",
|
"name": "23. Cенсор влажности HDC1080",
|
||||||
"num": 22,
|
"num": 23,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Hdc1080h",
|
"subtype": "Hdc1080h",
|
||||||
"id": "Hum1080",
|
"id": "Hum1080",
|
||||||
@@ -306,8 +323,8 @@
|
|||||||
"round": 1
|
"round": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "23. Cенсор температуры MAX6675",
|
"name": "24. Cенсор температуры MAX6675",
|
||||||
"num": 23,
|
"num": 24,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Max6675t",
|
"subtype": "Max6675t",
|
||||||
"id": "maxtmp",
|
"id": "maxtmp",
|
||||||
@@ -320,8 +337,8 @@
|
|||||||
"CLK": 14
|
"CLK": 14
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "24. Датчик CO2 MHZ-19 UART",
|
"name": "25. Датчик CO2 MHZ-19 UART",
|
||||||
"num": 24,
|
"num": 25,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Mhz19uart",
|
"subtype": "Mhz19uart",
|
||||||
"id": "co2uart",
|
"id": "co2uart",
|
||||||
@@ -339,8 +356,8 @@
|
|||||||
"ABC": 1
|
"ABC": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "25. Датчик CO2 MHZ-19 PWM",
|
"name": "26. Датчик CO2 MHZ-19 PWM",
|
||||||
"num": 25,
|
"num": 26,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Mhz19pwm",
|
"subtype": "Mhz19pwm",
|
||||||
"id": "co2pwm",
|
"id": "co2pwm",
|
||||||
@@ -354,8 +371,8 @@
|
|||||||
"int": 300
|
"int": 300
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "26. Cенсор температуры от MHZ-19 UART",
|
"name": "27. Cенсор температуры от MHZ-19 UART",
|
||||||
"num": 26,
|
"num": 27,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Mhz19temp",
|
"subtype": "Mhz19temp",
|
||||||
"id": "Mhz19temp",
|
"id": "Mhz19temp",
|
||||||
@@ -371,8 +388,8 @@
|
|||||||
"int": 30
|
"int": 30
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "27. Рабочий диапазон от MHZ-19 UART",
|
"name": "28. Рабочий диапазон от MHZ-19 UART",
|
||||||
"num": 27,
|
"num": 28,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Mhz19range",
|
"subtype": "Mhz19range",
|
||||||
"id": "Mhz19range",
|
"id": "Mhz19range",
|
||||||
@@ -389,8 +406,8 @@
|
|||||||
"int": 30
|
"int": 30
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "28. Автокалибровка от MHZ-19 UART",
|
"name": "29. Автокалибровка от MHZ-19 UART",
|
||||||
"num": 28,
|
"num": 29,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Mhz19ABC",
|
"subtype": "Mhz19ABC",
|
||||||
"id": "Mhz19ABC",
|
"id": "Mhz19ABC",
|
||||||
@@ -404,8 +421,8 @@
|
|||||||
"int": 30
|
"int": 30
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "29. Датчик пыли SDS011 PM25",
|
"name": "30. Датчик пыли SDS011 PM25",
|
||||||
"num": 29,
|
"num": 30,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sds011_25",
|
"subtype": "Sds011_25",
|
||||||
"id": "pmuart25",
|
"id": "pmuart25",
|
||||||
@@ -422,8 +439,8 @@
|
|||||||
"period": 300
|
"period": 300
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "30. Датчик пыли SDS011 PM10",
|
"name": "31. Датчик пыли SDS011 PM10",
|
||||||
"num": 30,
|
"num": 31,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sds011_10",
|
"subtype": "Sds011_10",
|
||||||
"id": "pmuart10",
|
"id": "pmuart10",
|
||||||
@@ -440,8 +457,8 @@
|
|||||||
"period": 300
|
"period": 300
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "31. Cенсор температуры Sht20",
|
"name": "32. Cенсор температуры Sht20",
|
||||||
"num": 31,
|
"num": 32,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sht20t",
|
"subtype": "Sht20t",
|
||||||
"id": "tmp2",
|
"id": "tmp2",
|
||||||
@@ -452,8 +469,8 @@
|
|||||||
"round": 1
|
"round": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "32. Cенсор влажности Sht20",
|
"name": "33. Cенсор влажности Sht20",
|
||||||
"num": 32,
|
"num": 33,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sht20h",
|
"subtype": "Sht20h",
|
||||||
"id": "Hum2",
|
"id": "Hum2",
|
||||||
@@ -467,8 +484,8 @@
|
|||||||
"header": "Экраны"
|
"header": "Экраны"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "33. LCD экран 2004",
|
"name": "34. LCD экран 2004",
|
||||||
"num": 33,
|
"num": 34,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Lcd2004",
|
"subtype": "Lcd2004",
|
||||||
"id": "Lcd",
|
"id": "Lcd",
|
||||||
@@ -482,8 +499,8 @@
|
|||||||
"id2show": "id датчика"
|
"id2show": "id датчика"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "34. LCD экран 1602",
|
"name": "35. LCD экран 1602",
|
||||||
"num": 34,
|
"num": 35,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Lcd2004",
|
"subtype": "Lcd2004",
|
||||||
"id": "Lcd",
|
"id": "Lcd",
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "ESPConfiguration.h"
|
#include "ESPConfiguration.h"
|
||||||
|
|
||||||
|
void* getAPI_IarduinoRTC(String subtype, String params);
|
||||||
void* getAPI_Mcp23017(String subtype, String params);
|
void* getAPI_Mcp23017(String subtype, String params);
|
||||||
void* getAPI_SysExt(String subtype, String params);
|
void* getAPI_SysExt(String subtype, String params);
|
||||||
void* getAPI_Variable(String subtype, String params);
|
void* getAPI_Variable(String subtype, String params);
|
||||||
@@ -23,6 +24,7 @@ void* getAPI_Lcd2004(String subtype, String params);
|
|||||||
|
|
||||||
void* getAPI(String subtype, String params) {
|
void* getAPI(String subtype, String params) {
|
||||||
void* tmpAPI;
|
void* tmpAPI;
|
||||||
|
if ((tmpAPI = getAPI_IarduinoRTC(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Mcp23017(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Mcp23017(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_SysExt(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_SysExt(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI;
|
||||||
|
|||||||
78
src/modules/system/IarduinoRTC/IarduinoRTC.cpp
Normal file
78
src/modules/system/IarduinoRTC/IarduinoRTC.cpp
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
#include "Global.h"
|
||||||
|
#include "classes/IoTItem.h"
|
||||||
|
#include "classes/IoTRTC.h"
|
||||||
|
|
||||||
|
#include <iarduino_RTC.h>
|
||||||
|
#include "iarduino_RTC_DS1302.h" // Подключаем файл iarduino_RTC_DS1302.h
|
||||||
|
#include "iarduino_RTC_DS1307.h" // Подключаем файл iarduino_RTC_DS1307.h
|
||||||
|
#include "iarduino_RTC_DS3231.h" // Подключаем файл iarduino_RTC_DS3231.h
|
||||||
|
#include "iarduino_RTC_RX8025.h"
|
||||||
|
|
||||||
|
extern IoTRTC *watch;
|
||||||
|
|
||||||
|
|
||||||
|
class IarduinoRTC : public IoTItem {
|
||||||
|
private:
|
||||||
|
int _chipNum, _rst, _clk, _dat;
|
||||||
|
iarduino_RTC_BASE *RTCDriver;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
IarduinoRTC(String parameters): IoTItem(parameters) {
|
||||||
|
jsonRead(parameters, "chipNum", _chipNum);
|
||||||
|
jsonRead(parameters, "rst", _rst);
|
||||||
|
jsonRead(parameters, "clk", _clk);
|
||||||
|
jsonRead(parameters, "dat", _dat);
|
||||||
|
|
||||||
|
switch (_chipNum) {
|
||||||
|
case 1:
|
||||||
|
RTCDriver = new iarduino_RTC_DS1302(_rst, _clk, _dat);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
RTCDriver = new iarduino_RTC_DS1307();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
RTCDriver = new iarduino_RTC_DS3231();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
RTCDriver = new iarduino_RTC_RX8025();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (RTCDriver) RTCDriver->begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void doByInterval() { }
|
||||||
|
|
||||||
|
IoTValue execute(String command, std::vector<IoTValue> ¶m) {
|
||||||
|
if (command == "getTime") {
|
||||||
|
if (param.size()) {
|
||||||
|
value.isDecimal = false;
|
||||||
|
value.valS = watch->gettime(param[0].valS);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
} else if (command == "saveSysTime") {
|
||||||
|
tm localTimeVar;
|
||||||
|
time_t timeNowVar;
|
||||||
|
time(&timeNowVar);
|
||||||
|
localTimeVar = *localtime(&timeNowVar);
|
||||||
|
watch->settime(localTimeVar.tm_sec, localTimeVar.tm_min, localTimeVar.tm_hour, localTimeVar.tm_mday, localTimeVar.tm_mon+1, localTimeVar.tm_year-100, localTimeVar.tm_wday);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
iarduino_RTC_BASE* getRtcDriver() {
|
||||||
|
return RTCDriver;
|
||||||
|
}
|
||||||
|
|
||||||
|
~IarduinoRTC() {};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void* getAPI_IarduinoRTC(String subtype, String param) {
|
||||||
|
if (subtype == F("IarduinoRTC")) {
|
||||||
|
return new IarduinoRTC(param);
|
||||||
|
} else {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
18
src/modules/system/IarduinoRTC/items.json
Normal file
18
src/modules/system/IarduinoRTC/items.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "Поддержка DS1302(1), DS1307(2), DS3231(3), RX8025(4)",
|
||||||
|
"num": 29,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "IarduinoRTC",
|
||||||
|
"id": "RTC",
|
||||||
|
"widget": "",
|
||||||
|
"page": "",
|
||||||
|
"descr": "",
|
||||||
|
|
||||||
|
"int": "0",
|
||||||
|
"chipNum": 1,
|
||||||
|
"rst": 16,
|
||||||
|
"clk": 5,
|
||||||
|
"dat": 4
|
||||||
|
}
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user