mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
serveral small things
This commit is contained in:
parent
f50f03ad6e
commit
fd2334a4af
@ -92,6 +92,11 @@ void BauSystemB::readMemory()
|
||||
_memory.readMemory();
|
||||
}
|
||||
|
||||
void BauSystemB::writeMemory()
|
||||
{
|
||||
_memory.writeMemory();
|
||||
}
|
||||
|
||||
DeviceObject& BauSystemB::deviceObject()
|
||||
{
|
||||
return _deviceObj;
|
||||
|
@ -25,6 +25,7 @@ public:
|
||||
bool enabled();
|
||||
void enabled(bool value);
|
||||
void readMemory();
|
||||
void writeMemory();
|
||||
void addSaveRestore(SaveRestore* obj);
|
||||
protected:
|
||||
virtual DataLinkLayer& dataLinkLayer() = 0;
|
||||
|
11
bits.cpp
11
bits.cpp
@ -252,14 +252,3 @@ void println(void)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void printHex(const char* suffix, const uint8_t *data, size_t length)
|
||||
{
|
||||
_print(suffix);
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
if (data[i] < 0x10) { _print("0"); }
|
||||
_print(data[i], HEX);
|
||||
_print(" ");
|
||||
}
|
||||
_print("\n");
|
||||
}
|
@ -142,7 +142,7 @@ void GroupObject::commFlag(ComFlag value)
|
||||
_commFlag = value;
|
||||
}
|
||||
|
||||
int32_t GroupObject::objectReadFloat()
|
||||
int32_t GroupObject::objectReadFloatDpt9()
|
||||
{
|
||||
uint16_t dptValue = getWord(_data);
|
||||
return dptFromFloat(dptValue);
|
||||
@ -164,7 +164,7 @@ void GroupObject::objectWritten()
|
||||
}
|
||||
|
||||
|
||||
void GroupObject::objectWriteFloat(int32_t value)
|
||||
void GroupObject::objectWriteFloatDpt9(int32_t value)
|
||||
{
|
||||
uint16_t dptValue = dptToFloat(value);
|
||||
pushWord(dptValue, _data);
|
||||
@ -172,7 +172,7 @@ void GroupObject::objectWriteFloat(int32_t value)
|
||||
}
|
||||
|
||||
|
||||
void GroupObject::objectUpdateFloat(int32_t value)
|
||||
void GroupObject::objectUpdateFloatDpt9(int32_t value)
|
||||
{
|
||||
uint16_t dptValue = dptToFloat(value);
|
||||
pushWord(dptValue, _data);
|
||||
@ -189,3 +189,55 @@ size_t GroupObject::sizeInTelegram()
|
||||
uint8_t code = lowByte(ntohs(_table->_tableData[_asap]));
|
||||
return asapValueSize(code);
|
||||
}
|
||||
|
||||
|
||||
void GroupObject::objectWrite(bool value)
|
||||
{
|
||||
objectWrite((uint8_t)value);
|
||||
}
|
||||
|
||||
|
||||
void GroupObject::objectWrite(uint8_t value)
|
||||
{
|
||||
pushByte(value, _data);
|
||||
objectWritten();
|
||||
}
|
||||
|
||||
|
||||
void GroupObject::objectWrite(uint16_t value)
|
||||
{
|
||||
pushWord(value, _data);
|
||||
objectWritten();
|
||||
}
|
||||
|
||||
|
||||
void GroupObject::objectWrite(uint32_t value)
|
||||
{
|
||||
pushInt(value, _data);
|
||||
objectWritten();
|
||||
}
|
||||
|
||||
|
||||
void GroupObject::objectWrite(int8_t value)
|
||||
{
|
||||
objectWrite((uint8_t)value);
|
||||
}
|
||||
|
||||
|
||||
void GroupObject::objectWrite(int16_t value)
|
||||
{
|
||||
objectWrite((uint16_t)value);
|
||||
}
|
||||
|
||||
|
||||
void GroupObject::objectWrite(int32_t value)
|
||||
{
|
||||
objectWrite((uint32_t)value);
|
||||
}
|
||||
|
||||
|
||||
void GroupObject::objectWrite(float value)
|
||||
{
|
||||
uint32_t tmp = value * 100;
|
||||
objectWriteFloatDpt9(tmp);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
* @return The value of the com-object in 1/100. INVALID_DPT_FLOAT is returned
|
||||
* for the DPT9 "invalid data" value.
|
||||
*/
|
||||
int32_t objectReadFloat();
|
||||
int32_t objectReadFloatDpt9();
|
||||
bool objectReadBool();
|
||||
/**
|
||||
* Request the read of a communication object. Calling this function triggers the
|
||||
@ -79,7 +79,15 @@ public:
|
||||
* @param value - the new value of the communication object in 1/100.
|
||||
* Use INVALID_DPT_FLOAT for the DPT9 "invalid data" value.
|
||||
*/
|
||||
void objectWriteFloat(int32_t value);
|
||||
void objectWriteFloatDpt9(int32_t value);
|
||||
void objectWrite(bool value);
|
||||
void objectWrite(uint8_t value);
|
||||
void objectWrite(uint16_t value);
|
||||
void objectWrite(uint32_t value);
|
||||
void objectWrite(int8_t value);
|
||||
void objectWrite(int16_t value);
|
||||
void objectWrite(int32_t value);
|
||||
void objectWrite(float value);
|
||||
|
||||
/**
|
||||
* Set the value of a communication object and mark the communication object
|
||||
@ -93,7 +101,7 @@ public:
|
||||
* @param value - the new value of the communication object in 1/100.
|
||||
* Use INVALID_DPT_FLOAT for the DPT9 "invalid data" value.
|
||||
*/
|
||||
void objectUpdateFloat(int32_t value);
|
||||
void objectUpdateFloatDpt9(int32_t value);
|
||||
|
||||
size_t valueSize();
|
||||
size_t asapValueSize(uint8_t code);
|
||||
|
@ -72,6 +72,8 @@ void IpDataLinkLayer::loop()
|
||||
|
||||
void IpDataLinkLayer::enabled(bool value)
|
||||
{
|
||||
_print("own address: ");
|
||||
_println(_deviceObject.induvidualAddress());
|
||||
if (value && !_enabled)
|
||||
{
|
||||
_platform.setupMultiCast(_ipParameters.multicastAddress(), KNXIP_MULTICAST_PORT);
|
||||
|
@ -18,7 +18,7 @@ void Memory::readMemory()
|
||||
{
|
||||
_data = _platform.getEepromBuffer(512);
|
||||
|
||||
if (_data[0] != 0xDE || _data[1] != 0xAD || _data[2] != 0xAF || _data[3] != 0xFE)
|
||||
if (_data[0] != 0x00 || _data[1] != 0xAD || _data[2] != 0xAF || _data[3] != 0xFE)
|
||||
return;
|
||||
|
||||
uint8_t* buffer = _data + 4;
|
||||
@ -31,7 +31,7 @@ void Memory::readMemory()
|
||||
|
||||
void Memory::writeMemory()
|
||||
{
|
||||
_data[0] = 0xDE;
|
||||
_data[0] = 0x00;
|
||||
_data[1] = 0xAD;
|
||||
_data[2] = 0xAF;
|
||||
_data[3] = 0xFE;
|
||||
|
@ -123,6 +123,9 @@ bool TableObject::allocTable(uint32_t size, bool doFill, uint8_t fillByte)
|
||||
_size = 0;
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
return true;
|
||||
|
||||
_data = (uint8_t*)malloc(size);
|
||||
if (!_data)
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user