Skip to content

Commit 4c53c81

Browse files
committed
Merge remote-tracking branch 'remotes/esp8266/esp8266' into esp8266
2 parents c3797eb + ec4f53e commit 4c53c81

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

hardware/esp8266com/esp8266/libraries/EEPROM/EEPROM.h

+22
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include <stddef.h>
2626
#include <stdint.h>
27+
#include <string.h>
2728

2829
class EEPROMClass
2930
{
@@ -35,6 +36,27 @@ class EEPROMClass
3536
void commit();
3637
void end();
3738

39+
template<typename T> T &get(int address, T &t)
40+
{
41+
if (address < 0 || address + sizeof(T) > _size)
42+
return t;
43+
44+
uint8_t *ptr = (uint8_t*) &t;
45+
memcpy(ptr, _data + address, sizeof(T));
46+
return t;
47+
}
48+
49+
template<typename T> const T &put(int address, const T &t)
50+
{
51+
if (address < 0 || address + sizeof(T) > _size)
52+
return t;
53+
54+
const uint8_t *ptr = (const uint8_t*) &t;
55+
memcpy(_data + address, ptr, sizeof(T));
56+
_dirty = true;
57+
return t;
58+
}
59+
3860
protected:
3961
uint8_t* _data;
4062
size_t _size;

hardware/esp8266com/esp8266/platform.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,5 @@ tools.esptool.path={runtime.ide.path}/hardware/tools/esp8266
9191
tools.esptool.upload.protocol=esp
9292
tools.esptool.upload.params.verbose=-vv
9393
tools.esptool.upload.params.quiet=
94-
tools.esptool.upload.pattern="{path}/{cmd}" {upload.verbose} -cd {upload.resetmethod} -cb {upload.speed} -cp {serial.port} -ca 0x00000 -cf "{build.path}/{build.project_name}_00000.bin" -ca 0x40000 -cf "{build.path}/{build.project_name}_40000.bin"
94+
tools.esptool.upload.pattern="{path}/{cmd}" {upload.verbose} -cd {upload.resetmethod} -cb {upload.speed} -cp "{serial.port}" -ca 0x00000 -cf "{build.path}/{build.project_name}_00000.bin" -ca 0x40000 -cf "{build.path}/{build.project_name}_40000.bin"
9595

0 commit comments

Comments
 (0)