mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
try an other way to create the memory reference point
This commit is contained in:
parent
197203b88e
commit
1321d62e40
@ -1 +1 @@
|
||||
0.1.5
|
||||
0.1.6
|
||||
|
@ -11,8 +11,8 @@ uint8_t* Platform::memoryReference()
|
||||
uint8_t* Platform::allocMemory(size_t size)
|
||||
{
|
||||
uint8_t* address = (uint8_t*)malloc(size);
|
||||
if (_memoryReference == 0)
|
||||
_memoryReference = address;
|
||||
// if (_memoryReference == 0 || address < _memoryReference)
|
||||
// _memoryReference = address;
|
||||
|
||||
return address;
|
||||
}
|
||||
@ -21,3 +21,11 @@ void Platform::freeMemory(uint8_t* ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
|
||||
Platform::Platform()
|
||||
{
|
||||
// allocate memory to have a memory reference
|
||||
_memoryReference = (uint8_t*)malloc(1);
|
||||
free(_memoryReference);
|
||||
}
|
||||
|
@ -6,7 +6,8 @@
|
||||
|
||||
class Platform
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Platform();
|
||||
virtual uint32_t currentIpAddress() = 0;
|
||||
virtual uint32_t currentSubnetMask() = 0;
|
||||
virtual uint32_t currentDefaultGateway() = 0;
|
||||
@ -26,9 +27,9 @@ public:
|
||||
virtual void closeUart() = 0;
|
||||
virtual int uartAvailable() = 0;
|
||||
virtual size_t writeUart(const uint8_t data) = 0;
|
||||
virtual size_t writeUart(const uint8_t *buffer, size_t size) = 0;
|
||||
virtual size_t writeUart(const uint8_t* buffer, size_t size) = 0;
|
||||
virtual int readUart() = 0;
|
||||
virtual size_t readBytesUart(uint8_t *buffer, size_t length) = 0;
|
||||
virtual size_t readBytesUart(uint8_t* buffer, size_t length) = 0;
|
||||
|
||||
virtual uint8_t* getEepromBuffer(uint16_t size) = 0;
|
||||
virtual void commitToEeprom() = 0;
|
||||
@ -36,6 +37,7 @@ public:
|
||||
virtual uint8_t* memoryReference();
|
||||
virtual uint8_t* allocMemory(size_t size);
|
||||
virtual void freeMemory(uint8_t* ptr);
|
||||
protected:
|
||||
|
||||
protected:
|
||||
uint8_t* _memoryReference = 0;
|
||||
};
|
Loading…
Reference in New Issue
Block a user