2018-11-07 00:32:36 +01:00
|
|
|
#ifdef ARDUINO_ARCH_ESP8266
|
2018-04-09 22:46:21 +02:00
|
|
|
#include "knx/platform.h"
|
2018-03-16 00:48:39 +01:00
|
|
|
#include <ESP8266WiFi.h>
|
|
|
|
#include <WifiUDP.h>
|
|
|
|
|
2018-11-07 00:32:36 +01:00
|
|
|
#define SerialDBG Serial
|
|
|
|
|
2018-03-16 00:48:39 +01:00
|
|
|
class EspPlatform : public Platform
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EspPlatform();
|
|
|
|
|
|
|
|
// ip stuff
|
|
|
|
uint32_t currentIpAddress();
|
|
|
|
uint32_t currentSubnetMask();
|
|
|
|
uint32_t currentDefaultGateway();
|
|
|
|
void macAddress(uint8_t* addr);
|
|
|
|
|
|
|
|
// basic stuff
|
|
|
|
uint32_t millis();
|
|
|
|
void mdelay(uint32_t millis);
|
|
|
|
void restart();
|
|
|
|
void fatalError();
|
|
|
|
|
|
|
|
//multicast
|
|
|
|
void setupMultiCast(uint32_t addr, uint16_t port);
|
|
|
|
void closeMultiCast();
|
|
|
|
bool sendBytes(uint8_t* buffer, uint16_t len);
|
|
|
|
int readBytes(uint8_t* buffer, uint16_t maxLen);
|
|
|
|
|
2018-08-16 23:58:57 +02:00
|
|
|
//uart
|
|
|
|
void setupUart();
|
|
|
|
void closeUart();
|
|
|
|
int uartAvailable();
|
|
|
|
size_t writeUart(const uint8_t data);
|
|
|
|
size_t writeUart(const uint8_t *buffer, size_t size);
|
|
|
|
int readUart();
|
|
|
|
size_t readBytesUart(uint8_t *buffer, size_t length);
|
|
|
|
|
2018-03-16 00:48:39 +01:00
|
|
|
//memory
|
|
|
|
uint8_t* getEepromBuffer(uint16_t size);
|
|
|
|
void commitToEeprom();
|
|
|
|
private:
|
|
|
|
uint32_t _mulitcastAddr;
|
|
|
|
uint16_t _mulitcastPort;
|
|
|
|
WiFiUDP _udp;
|
|
|
|
};
|
|
|
|
|
2018-11-07 00:32:36 +01:00
|
|
|
#endif
|