Fix int32 -> KNXValue conversion (#128)

Add KNX_NO_SPI to reduce footprint
This commit is contained in:
etrinh 2021-03-11 20:31:09 +01:00 committed by GitHub
parent 44075d80f7
commit 446ea1b9aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -2,7 +2,9 @@
#include "knx/bits.h"
#include <Arduino.h>
#ifndef KNX_NO_SPI
#include <SPI.h>
#endif
Stream* ArduinoPlatform::SerialDebug = &Serial;
@ -94,6 +96,7 @@ size_t ArduinoPlatform::readBytesUart(uint8_t *buffer, size_t length)
return length;
}
#ifndef KNX_NO_SPI
void ArduinoPlatform::setupSpi()
{
SPI.begin();
@ -111,6 +114,7 @@ int ArduinoPlatform::readWriteSpi(uint8_t *data, size_t len)
SPI.transfer(data, len);
return 0;
}
#endif
#ifndef KNX_NO_PRINT
void printUint64(uint64_t value, int base = DEC)

View File

@ -24,10 +24,11 @@ class ArduinoPlatform : public Platform
virtual size_t readBytesUart(uint8_t* buffer, size_t length);
//spi
#ifndef KNX_NO_SPI
void setupSpi() override;
void closeSpi() override;
int readWriteSpi (uint8_t *data, size_t len) override;
#endif
static Stream* SerialDebug;
protected:

View File

@ -187,7 +187,7 @@ KNXValue& KNXValue::operator=(const int16_t value)
KNXValue& KNXValue::operator=(const int32_t value)
{
_value.boolValue = value;
_value.intValue = value;
_type = IntType;
return *this;
}