mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
Fix stm32 eeprom handling (#205)
* Update stm32_platform.cpp Addresses a side effect of https://github.com/thelsing/knx/pull/177, which causes the eeprom buffer to be overwritten every time getEepromBuffer is called. This prevented programming of STM32 boards as their initial bus address was lost before programming. * Code style fix
This commit is contained in:
parent
eb963583ee
commit
3948045c28
@ -31,17 +31,22 @@ void Stm32Platform::restart()
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t * Stm32Platform::getEepromBuffer(uint16_t size)
|
uint8_t * Stm32Platform::getEepromBuffer(uint16_t size)
|
||||||
|
{
|
||||||
|
// check if the buffer already exists
|
||||||
|
if (_eepromPtr == nullptr) // we need to initialize the buffer first
|
||||||
{
|
{
|
||||||
if (size > E2END + 1)
|
if (size > E2END + 1)
|
||||||
{
|
{
|
||||||
fatalError();
|
fatalError();
|
||||||
}
|
}
|
||||||
|
|
||||||
_eepromSize = size;
|
_eepromSize = size;
|
||||||
delete [] _eepromPtr;
|
|
||||||
_eepromPtr = new uint8_t[size];
|
_eepromPtr = new uint8_t[size];
|
||||||
eeprom_buffer_fill();
|
eeprom_buffer_fill();
|
||||||
for (uint16_t i = 0; i < size; ++i)
|
for (uint16_t i = 0; i < size; ++i)
|
||||||
_eepromPtr[i] = eeprom_buffered_read_byte(i);
|
_eepromPtr[i] = eeprom_buffered_read_byte(i);
|
||||||
|
}
|
||||||
|
|
||||||
return _eepromPtr;
|
return _eepromPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user