Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New documentation system #1766

Merged
merged 41 commits into from
Jul 22, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d60061e
Revise document build system
mikee47 Jul 17, 2019
538e1d6
Update main makefiles
mikee47 Jul 17, 2019
969131a
Add docs to travis build
mikee47 Jul 16, 2019
ce111e1
Import images, convert existing text (including Wiki) to reStructured…
mikee47 Jul 8, 2019
79e08f0
Home: Edit contents readme into index.rst
mikee47 Jul 15, 2019
b7ef281
Emulator: update with note on Windows requirements
mikee47 Jul 15, 2019
2fcdd38
Add `Information` section, pull in debug images
mikee47 Jul 15, 2019
dc716a6
Add upgrade notes
mikee47 Jul 16, 2019
bd1ed92
Add `experimental` section
mikee47 Jul 15, 2019
13734d5
Add `tools` section
mikee47 Jul 16, 2019
2f767fd
Add `troubleshooting` section
mikee47 Jul 15, 2019
207f75d
Add `contribute` section, include new page on documentation system
mikee47 Jul 15, 2019
1f51b62
Edit coding style guide
mikee47 Jul 16, 2019
de3d9e4
Add `Quick Start` section, update guides
mikee47 Jul 17, 2019
7244df1
Add `api` section (to be completed), update Doxygen config
mikee47 Jul 15, 2019
d5ef8e5
Fix most doxygen warnings in code comments
mikee47 Jul 16, 2019
c36c2ee
Components: Move content from `features` into README files
mikee47 Jul 15, 2019
d6b5bff
Components: Add README files
mikee47 Jul 15, 2019
5edb1f7
Libraries: Pull in README files and fix titles
mikee47 Jul 17, 2019
1edab00
Libraries: Track down missing README files
mikee47 Jul 14, 2019
3c9a319
Samples: Move images into sample directories
mikee47 Jul 15, 2019
2aba79c
Samples: About to convert .md into .rst
mikee47 Jul 11, 2019
3560875
Samples: .md -> .rst
mikee47 Jul 15, 2019
8e8d032
Samples: Update README.rst files
mikee47 Jul 15, 2019
4b34797
Samples: Add 'todo' readme files for remaining samples
mikee47 Jul 11, 2019
3ad7d64
Reorganization of the content. The goal is to be able to learn about …
slav-at-attachix Jul 18, 2019
01ac58d
Minor changes to the content.
slav-at-attachix Jul 19, 2019
dec2a2a
Revise `HttpClient` sample readme to reflect new build system.
mikee47 Jul 18, 2019
8c13954
Minor doc fixes
mikee47 Jul 18, 2019
8e9e442
Add logo
mikee47 Jul 19, 2019
9a6c809
Generate index file containing reference information
mikee47 Jul 19, 2019
5a5412b
Move `Yeelight` into `Libraries`
mikee47 Jul 20, 2019
033a42d
Update environment variable lists
mikee47 Jul 20, 2019
5e3b300
Add section on device configuration to Esp8266 getting-started page
mikee47 Jul 20, 2019
8789bc6
Update macos start
mikee47 Jul 20, 2019
7405a26
Move samples and libraries index into root source directory
mikee47 Jul 20, 2019
fd17b28
Update `Basic_Ssl`, `Echo_Ssl` and `HttpClient` sample readme.
mikee47 Jul 20, 2019
7889fe6
Removed unnecessary level and stale text.
slav-at-attachix Jul 20, 2019
6fe9e6a
Add 'about' page with license info.
mikee47 Jul 21, 2019
db311d6
Add doc comments to `Print` class
mikee47 Jul 21, 2019
a06d6ec
Replace `api` section with generated doxygen HTML, including graphs
mikee47 Jul 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Quick Start section, update guides
  • Loading branch information
mikee47 committed Jul 21, 2019
commit de3d9e4cb66c697cd2aae5e6baa23ac86a5da3c1
290 changes: 4 additions & 286 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,298 +45,17 @@ Summary
Experimental support for SDK version >= 3.0.0.


Compilation and flashing
------------------------
Getting Started
---------------

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. Official ESP8266
documentation can be found in the `Espressif
website <https://espressif.com/en/support/download/documents?keys=&field_type_tid%5B%5D=14>`__.

Examples
--------

Once you are ready with the “Getting started” guide you can get the
latest source code.

::

git clone https://github.com/SmingHub/Sming.git

And check some of the examples.

- `Basic Blink <#basic-blink>`__
- `Simple GPIO input/output <#simple-gpio-inputoutput>`__
- `Start Serial communication <#start-serial-communication>`__
- `Connect to WiFi <#connect-to-wifi>`__
- `Read DHT22 sensor <#read-dht22-sensor>`__
- `HTTP client <#http-client>`__
- `OTA application update based on rBoot <#ota-application-update-based-on-rboot>`__
- `Embedded HTTP Web Server <#embedded-http-web-server>`__
- `Sending emails <#sending-emails>`__

Basic Blink
~~~~~~~~~~~

Blinking is something like the “Hello World” example for the embedded
world. You can check it using the commands below:

.. code-block:: bash

cd Sming/samples
cd Basic_Blink
make # -- compiles the application
make flash # -- tries to upload the application to your ESP8266 device.

See :sample:`Basic_Blink` for more information.

Simple GPIO input/output
~~~~~~~~~~~~~~~~~~~~~~~~

::

