Skip to content

Commit 34b0635

Browse files
WhiskyDeltavirtual-maker
authored andcommitted
Fix EEPROM problems
1 parent d2f41f3 commit 34b0635

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

hal/architecture/STM32/MyHwSTM32.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,32 @@ void hwReadConfigBlock(void *buf, void *addr, size_t length)
4949
{
5050
uint8_t *dst = static_cast<uint8_t *>(buf);
5151
int offs = reinterpret_cast<int>(addr);
52+
#if !defined(DATA_EEPROM_BASE)
5253
eeprom_buffer_fill();
5354
while (length-- > 0) {
5455
*dst++ = eeprom_buffered_read_byte(offs++);
5556
}
57+
#else
58+
while (length-- > 0) {
59+
*dst++ = eeprom_read_byte(offs++);
60+
}
61+
#endif
5662
}
5763

5864
void hwWriteConfigBlock(void *buf, void *addr, size_t length)
5965
{
6066
uint8_t *src = static_cast<uint8_t *>(buf);
6167
int offs = reinterpret_cast<int>(addr);
68+
#if !defined(DATA_EEPROM_BASE)
6269
while (length-- > 0) {
6370
eeprom_buffered_write_byte(offs++, *src++);
6471
}
6572
eeprom_buffer_flush();
73+
#else
74+
while (length-- > 0) {
75+
eeprom_write_byte(offs++, *src++);
76+
}
77+
#endif
6678
}
6779

6880
uint8_t hwReadConfig(const int addr)

hal/architecture/STM32/MyHwSTM32.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <IWatchdog.h>
2424
#include <itoa.h>
2525
#include <SPI.h>
26+
#include <EEPROM.h>
2627

2728
#ifdef __cplusplus
2829
#include <Arduino.h>

0 commit comments

Comments
 (0)