Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
System

Access to the ESP8266 system. More...

Functions

static bool SystemClass::initialize ()
 System initialisation. More...
 
bool SystemClass::isReady ()
 Check if system ready. More...
 
void SystemClass::restart (unsigned deferMillis=0)
 Request a restart of the system. More...
 
void SystemClass::setCpuFrequency (CpuFrequency freq)
 Set the CPU frequency. More...
 
CpuFrequency SystemClass::getCpuFrequency ()
 Get the CPU frequency. More...
 
bool SystemClass::deepSleep (uint32 timeMilliseconds, DeepSleepOptions options=eDSO_RF_CAL_BY_INIT_DATA)
 Enter deep sleep mode. More...
 
void SystemClass::onReady (SystemReadyDelegate readyHandler)
 Set handler for system ready event. More...
 
void SystemClass::onReady (ISystemReadyHandler *readyHandler)
 Set handler for system ready event. More...
 
static bool IRAM_ATTR SystemClass::queueCallback (TaskCallback callback, uint32_t param=0)
 Queue a deferred callback. More...
 
static unsigned SystemClass::getTaskCount ()
 Get number of tasks currently on queue. More...
 
static unsigned SystemClass::getMaxTaskCount ()
 Get maximum number of tasks seen on queue at any one time. More...
 

Detailed Description

Access to the ESP8266 system.

System class.

Note
Provides system control and monitoring of the ESP8266.

Function Documentation

bool SystemClass::deepSleep ( uint32  timeMilliseconds,
DeepSleepOptions  options = eDSO_RF_CAL_BY_INIT_DATA 
)

Enter deep sleep mode.

Parameters
timeMillisecondsQuantity of milliseconds to remain in deep sleep mode
optionsDeep sleep options
CpuFrequency SystemClass::getCpuFrequency ( )
inline

Get the CPU frequency.

Return values
CpuFrequencyThe frequency of the CPU
static unsigned SystemClass::getMaxTaskCount ( )
inlinestatic

Get maximum number of tasks seen on queue at any one time.

Return values
unsigned
Note
If return value is higher than maximum task queue TASK_QUEUE_LENGTH then the queue has overflowed at some point and tasks have been left un-executed.
static unsigned SystemClass::getTaskCount ( )
inlinestatic

Get number of tasks currently on queue.

Return values
unsigned
static bool SystemClass::initialize ( )
static

System initialisation.

Return values
booltrue on success
Note
Called by user_main: applications should not call this function or the task queue will be re-initialised and any currently queued tasks won't be called.
bool SystemClass::isReady ( )
inline

Check if system ready.

Return values
boolTrue if system initialisation is complete and system is now ready
void SystemClass::onReady ( SystemReadyDelegate  readyHandler)

Set handler for system ready event.

Parameters
readyHandlerFunction to handle event
Note
if system is ready, callback is executed immediately without deferral
void SystemClass::onReady ( ISystemReadyHandler readyHandler)

Set handler for system ready event.

Parameters
readyHandlerFunction to handle event
Note
if system is ready, callback is executed immediately without deferral
static bool IRAM_ATTR SystemClass::queueCallback ( TaskCallback  callback,
uint32_t  param = 0 
)
static

Queue a deferred callback.

Parameters
callbackThe function to be called
paramParameter passed to the callback
Return values
boolfalse if callback could not be queued
Note
It is important to check the return value to avoid memory leaks and other issues, for example if memory is allocated and relies on the callback to free it again. Note also that this method is typically called from interrupt context so must avoid things like heap allocation, etc.
void SystemClass::restart ( unsigned  deferMillis = 0)

Request a restart of the system.

Parameters
deferMillisdefer restart request by a number of milliseconds
Note
A delay is often required to allow network callback code to complete correctly. The restart is always deferred, either using the task queue (if deferMillis == 0) or using a timer. This method always returns immediately.
void SystemClass::setCpuFrequency ( CpuFrequency  freq)

Set the CPU frequency.

Parameters
freqFrequency to set CPU