mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
allows global object instances be switch off with defines (#2344)
This commit is contained in:
parent
bd01e44c76
commit
18297458be
@ -139,6 +139,8 @@ using fs::SeekEnd;
|
|||||||
using fs::FSInfo;
|
using fs::FSInfo;
|
||||||
#endif //FS_NO_GLOBALS
|
#endif //FS_NO_GLOBALS
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SPIFFS)
|
||||||
extern fs::FS SPIFFS;
|
extern fs::FS SPIFFS;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif //FS_H
|
#endif //FS_H
|
||||||
|
@ -124,11 +124,13 @@ extern "C" uint32_t _SPIFFS_block;
|
|||||||
#define SPIFFS_MAX_OPEN_FILES 5
|
#define SPIFFS_MAX_OPEN_FILES 5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SPIFFS)
|
||||||
FS SPIFFS = FS(FSImplPtr(new SPIFFSImpl(
|
FS SPIFFS = FS(FSImplPtr(new SPIFFSImpl(
|
||||||
SPIFFS_PHYS_ADDR,
|
SPIFFS_PHYS_ADDR,
|
||||||
SPIFFS_PHYS_SIZE,
|
SPIFFS_PHYS_SIZE,
|
||||||
SPIFFS_PHYS_PAGE,
|
SPIFFS_PHYS_PAGE,
|
||||||
SPIFFS_PHYS_BLOCK,
|
SPIFFS_PHYS_BLOCK,
|
||||||
SPIFFS_MAX_OPEN_FILES)));
|
SPIFFS_MAX_OPEN_FILES)));
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -334,4 +334,6 @@ int ArduinoOTAClass::getCommand() {
|
|||||||
return _cmd;
|
return _cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_ARDUINOOTA)
|
||||||
ArduinoOTAClass ArduinoOTA;
|
ArduinoOTAClass ArduinoOTA;
|
||||||
|
#endif
|
||||||
|
@ -68,6 +68,8 @@ class ArduinoOTAClass
|
|||||||
String readStringUntil(char end);
|
String readStringUntil(char end);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_ARDUINOOTA)
|
||||||
extern ArduinoOTAClass ArduinoOTA;
|
extern ArduinoOTAClass ArduinoOTA;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __ARDUINO_OTA_H */
|
#endif /* __ARDUINO_OTA_H */
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
#include "spi_flash.h"
|
#include "spi_flash.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" uint32_t _SPIFFS_end;
|
||||||
|
|
||||||
EEPROMClass::EEPROMClass(uint32_t sector)
|
EEPROMClass::EEPROMClass(uint32_t sector)
|
||||||
: _sector(sector)
|
: _sector(sector)
|
||||||
, _data(0)
|
, _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) {
|
void EEPROMClass::begin(size_t size) {
|
||||||
if (size <= 0)
|
if (size <= 0)
|
||||||
return;
|
return;
|
||||||
@ -121,5 +131,6 @@ uint8_t * EEPROMClass::getDataPtr() {
|
|||||||
return &_data[0];
|
return &_data[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" uint32_t _SPIFFS_end;
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_EEPROM)
|
||||||
EEPROMClass EEPROM((((uint32_t)&_SPIFFS_end - 0x40200000) / SPI_FLASH_SEC_SIZE));
|
EEPROMClass EEPROM;
|
||||||
|
#endif
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
class EEPROMClass {
|
class EEPROMClass {
|
||||||
public:
|
public:
|
||||||
EEPROMClass(uint32_t sector);
|
EEPROMClass(uint32_t sector);
|
||||||
|
EEPROMClass(void);
|
||||||
|
|
||||||
void begin(size_t size);
|
void begin(size_t size);
|
||||||
uint8_t read(int address);
|
uint8_t read(int address);
|
||||||
@ -64,7 +65,9 @@ protected:
|
|||||||
bool _dirty;
|
bool _dirty;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_EEPROM)
|
||||||
extern EEPROMClass EEPROM;
|
extern EEPROMClass EEPROM;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -261,5 +261,8 @@ void ESP8266NetBIOS::_s_recv(void *arg, udp_pcb *upcb, pbuf *p, struct ip_addr *
|
|||||||
reinterpret_cast<ESP8266NetBIOS*>(arg)->_recv(upcb, p, addr, port);
|
reinterpret_cast<ESP8266NetBIOS*>(arg)->_recv(upcb, p, addr, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_NETBIOS)
|
||||||
ESP8266NetBIOS NBNS;
|
ESP8266NetBIOS NBNS;
|
||||||
|
#endif
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
@ -33,6 +33,8 @@ public:
|
|||||||
void end();
|
void end();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_NETBIOS)
|
||||||
extern ESP8266NetBIOS NBNS;
|
extern ESP8266NetBIOS NBNS;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -431,4 +431,6 @@ void SSDPClass::_startTimer() {
|
|||||||
os_timer_arm(tm, interval, 1 /* repeat */);
|
os_timer_arm(tm, interval, 1 /* repeat */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SSDP)
|
||||||
SSDPClass SSDP;
|
SSDPClass SSDP;
|
||||||
|
#endif
|
||||||
|
@ -121,6 +121,8 @@ class SSDPClass{
|
|||||||
char _modelNumber[SSDP_MODEL_VERSION_SIZE];
|
char _modelNumber[SSDP_MODEL_VERSION_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SSDP)
|
||||||
extern SSDPClass SSDP;
|
extern SSDPClass SSDP;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -383,6 +383,6 @@ bool ESP8266HTTPUpdate::runUpdate(Stream& in, uint32_t size, String md5, int com
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_HTTPUPDATE)
|
||||||
|
|
||||||
ESP8266HTTPUpdate ESPhttpUpdate;
|
ESP8266HTTPUpdate ESPhttpUpdate;
|
||||||
|
#endif
|
||||||
|
@ -105,6 +105,8 @@ protected:
|
|||||||
bool _rebootOnUpdate = true;
|
bool _rebootOnUpdate = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_HTTPUPDATE)
|
||||||
extern ESP8266HTTPUpdate ESPhttpUpdate;
|
extern ESP8266HTTPUpdate ESPhttpUpdate;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* ESP8266HTTPUPDATE_H_ */
|
#endif /* ESP8266HTTPUPDATE_H_ */
|
||||||
|
@ -1046,4 +1046,6 @@ void MDNSResponder::_reply(uint8_t replyMask, char * service, char *proto, uint1
|
|||||||
_conn->send();
|
_conn->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
MDNSResponder MDNS = MDNSResponder();
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS)
|
||||||
|
MDNSResponder MDNS;
|
||||||
|
#endif
|
||||||
|
@ -131,6 +131,8 @@ private:
|
|||||||
void _restart();
|
void _restart();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS)
|
||||||
extern MDNSResponder MDNS;
|
extern MDNSResponder MDNS;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif //ESP8266MDNS_H
|
#endif //ESP8266MDNS_H
|
||||||
|
@ -139,4 +139,6 @@ IPAddress EthernetClass::dnsServerIP()
|
|||||||
return _dnsServerAddress;
|
return _dnsServerAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_ETHERNET)
|
||||||
EthernetClass Ethernet;
|
EthernetClass Ethernet;
|
||||||
|
#endif
|
||||||
|
@ -36,6 +36,8 @@ public:
|
|||||||
friend class EthernetServer;
|
friend class EthernetServer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_ETHERNET)
|
||||||
extern EthernetClass Ethernet;
|
extern EthernetClass Ethernet;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -611,4 +611,6 @@ void File::rewindDirectory(void) {
|
|||||||
_file->rewind();
|
_file->rewind();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SD)
|
||||||
SDClass SD;
|
SDClass SD;
|
||||||
|
#endif
|
||||||
|
@ -132,6 +132,8 @@ private:
|
|||||||
friend boolean callback_openPath(SdFile&, char *, boolean, void *);
|
friend boolean callback_openPath(SdFile&, char *, boolean, void *);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SD)
|
||||||
extern SDClass SD;
|
extern SDClass SD;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -33,8 +33,6 @@ typedef union {
|
|||||||
};
|
};
|
||||||
} spiClk_t;
|
} spiClk_t;
|
||||||
|
|
||||||
SPIClass SPI;
|
|
||||||
|
|
||||||
SPIClass::SPIClass() {
|
SPIClass::SPIClass() {
|
||||||
useHwCs = false;
|
useHwCs = false;
|
||||||
}
|
}
|
||||||
@ -486,3 +484,6 @@ void SPIClass::transferBytes_(uint8_t * out, uint8_t * in, uint8_t size) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SPI)
|
||||||
|
SPIClass SPI;
|
||||||
|
#endif
|
||||||
|
@ -79,6 +79,8 @@ private:
|
|||||||
inline void setDataBits(uint16_t bits);
|
inline void setDataBits(uint16_t bits);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SPI)
|
||||||
extern SPIClass SPI;
|
extern SPIClass SPI;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -100,4 +100,6 @@ void SPISlaveClass::onStatusSent(SpiSlaveSentHandler cb)
|
|||||||
_status_sent_cb = cb;
|
_status_sent_cb = cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SPISLAVE)
|
||||||
SPISlaveClass SPISlave;
|
SPISlaveClass SPISlave;
|
||||||
|
#endif
|
||||||
|
@ -64,6 +64,8 @@ public:
|
|||||||
void onStatusSent(SpiSlaveSentHandler cb);
|
void onStatusSent(SpiSlaveSentHandler cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SPISLAVE)
|
||||||
extern SPISlaveClass SPISlave;
|
extern SPISlaveClass SPISlave;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -567,7 +567,10 @@ INT8U TFT::drawFloat(float floatNumber,INT16U poX, INT16U poY,INT16U size,INT16U
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
TFT Tft=TFT();
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_TFT)
|
||||||
|
TFT Tft;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*********************************************************************************************************
|
/*********************************************************************************************************
|
||||||
END FILE
|
END FILE
|
||||||
*********************************************************************************************************/
|
*********************************************************************************************************/
|
||||||
|
@ -213,7 +213,9 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_TFT)
|
||||||
extern TFT Tft;
|
extern TFT Tft;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -251,4 +251,6 @@ void TwoWire::onRequest( void (*function)(void) ){
|
|||||||
|
|
||||||
// Preinstantiate Objects //////////////////////////////////////////////////////
|
// Preinstantiate Objects //////////////////////////////////////////////////////
|
||||||
|
|
||||||
TwoWire Wire = TwoWire();
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_TWOWIRE)
|
||||||
|
TwoWire Wire;
|
||||||
|
#endif
|
||||||
|
@ -85,7 +85,9 @@ class TwoWire : public Stream
|
|||||||
using Print::write;
|
using Print::write;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_TWOWIRE)
|
||||||
extern TwoWire Wire;
|
extern TwoWire Wire;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user