1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

allows global object instances be switch off with defines (#2344)

This commit is contained in:
Clemens Kirchgatterer
2016-08-01 05:21:50 +02:00
committed by Ivan Grokhotkov
parent bd01e44c76
commit 18297458be
26 changed files with 72 additions and 11 deletions

View File

@ -22,7 +22,7 @@
#include "Arduino.h"
#include "EEPROM.h"
extern "C" {
extern "C" {
#include "c_types.h"
#include "ets_sys.h"
#include "os_type.h"
@ -30,6 +30,8 @@
#include "spi_flash.h"
}
extern "C" uint32_t _SPIFFS_end;
EEPROMClass::EEPROMClass(uint32_t sector)
: _sector(sector)
, _data(0)
@ -38,6 +40,14 @@ EEPROMClass::EEPROMClass(uint32_t sector)
{
}
EEPROMClass::EEPROMClass(void)
: _sector((((uint32_t)&_SPIFFS_end - 0x40200000) / SPI_FLASH_SEC_SIZE))
, _data(0)
, _size(0)
, _dirty(false)
{
}
void EEPROMClass::begin(size_t size) {
if (size <= 0)
return;
@ -121,5 +131,6 @@ uint8_t * EEPROMClass::getDataPtr() {
return &_data[0];
}
extern "C" uint32_t _SPIFFS_end;
EEPROMClass EEPROM((((uint32_t)&_SPIFFS_end - 0x40200000) / SPI_FLASH_SEC_SIZE));
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_EEPROM)
EEPROMClass EEPROM;
#endif