Skip to content

Commit 6644f34

Browse files
committed
upd
1 parent bea6be9 commit 6644f34

File tree

5 files changed

+37
-1
lines changed

5 files changed

+37
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ void loop() {
138138
## Версии
139139
- v1.0
140140
- v1.1 - изменены коды возврата begin
141+
- v1.2 - добавлена nextAddr()
141142
142143
<a id="feedback"></a>
143144
## Баги и обратная связь

examples/manyBlocks/manyBlocks.ino

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// блок 1 - структура
2+
struct DataBlock {
3+
int valI;
4+
byte valB;
5+
};
6+
DataBlock data;
7+
8+
// блок 2 - массив
9+
int arr[10];
10+
11+
#include <EEManager.h>
12+
EEManager mem1(data);
13+
EEManager mem2(arr);
14+
15+
void setup() {
16+
Serial.begin(9600);
17+
// для esp8266 не забудь вызвать EEPROM.begin(размер)!
18+
19+
// первый блок храним с адреса 0
20+
mem1.begin(0, 'a');
21+
22+
// второй - следом за ним
23+
mem2.begin(mem1.nextAddr(), 'a');
24+
}
25+
26+
void loop() {
27+
28+
}

keywords.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dataSize KEYWORD2
2121
blockSize KEYWORD2
2222
startAddr KEYWORD2
2323
endAddr KEYWORD2
24+
nextAddr KEYWORD2
2425

2526

2627
#######################################

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=EEManager
2-
version=1.1
2+
version=1.2
33
author=AlexGyver <alex@alexgyver.ru>
44
maintainer=AlexGyver <alex@alexgyver.ru>
55
sentence=Simple library for reducing EEPROM wear

src/EEManager.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
Версии:
1515
v1.0 - релиз
1616
v1.1 - изменены коды возврата begin
17+
v1.2 - добавлена nextAddr()
1718
*/
1819

1920
#ifndef _EEManager_h
@@ -100,6 +101,11 @@ class EEManager {
100101
uint16_t endAddr() {
101102
return _addr + _size;
102103
}
104+
105+
// получить первый свободный адрес для следующего блока
106+
uint16_t nextAddr() {
107+
return _addr + _size + 1;
108+
}
103109

104110
private:
105111
uint8_t* _data;

0 commit comments

Comments
 (0)