Extends the platforms with additional uart methods.

This commit is contained in:
Marco Scholl 2024-02-27 16:02:29 +01:00
parent 03f55f5503
commit f5724c64d1
No known key found for this signature in database
6 changed files with 23 additions and 0 deletions

View File

@ -103,6 +103,11 @@ size_t ArduinoPlatform::readBytesUart(uint8_t *buffer, size_t length)
return length;
}
void ArduinoPlatform::flushUart()
{
return _knxSerial->flush();
}
#ifndef KNX_NO_SPI
void ArduinoPlatform::setupSpi()
{

View File

@ -25,6 +25,7 @@ class ArduinoPlatform : public Platform
virtual size_t writeUart(const uint8_t* buffer, size_t size);
virtual int readUart();
virtual size_t readBytesUart(uint8_t* buffer, size_t length);
virtual void flushUart();
//spi
#ifndef KNX_NO_SPI

View File

@ -57,6 +57,14 @@ void Platform::closeUart()
void Platform::setupUart()
{}
bool Platform::overflowUart()
{
return false;
}
void Platform::flushUart()
{}
uint32_t Platform::currentIpAddress()
{
return 0x01020304;

View File

@ -62,6 +62,8 @@ class Platform
virtual size_t writeUart(const uint8_t* buffer, size_t size);
virtual int readUart();
virtual size_t readBytesUart(uint8_t* buffer, size_t length);
virtual bool overflowUart();
virtual void flushUart();
// SPI
virtual void setupSpi();

View File

@ -85,6 +85,11 @@ void RP2040ArduinoPlatform::knxUartPins(pin_size_t rxPin, pin_size_t txPin)
_txPin = txPin;
}
bool RP2040ArduinoPlatform::overflowUart() {
SerialUART* serial = dynamic_cast<SerialUART*>(_knxSerial);
return serial->overflow();
}
void RP2040ArduinoPlatform::setupUart()
{
SerialUART* serial = dynamic_cast<SerialUART*>(_knxSerial);

View File

@ -68,6 +68,8 @@ public:
// uart
void knxUartPins(pin_size_t rxPin, pin_size_t txPin);
void setupUart();
virtual bool overflowUart();
// unique serial number
uint32_t uniqueSerialNumber() override;