Skip to content

Commit 3e0735a

Browse files
committed
Use page size for EEPROM size.
Former-commit-id: db37e22
1 parent c83ae88 commit 3e0735a

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

cores/nRF5/BLEBond_nvs/BLEBond_nvs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class bondStoreCBs : public FCStoreCallbacks {
4343
};
4444

4545
static bondStoreCBs _callbacks;
46-
static FCStore bondStore(&_callbacks , 1024);
46+
static FCStore bondStore(&_callbacks , flash_get_page_size());
4747

4848
int ble_bond_nvs_save_entry(uint32_t id, char *value) {
4949
if (!bondStore.write(id, (uint8_t*)value, strlen(value) + 1)) {

libraries/EEPROM/src/EEPROM.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,12 @@
2727
#include <FC_Store.h>
2828
#include <type_traits>
2929

30-
#ifndef EEPROM_SIZE_BYTES
31-
#define EEPROM_SIZE_BYTES 4096
32-
#endif
33-
3430
class EEPROMStoreCBs : public FCStoreCallbacks {
3531
uint32_t getPageSize() {
3632
return flash_get_page_size();
3733
}
3834
uint32_t getStoreBeginPage() {
39-
return flash_get_store_page(EEPROM_SIZE_BYTES * 2);
35+
return flash_get_store_page(flash_get_page_size() * 2);
4036
}
4137
void flashWriteWord(uint32_t address, uint32_t value) {
4238
flash_write_word(address, value);
@@ -54,7 +50,7 @@ class EEPROMClass {
5450
FCStore _store;
5551

5652
public:
57-
EEPROMClass(): _store(&_eepCBs, EEPROM_SIZE_BYTES){}
53+
EEPROMClass(): _store(&_eepCBs, flash_get_page_size()){}
5854

5955
void begin() { _store.begin();}
6056

0 commit comments

Comments
 (0)