mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
Merge pull request #269 from mgeramb/FixRP2040UARTPinHandling
Fix for RP2040 UART pin handling: Setting of uart pins moved setupUart
This commit is contained in:
commit
4deead3342
@ -10,22 +10,17 @@
|
|||||||
#define KNX_SERIAL Serial1
|
#define KNX_SERIAL Serial1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef KNX_UART_RX_PIN
|
|
||||||
#define KNX_UART_RX_PIN -1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef KNX_UART_TX_PIN
|
|
||||||
#define KNX_UART_TX_PIN -1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Esp32Platform::Esp32Platform()
|
Esp32Platform::Esp32Platform()
|
||||||
#ifndef KNX_NO_DEFAULT_UART
|
#ifndef KNX_NO_DEFAULT_UART
|
||||||
: ArduinoPlatform(&KNX_SERIAL)
|
: ArduinoPlatform(&KNX_SERIAL)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifndef KNX_NO_DEFAULT_UART
|
#ifdef KNX_UART_RX_PIN
|
||||||
knxUartPins(KNX_UART_RX_PIN, KNX_UART_TX_PIN);
|
_rxPin = KNX_UART_RX_PIN;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef KNX_UART_TX_PIN
|
||||||
|
_txPin = KNX_UART_TX_PIN;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Esp32Platform::Esp32Platform(HardwareSerial* s) : ArduinoPlatform(s)
|
Esp32Platform::Esp32Platform(HardwareSerial* s) : ArduinoPlatform(s)
|
||||||
|
@ -56,21 +56,16 @@ extern Wiznet5500lwIP KNX_NETIF;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef KNX_UART_RX_PIN
|
|
||||||
#define KNX_UART_RX_PIN UART_PIN_NOT_DEFINED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef KNX_UART_TX_PIN
|
|
||||||
#define KNX_UART_TX_PIN UART_PIN_NOT_DEFINED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RP2040ArduinoPlatform::RP2040ArduinoPlatform()
|
RP2040ArduinoPlatform::RP2040ArduinoPlatform()
|
||||||
#ifndef KNX_NO_DEFAULT_UART
|
#ifndef KNX_NO_DEFAULT_UART
|
||||||
: ArduinoPlatform(&KNX_SERIAL)
|
: ArduinoPlatform(&KNX_SERIAL)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifndef KNX_NO_DEFAULT_UART
|
#ifdef KNX_UART_RX_PIN
|
||||||
knxUartPins(KNX_UART_RX_PIN, KNX_UART_TX_PIN);
|
_rxPin = KNX_UART_RX_PIN;
|
||||||
|
#endif
|
||||||
|
#ifdef KNX_UART_TX_PIN
|
||||||
|
_txPin = KNX_UART_TX_PIN;
|
||||||
#endif
|
#endif
|
||||||
#ifndef USE_RP2040_EEPROM_EMULATION
|
#ifndef USE_RP2040_EEPROM_EMULATION
|
||||||
_memoryType = Flash;
|
_memoryType = Flash;
|
||||||
@ -86,14 +81,8 @@ RP2040ArduinoPlatform::RP2040ArduinoPlatform( HardwareSerial* s) : ArduinoPlatfo
|
|||||||
|
|
||||||
void RP2040ArduinoPlatform::knxUartPins(pin_size_t rxPin, pin_size_t txPin)
|
void RP2040ArduinoPlatform::knxUartPins(pin_size_t rxPin, pin_size_t txPin)
|
||||||
{
|
{
|
||||||
SerialUART* serial = dynamic_cast<SerialUART*>(_knxSerial);
|
_rxPin = rxPin;
|
||||||
if(serial)
|
_txPin = txPin;
|
||||||
{
|
|
||||||
if (rxPin != UART_PIN_NOT_DEFINED)
|
|
||||||
serial->setRX(rxPin);
|
|
||||||
if (txPin != UART_PIN_NOT_DEFINED)
|
|
||||||
serial->setTX(txPin);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RP2040ArduinoPlatform::setupUart()
|
void RP2040ArduinoPlatform::setupUart()
|
||||||
@ -101,6 +90,10 @@ void RP2040ArduinoPlatform::setupUart()
|
|||||||
SerialUART* serial = dynamic_cast<SerialUART*>(_knxSerial);
|
SerialUART* serial = dynamic_cast<SerialUART*>(_knxSerial);
|
||||||
if(serial)
|
if(serial)
|
||||||
{
|
{
|
||||||
|
if (_rxPin != UART_PIN_NOT_DEFINED)
|
||||||
|
serial->setRX(_rxPin);
|
||||||
|
if (_txPin != UART_PIN_NOT_DEFINED)
|
||||||
|
serial->setTX(_txPin);
|
||||||
serial->setPollingMode();
|
serial->setPollingMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,6 +128,8 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
protected: IPAddress mcastaddr;
|
protected: IPAddress mcastaddr;
|
||||||
protected: uint16_t _port;
|
protected: uint16_t _port;
|
||||||
|
protected: pin_size_t _rxPin = UART_PIN_NOT_DEFINED;
|
||||||
|
protected: pin_size_t _txPin = UART_PIN_NOT_DEFINED;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user