Tweak for Ram usage (#129)

* Add KNX_NO_DEFAULT_UART to avoid default uart assignation for ArduinoPlatforms and derivatives, with associated defines (HWSERIAL_NONE for stm32) to recover RAM from unused RX/TX buffers
Remove ArduinoPlatform(HardwareSerial* knxSerial) constructor, seems not useable by KnxFacade

* Restore ArduinoPlatform::ArduinoPlatform(HardwareSerial* knxSerial) constructor

* revert xxxPlatform(HardwareSerial* s) constructors
This commit is contained in:
etrinh 2021-04-01 09:34:26 +02:00 committed by GitHub
parent 446ea1b9aa
commit 036bd54c79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 7 deletions

View File

@ -6,7 +6,13 @@
#include <SPI.h>
#endif
#ifndef KNX_NO_PRINT
Stream* ArduinoPlatform::SerialDebug = &Serial;
#endif
ArduinoPlatform::ArduinoPlatform() : _knxSerial(nullptr)
{
}
ArduinoPlatform::ArduinoPlatform(HardwareSerial* knxSerial) : _knxSerial(knxSerial)
{
@ -29,7 +35,8 @@ void ArduinoPlatform::fatalError()
void ArduinoPlatform::knxUart( HardwareSerial* serial )
{
closeUart();
if (_knxSerial)
closeUart();
_knxSerial = serial;
setupUart();
}

View File

@ -2,11 +2,10 @@
#include "Arduino.h"
extern Stream& _serialDBG;
class ArduinoPlatform : public Platform
{
public:
ArduinoPlatform();
ArduinoPlatform(HardwareSerial* knxSerial);
// basic stuff
@ -29,7 +28,9 @@ class ArduinoPlatform : public Platform
void closeSpi() override;
int readWriteSpi (uint8_t *data, size_t len) override;
#endif
#ifndef KNX_NO_PRINT
static Stream* SerialDebug;
#endif
protected:
HardwareSerial* _knxSerial;

View File

@ -6,7 +6,10 @@
#include "knx/bits.h"
Esp32Platform::Esp32Platform() : ArduinoPlatform(&Serial1)
Esp32Platform::Esp32Platform()
#ifndef KNX_NO_DEFAULT_UART
: ArduinoPlatform(&Serial1)
#endif
{
}

View File

@ -7,7 +7,10 @@
#include "knx/bits.h"
EspPlatform::EspPlatform() : ArduinoPlatform(&Serial)
EspPlatform::EspPlatform()
#ifndef KNX_NO_DEFAULT_UART
: ArduinoPlatform(&Serial)
#endif
{
}

View File

@ -6,7 +6,10 @@
#include <Arduino.h>
#include <FlashAsEEPROM.h>
SamdPlatform::SamdPlatform() : ArduinoPlatform(&Serial1)
SamdPlatform::SamdPlatform()
#ifndef KNX_NO_DEFAULT_UART
: ArduinoPlatform(&Serial1)
#endif
{
}

View File

@ -4,7 +4,10 @@
#include <stm32_eeprom.h>
#include "knx/bits.h"
Stm32Platform::Stm32Platform() : ArduinoPlatform(&Serial2)
Stm32Platform::Stm32Platform()
#ifndef KNX_NO_DEFAULT_UART
: ArduinoPlatform(&Serial2)
#endif
{
}