|
- /*
- * struct.h
- *
- * Created on: 07.04.2020
- * Author: agr
- */
-
- #ifndef STRUCT_H_
- #define STRUCT_H_
-
-
-
- #include <PubSubClient.h>
- #include <Ethernet.h>
-
- struct config_t
- {
- byte config_set;
- byte use_dhcp;
- byte dhcp_refresh_minutes;
- byte mac[6];
- byte ip[4];
- byte gateway[4];
- byte subnet[4];
- byte dns_server[4];
- unsigned int webserverPort;
- byte mqtt_server[4];
- unsigned int mqttserverPort;
- } eeprom_config;
-
- int EEPROM_readAnything(int ee, config_t& value)
- {
- byte* p = (byte*)(void*)&value;
- unsigned int i;
- for (i = 0; i < sizeof(value); i++)
- *p++ = EEPROM.read(ee++);
- return i;
- }
-
- int EEPROM_writeAnything(int ee, const config_t& value)
- {
- const byte* p = (const byte*)(const void*)&value;
- unsigned int i;
- for (i = 0; i < sizeof(value); i++)
- EEPROM.write(ee++, *p++);
- return i;
- }
-
- EthernetClient MQTTethClient;
- PubSubClient MQTTclient(MQTTethClient);
-
-
- #endif /* STRUCT_H_ */
|