diff --git a/include/classes/IoTUart.h b/include/classes/IoTUart.h index e45697ca..576f7b27 100644 --- a/include/classes/IoTUart.h +++ b/include/classes/IoTUart.h @@ -28,6 +28,8 @@ class IoTUart : public IoTItem { protected: #ifdef ESP8266 SoftwareSerial* _myUART; +#elif LIBRETINY + SerialClass* _myUART; #else Stream* _myUART; #endif diff --git a/src/classes/IoTUart.cpp b/src/classes/IoTUart.cpp index d6678634..f4b39e65 100644 --- a/src/classes/IoTUart.cpp +++ b/src/classes/IoTUart.cpp @@ -9,11 +9,11 @@ IoTUart::IoTUart(const String& parameters) : IoTItem(parameters) { jsonRead(parameters, "speed", _speed); jsonRead(parameters, "line", _line); -#ifdef ESP8266 +#if defined (ESP8266) _myUART = new SoftwareSerial(_rx, _tx); _myUART->begin(_speed); #endif -#ifdef ESP32 +#if defined (ESP32) if (_line >= 0) { _myUART = new HardwareSerial(_line); ((HardwareSerial*)_myUART)->begin(_speed, SERIAL_8N1, _rx, _tx); @@ -22,6 +22,10 @@ IoTUart::IoTUart(const String& parameters) : IoTItem(parameters) { ((SoftwareSerial*)_myUART)->begin(_speed); } #endif +#if defined (LIBRETINY) + _myUART = new SerialClass(_rx, _tx); + _myUART->begin((unsigned long)_speed); +#endif } void IoTUart::loop() {