mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 14:12:16 +03:00
fix uart bk7231n
This commit is contained in:
@@ -28,6 +28,8 @@ class IoTUart : public IoTItem {
|
|||||||
protected:
|
protected:
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
SoftwareSerial* _myUART;
|
SoftwareSerial* _myUART;
|
||||||
|
#elif LIBRETINY
|
||||||
|
SerialClass* _myUART;
|
||||||
#else
|
#else
|
||||||
Stream* _myUART;
|
Stream* _myUART;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ IoTUart::IoTUart(const String& parameters) : IoTItem(parameters) {
|
|||||||
jsonRead(parameters, "speed", _speed);
|
jsonRead(parameters, "speed", _speed);
|
||||||
jsonRead(parameters, "line", _line);
|
jsonRead(parameters, "line", _line);
|
||||||
|
|
||||||
#ifdef ESP8266
|
#if defined (ESP8266)
|
||||||
_myUART = new SoftwareSerial(_rx, _tx);
|
_myUART = new SoftwareSerial(_rx, _tx);
|
||||||
_myUART->begin(_speed);
|
_myUART->begin(_speed);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ESP32
|
#if defined (ESP32)
|
||||||
if (_line >= 0) {
|
if (_line >= 0) {
|
||||||
_myUART = new HardwareSerial(_line);
|
_myUART = new HardwareSerial(_line);
|
||||||
((HardwareSerial*)_myUART)->begin(_speed, SERIAL_8N1, _rx, _tx);
|
((HardwareSerial*)_myUART)->begin(_speed, SERIAL_8N1, _rx, _tx);
|
||||||
@@ -22,6 +22,10 @@ IoTUart::IoTUart(const String& parameters) : IoTItem(parameters) {
|
|||||||
((SoftwareSerial*)_myUART)->begin(_speed);
|
((SoftwareSerial*)_myUART)->begin(_speed);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if defined (LIBRETINY)
|
||||||
|
_myUART = new SerialClass(_rx, _tx);
|
||||||
|
_myUART->begin((unsigned long)_speed);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void IoTUart::loop() {
|
void IoTUart::loop() {
|
||||||
|
|||||||
Reference in New Issue
Block a user