knx/src/samd_platform.cpp
Fabian Schmieder 8d5dc5bf73 setter/getter & overloaded constructor (ArduinoPlatform) for HardwareSerial-object (#31)
* added overload to platform constructors for custom HardwareSerial-object

* added setter/getter setUart & getUart

* set Serial1 as default UART for ESP32
2019-09-01 20:49:28 +02:00

39 lines
641 B
C++

#include "samd_platform.h"
#ifdef ARDUINO_ARCH_SAMD
#include <knx/bits.h>
#include <Arduino.h>
#include <FlashAsEEPROM.h>
SamdPlatform::SamdPlatform() : ArduinoPlatform(Serial1)
{
}
SamdPlatform::SamdPlatform( HardwareSerial& s) : ArduinoPlatform(s)
{
}
void SamdPlatform::restart()
{
SerialDBG.println("restart");
NVIC_SystemReset();
}
uint8_t * SamdPlatform::getEepromBuffer(uint16_t size)
{
//EEPROM.begin(size);
if(size > EEPROM_EMULATION_SIZE)
fatalError();
return EEPROM.getDataPtr();
}
void SamdPlatform::commitToEeprom()
{
EEPROM.commit();
}
#endif