mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
add EEPROM.getDataPtr()
fix all warnings in EEPROMClass
This commit is contained in:
parent
3406b47949
commit
48ddce71c6
@ -35,7 +35,7 @@
|
|||||||
#define CONFIG_ADDR (SPI_FLASH_SEC_SIZE * CONFIG_SECTOR)
|
#define CONFIG_ADDR (SPI_FLASH_SEC_SIZE * CONFIG_SECTOR)
|
||||||
|
|
||||||
EEPROMClass::EEPROMClass()
|
EEPROMClass::EEPROMClass()
|
||||||
: _data(0), _size(0)
|
: _data(0), _size(0), _dirty(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ void EEPROMClass::end()
|
|||||||
|
|
||||||
uint8_t EEPROMClass::read(int address)
|
uint8_t EEPROMClass::read(int address)
|
||||||
{
|
{
|
||||||
if (address < 0 || address >= _size)
|
if (address < 0 || (size_t)address >= _size)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return _data[address];
|
return _data[address];
|
||||||
@ -75,7 +75,7 @@ uint8_t EEPROMClass::read(int address)
|
|||||||
|
|
||||||
void EEPROMClass::write(int address, uint8_t value)
|
void EEPROMClass::write(int address, uint8_t value)
|
||||||
{
|
{
|
||||||
if (address < 0 || address >= _size)
|
if (address < 0 || (size_t)address >= _size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_data[address] = value;
|
_data[address] = value;
|
||||||
@ -101,5 +101,10 @@ bool EEPROMClass::commit()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t * EEPROMClass::getDataPtr()
|
||||||
|
{
|
||||||
|
return &_data[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EEPROMClass EEPROM;
|
EEPROMClass EEPROM;
|
||||||
|
@ -36,6 +36,8 @@ class EEPROMClass
|
|||||||
bool commit();
|
bool commit();
|
||||||
void end();
|
void end();
|
||||||
|
|
||||||
|
uint8_t * getDataPtr();
|
||||||
|
|
||||||
template<typename T> T &get(int address, T &t)
|
template<typename T> T &get(int address, T &t)
|
||||||
{
|
{
|
||||||
if (address < 0 || address + sizeof(T) > _size)
|
if (address < 0 || address + sizeof(T) > _size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user