#define LED_PIN 2 // GPIO2
...
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, HIGH);

For a complete example take a look at the :sample:`Basic_Blink` sample.

Start Serial communication
~~~~~~~~~~~~~~~~~~~~~~~~~~

::

Serial.begin(9600);
Serial.println("Hello Sming! Let's do smart things.");

Connect to WiFi
~~~~~~~~~~~~~~~

::

WifiStation.enable(true);
WifiStation.config("LOCAL-NETWORK", "123456789087"); // Put you SSID and Password here

Read DHT22 sensor
~~~~~~~~~~~~~~~~~

::

#include <Libraries/DHTesp/DHTesp.h> // This is just a popular Arduino library!

#define DHT_PIN 0 // GPIO0
DHTesp dht;

void init()
{
dht.setup(DHT_PIN, DHTesp::DHT22);

float h = dht.getHumidity();
float t = dht.getTemperature();
}

Take a look at the code of the :sample:`Humidity_DHT22` sample.

HTTP client
~~~~~~~~~~~

::

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");
}
}

For more examples take a look at the
:sample:`HttpClient`,
:sample:`HttpClient_Instapush`
and :sample:`HttpClient_ThingSpeak` samples.

OTA application update based on rBoot
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

::

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();
}

For a complete example take a look at the :sample:`Basic_rBoot` sample.

Embedded HTTP Web Server
~~~~~~~~~~~~~~~~~~~~~~~~

::

server.listen(80);
server.paths.set("/", onIndex);
server.paths.set("/hello", onHello);
server.paths.setDefault(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);
}

For more examples take a look at the
:sample:`HttpServer_ConfigNetwork`,
:sample:`HttpServer_Bootstrap`,
:sample:`HttpServer_WebSockets`
and :sample:`HttpServer_AJAX`
samples.

Sending emails
~~~~~~~~~~~~~~

::

SmtpClient emailClient;

emailClient.connect(Url("smtp://user:password@domain.com"));

MailMessage* mail = new MailMessage();
mail->from = "developers@sming";
mail->to = "iot-developers@world";
mail->subject = "Greetings from Sming";
mail->setBody("Hello");

FileStream* file= new FileStream("image.png");
mail->addAttachment(file);

emailClient.onMessageSent(onMailSent);
emailClient.send(mail);

...

int onMailSent(SmtpClient& client, int code, char* status)
{
MailMessage* mail = client.getCurrentMessage();

...

if(!client.countPending()) {
client.quit();
}

return 0;
}

See the :sample:`SmtpClient` sample for details.

Live Debugging
--------------

Applications based on Sming Framework that are flashed and running on an
ESP8266 device can be debugged using interactive debuggers. In order to
debug an application it has to be re-compiled with the ENABLE_GDB=1
directive. And then flashed on the device. As shown below:

.. code-block:: bash

cd $SMING_HOME/../samples/LiveDebug
make clean
make ENABLE_GDB=1
make flashapp # <-- this will update only the application firmware.

Once the debuggable application is flashed on the device the developers
have to run GDB. The easiest way to run the command-line GDB is to
execute the following command:

.. code-block:: bash

make gdb

Developers using Eclipse CDT can have debugging sessions like the one
below:

.. :image:: /information/eclipse-debug-session.png

See :sample:`LiveDebug` sample for details.

Documentation
-------------

We provide `generated
documentation <https://sminghub.github.io/Sming/api/>`__ online.

If you want you can also generate a complete documentation locally by
running the commands below. This requires ``doxygen`` to be installed on
your system.

.. code-block:: bash

cd $SMING_HOME
make docs

The newly generated documentation will be located under Sming/docs/api.
See the :doc:`Quick-start <quick-start/index>` page for your respective operating system.


.. toctree::
:caption: Contents:
:hidden:

quick-start/index
host-emulator
features
information/index
Expand All @@ -345,7 +64,6 @@ The newly generated documentation will be located under Sming/docs/api.
tools/index
troubleshooting/index


Indices and tables
------------------

Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
Install docker
*******************
Docker Installation
*******************

Install Docker
==============

Visit the official `Docker Installation
Page <https://docs.docker.com/engine/installation/>`__ and follow the
instructions tailored for your operating system.
Visit the official
`Docker Installation Page <https://docs.docker.com/engine/installation/>`__
and follow the instructions tailored for your operating system.

Install docker-compose
======================
Expand All @@ -16,9 +20,9 @@ With docker compose we can define the entire multi-container application
in single file and then the application can be spinned up using one
command.

Visit the official `Docker Compose Installation
Page <https://docs.docker.com/compose/install/>`__ and follow the
instructions tailored for your operating system.
Visit the official
`Docker Compose Installation Page <https://docs.docker.com/compose/install/>`__
and follow the instructions tailored for your operating system.

Adjust your settings
====================
Expand Down Expand Up @@ -46,27 +50,21 @@ Adjust your settings
Start your container
====================

.. code:: shell
.. code-block:: bash

cd /opt/sming/docker/ && docker-compose -f sming-ide.yml up -d

Open your browser
=================

http://localhost:10080

|C9 screenshot example|
``http://localhost:10080``

.. code:: shell

cd /opt/sming/Sming
make
.. image:: c9-1.png
:height: 250px

.. code:: shell
.. code-block:: bash

cd /opt/sming/samples/Basic_Blink
make
make flash

.. |C9 screenshot example| image:: images/c9-1.png
:target: images/c9-1.png
Loading