mirror of
https://github.com/thelsing/knx.git
synced 2025-07-30 13:46:26 +02:00
GD32 flash workaround
Addressing #181 At least some GD32 devices seem to require unlocking the flash twice. As the unlock function exits with `HAL_OK` if the flash is already unlocked, STM32 devices can run the same code without issues.
This commit is contained in:
parent
b718295423
commit
c6cd49d913
@ -60,6 +60,11 @@ void Stm32Platform::commitToEeprom()
|
||||
return;
|
||||
for (uint16_t i = 0; i < _eepromSize; ++i)
|
||||
eeprom_buffered_write_byte(i, _eepromPtr[i]);
|
||||
// For some GD32 chips, the flash needs to be unlocked twice
|
||||
// and the first call will fail. If the first call is
|
||||
// successful, the second one (inside eeprom_buffer_flush)
|
||||
// does nothing.
|
||||
HAL_FLASH_Unlock();
|
||||
eeprom_buffer_flush();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user