Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplementation of TPUart and DMAsupport for rp2040 uart #22

Merged
merged 13 commits into from
May 21, 2024
5 changes: 5 additions & 0 deletions src/arduino_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
1 change: 1 addition & 0 deletions src/arduino_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/knx/bau07B0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,7 @@ bool Bau07B0::isAckRequired(uint16_t address, bool isGrpAddr)
return false;
}

TpUartDataLinkLayer* Bau07B0::getDataLinkLayer() {
return (TpUartDataLinkLayer*)&_dlLayer;
}
#endif
3 changes: 2 additions & 1 deletion src/knx/bau07B0.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class Bau07B0 : public BauSystemBDevice, public ITpUartCallBacks, public DataLin
void loop() override;
bool enabled() override;
void enabled(bool value) override;


TpUartDataLinkLayer* getDataLinkLayer();
protected:
InterfaceObject* getInterfaceObject(uint8_t idx);
InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance);
Expand Down
7 changes: 7 additions & 0 deletions src/knx/bau091A.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,11 @@ bool Bau091A::isAckRequired(uint16_t address, bool isGrpAddr)
return false;
}

IpDataLinkLayer* Bau091A::getPrimaryDataLinkLayer() {
return (IpDataLinkLayer*)&_dlLayerPrimary;
}

TpUartDataLinkLayer* Bau091A::getSecondaryDataLinkLayer() {
return (TpUartDataLinkLayer*)&_dlLayerSecondary;
}
#endif
2 changes: 2 additions & 0 deletions src/knx/bau091A.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class Bau091A : public BauSystemBCoupler, public ITpUartCallBacks, public DataLi
bool enabled() override;
void enabled(bool value) override;

IpDataLinkLayer* getPrimaryDataLinkLayer();
TpUartDataLinkLayer* getSecondaryDataLinkLayer();
protected:
InterfaceObject* getInterfaceObject(uint8_t idx);
InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance);
Expand Down
4 changes: 3 additions & 1 deletion src/knx/bau27B0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,7 @@ void Bau27B0::domainAddressSerialNumberReadLocalConfirm(Priority priority, HopCo
{
}


RfDataLinkLayer* Bau27B0::getDataLinkLayer() {
return (RfDataLinkLayer*)&_dlLayer;
}
#endif // #ifdef USE_RF
1 change: 1 addition & 0 deletions src/knx/bau27B0.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Bau27B0 : public BauSystemBDevice
bool enabled() override;
void enabled(bool value) override;

RfDataLinkLayer* getDataLinkLayer();
protected:
InterfaceObject* getInterfaceObject(uint8_t idx);
InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance);
Expand Down
7 changes: 7 additions & 0 deletions src/knx/bau2920.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,11 @@ void Bau2920::loop()
BauSystemBCoupler::loop();
}

TpUartDataLinkLayer* Bau2920::getPrimaryDataLinkLayer() {
return (TpUartDataLinkLayer*)&_dlLayerPrimary;
}

RfDataLinkLayer* Bau2920::getSecondaryDataLinkLayer() {
return (RfDataLinkLayer*)&_dlLayerSecondary;
}
#endif
2 changes: 2 additions & 0 deletions src/knx/bau2920.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class Bau2920 : public BauSystemBCoupler
bool enabled() override;
void enabled(bool value) override;

TpUartDataLinkLayer* getPrimaryDataLinkLayer();
RfDataLinkLayer* getSecondaryDataLinkLayer();
protected:
InterfaceObject* getInterfaceObject(uint8_t idx);
InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance);
Expand Down
3 changes: 3 additions & 0 deletions src/knx/bau57B0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,7 @@ void Bau57B0::loop()
#endif
}

IpDataLinkLayer* Bau57B0::getDataLinkLayer() {
return (IpDataLinkLayer*)&_dlLayer;
}
#endif
3 changes: 2 additions & 1 deletion src/knx/bau57B0.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class Bau57B0 : public BauSystemBDevice, public DataLinkLayerCallbacks
void loop() override;
bool enabled() override;
void enabled(bool value) override;


IpDataLinkLayer* getDataLinkLayer();
protected:
InterfaceObject* getInterfaceObject(uint8_t idx);
InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance);
Expand Down
8 changes: 8 additions & 0 deletions src/knx/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ void Platform::closeUart()
void Platform::setupUart()
{}

bool Platform::overflowUart()
{
return false;
}

void Platform::flushUart()
{}

uint32_t Platform::currentIpAddress()
{
return 0x01020304;
Expand Down
2 changes: 2 additions & 0 deletions src/knx/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading
Loading