1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Merge remote-tracking branch 'remotes/esp8266/esp8266' into esp8266

This commit is contained in:
Markus Sattler 2015-04-19 09:52:08 +02:00
commit eeae4ffd4e
2 changed files with 23 additions and 1 deletions

View File

@ -24,6 +24,7 @@
#include <stddef.h>
#include <stdint.h>
#include <string.h>
class EEPROMClass
{
@ -35,6 +36,27 @@ class EEPROMClass
void commit();
void end();
template<typename T> T &get(int address, T &t)
{
if (address < 0 || address + sizeof(T) > _size)
return t;
uint8_t *ptr = (uint8_t*) &t;
memcpy(ptr, _data + address, sizeof(T));
return t;
}
template<typename T> const T &put(int address, const T &t)
{
if (address < 0 || address + sizeof(T) > _size)
return t;
const uint8_t *ptr = (const uint8_t*) &t;
memcpy(_data + address, ptr, sizeof(T));
_dirty = true;
return t;
}
protected:
uint8_t* _data;
size_t _size;

View File

@ -91,5 +91,5 @@ tools.esptool.path={runtime.ide.path}/hardware/tools/esp8266
tools.esptool.upload.protocol=esp
tools.esptool.upload.params.verbose=-vv
tools.esptool.upload.params.quiet=
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"
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"