![]() |
5 years ago | |
---|---|---|
.travis | 6 years ago | |
Sming | 5 years ago | |
docker | 6 years ago | |
docs | 5 years ago | |
samples | 5 years ago | |
tools | 5 years ago | |
.gitignore | 5 years ago | |
.gitmodules | 5 years ago | |
.travis.yml | 6 years ago | |
AddingExternalSource.md | 6 years ago | |
CONTRIBUTING.md | 5 years ago | |
LICENSE | 7 years ago | |
Readme.md | 5 years ago | |
appveyor.yml | 6 years ago | |
commandHandler.md | 5 years ago |
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
OS/SDK | Linux | Mac OS X | Windows | FreeBSD-current |
---|---|---|---|---|
UDK (v1.5) | n/a | n/a | n/a | |
esp-alt-sdk (v1.4, v1.5) | :sunny: | :sunny: | :sunny: | :sunny: |
esp-open-sdk (v1.4, v1.5, v2.0) | :sunny: | :sunny: | n/a | n/a |
OS = Operating System SDK = Software Development Kit n/a = The selected SDK is not available on that OS
There are multiple custom features that can be enabled by default. For example: SSL support, custom LWIP, open PWM, custom heap allocation, more verbose debugging, etc. Click here to see the details
Makefile-user.mk
from the Basic_SmartConfig application for examples. If you would like to use the binary LWIP then you should turn off the custom LWIP compilation by providing ENABLE_CUSTOM_LWIP=0
.ENABLE_CUSTOM_PWM=1
. There is no need to recompile the Sming library.COM_SPEED_SERIAL
directive. For example COM_SPEED_SERIAL=921600
.ENABLE_CUSTOM_HEAP=1
. In order to use it in your sample/application make sure to compile the sample with ENABLE_CUSTOM_HEAP=1
. Do not enable custom heap allocation and -mforce-l32 compiler flag together.DEBUG_VERBOSE_LEVEL
you can set the desired level (0-3). For example DEBUG_VERBOSE_LEVEL=2
will show only info messages and above. Another make directive is DEBUG_PRINT_FILENAME_AND_LINE=1
which enables printing the filename and line number of every debug line. This will require extra space on flash. Note: you can compile the Sming library with a set of debug directives and your project with another settings, this way you can control debugging sepparately for sming and your application code.ENABLE_LWIPDEBUG=1
. To increase debugging for certain areas you can modify debug options in third-party/esp-open-lwip/include/lwipopts.h
.ENABLE_CMD_EXECUTOR=0
. This will save ~1KB RAM and ~3KB of flash memory.
See the getting started page for your respective operating system.
You can find more information about compilation and flashing process by reading esp8266.com forum discussion thread.
More information at Wiki Examples page.
#define LED_PIN 2 // GPIO2
...
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, HIGH);
Serial.begin(9600);
Serial.println("Hello Sming! Let's do smart things.");
WifiStation.enable(true);
WifiStation.config("LOCAL-NETWORK", "123456789087"); // Put you SSID and Password here
#include <Libraries/DHT/DHT.h> // This is just popular Arduino library!
#define WORK_PIN 0 // GPIO0
DHT dht(WORK_PIN, DHT22);
void init()
{
dht.begin();
float h = dht.readHumidity();
float t = dht.readTemperature();
}
HttpClient thingSpeak;
...
thingSpeak.downloadString("http://api.thingspeak.com/update?key=XXXXXXX&field1=" + String(sensorValue), onDataSent);
void onDataSent(HttpClient& client, bool successful)
{
if (successful)
Serial.println("Successful!");
else
Serial.println("Failed");
}
void OtaUpdate() {
uint8 slot;
rboot_config bootconf;
Serial.println("Updating...");
// need a clean object, otherwise if run before and failed will not run again
if (otaUpdater) delete otaUpdater;
otaUpdater = new rBootHttpUpdate();
// select rom slot to flash
bootconf = rboot_get_config();
slot = bootconf.current_rom;
if (slot == 0) slot = 1; else slot = 0;
// flash rom to position indicated in the rBoot config rom table
otaUpdater->addItem(bootconf.roms[slot], ROM_0_URL);
// and/or set a callback (called on failure or success without switching requested)
otaUpdater->setCallback(OtaUpdate_CallBack);
// start update
otaUpdater->start();
}
server.listen(80);
server.addPath("/", onIndex);
server.addPath("/hello", onHello);
server.setDefaultHandler(onFile);
Serial.println("=== WEB SERVER STARTED ===");
Serial.println(WifiStation.getIP());
...
void onIndex(HttpRequest &request, HttpResponse &response)
{
TemplateFileStream *tmpl = new TemplateFileStream("index.html");
auto &vars = tmpl->variables();
vars["counter"] = String(counter);
vars["IP"] = WifiStation.getIP().toString();
vars["MAC"] = WifiStation.getMAC();
response.sendTemplate(tmpl);
}
void onFile(HttpRequest &request, HttpResponse &response)
{
String file = request.getPath();
if (file[0] == '/')
file = file.substring(1);
response.setCache(86400, true);
response.sendFile(file);
}
A complete documentation can be created by running the command below. This requires doxygen
to be installed on your system.
cd $SMING_HOME
make docs
The newly generated documentation will be located under Sming/docs/api