Remove 3rd party references in code and documentation (#10666)
* feat(support): documentation adjustment * feat(support): readme files, commentaries and examples * fix(template): Fix Issue Report Template ----------------------------- Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
This commit is contained in:
parent
6ce43695d2
commit
c7022caeda
30 changed files with 10 additions and 558 deletions
2
.github/ISSUE_TEMPLATE/Issue-report.yml
vendored
2
.github/ISSUE_TEMPLATE/Issue-report.yml
vendored
|
|
@ -75,7 +75,7 @@ body:
|
||||||
attributes:
|
attributes:
|
||||||
label: IDE Name
|
label: IDE Name
|
||||||
description: What IDE are you using?
|
description: What IDE are you using?
|
||||||
placeholder: eg. Arduino IDE, PlatformIO, Sloeber...
|
placeholder: eg. Arduino IDE, VSCode, Sloeber...
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: input
|
- type: input
|
||||||
|
|
|
||||||
BIN
docs/_static/logo_pio.png
vendored
BIN
docs/_static/logo_pio.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB |
|
|
@ -78,14 +78,13 @@ Supported IDEs
|
||||||
|
|
||||||
Here is the list of supported IDE for Arduino ESP32 support integration.
|
Here is the list of supported IDE for Arduino ESP32 support integration.
|
||||||
|
|
||||||
+-------------------+-------------------+
|
+-------------------+
|
||||||
| |arduino-logo| | |pio-logo| |
|
| |arduino-logo| |
|
||||||
+-------------------+-------------------+
|
+-------------------+
|
||||||
| Arduino IDE | PlatformIO |
|
| Arduino IDE |
|
||||||
+-------------------+-------------------+
|
+-------------------+
|
||||||
|
|
||||||
.. |arduino-logo| image:: ../_static/logo_arduino.png
|
.. |arduino-logo| image:: ../_static/logo_arduino.png
|
||||||
.. |pio-logo| image:: ../_static/logo_pio.png
|
|
||||||
|
|
||||||
See `Installing Guides <installing.html>`_ for more details on how to install the Arduino ESP32 support.
|
See `Installing Guides <installing.html>`_ for more details on how to install the Arduino ESP32 support.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,92 +63,6 @@ To start the installation process using the Boards Manager, follow these steps:
|
||||||
|
|
||||||
- Restart Arduino IDE.
|
- Restart Arduino IDE.
|
||||||
|
|
||||||
Installing using PlatformIO
|
|
||||||
---------------------------
|
|
||||||
|
|
||||||
.. figure:: ../_static/logo_pio.png
|
|
||||||
:align: center
|
|
||||||
:width: 200
|
|
||||||
:figclass: align-center
|
|
||||||
|
|
||||||
PlatformIO is a professional collaborative platform for embedded development. It has out-of-the-box support for ESP32 SoCs and allows working with Arduino ESP32 as well as ESP-IDF from Espressif without changing your development environment. PlatformIO includes lots of instruments for the most common development tasks such as debugging, unit testing, and static code analysis.
|
|
||||||
|
|
||||||
.. warning:: Integration of the Arduino Core ESP32 project in PlatformIO is maintained by PlatformIO developers. Arduino Core ESP32 Project Team cannot support PlatformIO-specific issues. Please report these issues in official `PlatformIO repositories <https://github.com/platformio>`_.
|
|
||||||
|
|
||||||
A detailed overview of the PlatformIO ecosystem and its philosophy can be found in `the official documentation <https://docs.platformio.org/en/latest/core/index.html>`_.
|
|
||||||
|
|
||||||
PlatformIO can be used in two flavors:
|
|
||||||
|
|
||||||
- `PlatformIO IDE <https://platformio.org/platformio-ide>`_ is a toolset for embedded C/C++ development available on Windows, macOS and Linux platforms
|
|
||||||
|
|
||||||
- `PlatformIO Core (CLI) <https://docs.platformio.org/en/latest/core/index.html>`_ is a command-line tool that consists of a multi-platform build system, platform and library managers and other integration components. It can be used with a variety of code development environments and allows integration with cloud platforms and web services
|
|
||||||
|
|
||||||
To install PlatformIO, you can follow this Getting Started, provided at `docs.platformio.org`_.
|
|
||||||
|
|
||||||
Using the stable code
|
|
||||||
*********************
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
A detailed overview of supported development boards, examples and frameworks can be found on `the official Espressif32 dev-platform page <https://registry.platformio.org/platforms/platformio/espressif32>`_ in the PlatformIO Registry.
|
|
||||||
|
|
||||||
The most reliable and easiest way to get started is to use the latest stable version of the ESP32 development platform that passed all tests/verifications and can be used in production.
|
|
||||||
|
|
||||||
Create a new project and select one of the available boards. You can change after by changing the `platformio.ini <https://docs.platformio.org/en/latest/projectconf/index.html>`_ file.
|
|
||||||
|
|
||||||
- For ESP32
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
[env:esp32dev]
|
|
||||||
platform = espressif32
|
|
||||||
board = esp32dev
|
|
||||||
framework = arduino
|
|
||||||
|
|
||||||
- For ESP32-S2 (ESP32-S2-Saola-1 board)
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
[env:esp32-s2-saola-1]
|
|
||||||
platform = espressif32
|
|
||||||
board = esp32-s2-saola-1
|
|
||||||
framework = arduino
|
|
||||||
|
|
||||||
- For ESP32-C3 (ESP32-C3-DevKitM-1 board)
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
[env:esp32-c3-devkitm-1]
|
|
||||||
platform = espressif32
|
|
||||||
board = esp32-c3-devkitm-1
|
|
||||||
framework = arduino
|
|
||||||
|
|
||||||
How to update to the latest code
|
|
||||||
********************************
|
|
||||||
|
|
||||||
To test the latest Arduino ESP32, you need to change your project *platformio.ini* accordingly.
|
|
||||||
The following configuration uses the upstream version of the Espressif development platform and the latest Arduino core directly from the Espressif GitHub repository:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
[env:esp32-c3-devkitm-1]
|
|
||||||
platform = https://github.com/platformio/platform-espressif32.git
|
|
||||||
board = esp32-c3-devkitm-1
|
|
||||||
framework = arduino
|
|
||||||
platform_packages =
|
|
||||||
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master
|
|
||||||
|
|
||||||
|
|
||||||
To get more information about PlatformIO, see the following links:
|
|
||||||
|
|
||||||
- `PlatformIO Core (CLI) <https://docs.platformio.org/en/latest/core/index.html>`_
|
|
||||||
|
|
||||||
- `PlatformIO Home <https://docs.platformio.org/en/latest/home/index.html>`_
|
|
||||||
|
|
||||||
- `Tutorials and Examples <https://docs.platformio.org/en/latest/tutorials/index.html>`_
|
|
||||||
|
|
||||||
- `Library Management <https://docs.platformio.org/en/latest/librarymanager/index.html>`_
|
|
||||||
|
|
||||||
|
|
||||||
Windows (manual installation)
|
Windows (manual installation)
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
|
|
@ -360,4 +274,3 @@ Where ``~/Documents/Arduino`` represents your sketch book location as per "Ardui
|
||||||
- Restart Arduino IDE.
|
- Restart Arduino IDE.
|
||||||
|
|
||||||
.. _Arduino.cc: https://www.arduino.cc/en/Main/Software
|
.. _Arduino.cc: https://www.arduino.cc/en/Main/Software
|
||||||
.. _docs.platformio.org: https://docs.platformio.org/en/latest/integration/ide/pioide.html
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ Introduction
|
||||||
|
|
||||||
This is the interactive blink tutorial using `Wokwi`_. For this tutorial, you don't need the ESP32 board or the Arduino toolchain.
|
This is the interactive blink tutorial using `Wokwi`_. For this tutorial, you don't need the ESP32 board or the Arduino toolchain.
|
||||||
|
|
||||||
.. note:: If you don't want to use this tutorial with the simulation, you can copy and paste the :ref:`blink_example_code` from `Wokwi`_ editor and use it on the `Arduino IDE`_ or `PlatformIO`_.
|
.. note:: If you don't want to use this tutorial with the simulation, you can copy and paste the :ref:`blink_example_code` from `Wokwi`_ editor and use it on the `Arduino IDE`.
|
||||||
|
|
||||||
About this Tutorial
|
About this Tutorial
|
||||||
-------------------
|
-------------------
|
||||||
|
|
@ -109,5 +109,4 @@ Resources
|
||||||
|
|
||||||
.. _ESP32 Datasheet: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf
|
.. _ESP32 Datasheet: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf
|
||||||
.. _Wokwi: https://wokwi.com/
|
.. _Wokwi: https://wokwi.com/
|
||||||
.. _PlatformIO: https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html#platformio
|
|
||||||
.. _Arduino IDE: https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html#installing-using-boards-manager
|
.. _Arduino IDE: https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html#installing-using-boards-manager
|
||||||
|
|
|
||||||
|
|
@ -62,10 +62,6 @@ To get more information about the Espressif boards see [Espressif Development Ki
|
||||||
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
||||||
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
||||||
|
|
||||||
#### Using Platform IO
|
|
||||||
|
|
||||||
* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file.
|
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
***Important: Make sure you are using a good quality USB cable and that you have a reliable power source***
|
***Important: Make sure you are using a good quality USB cable and that you have a reliable power source***
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,6 @@ To get more information about the Espressif boards see [Espressif Development Ki
|
||||||
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
||||||
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
||||||
|
|
||||||
#### Using Platform IO
|
|
||||||
|
|
||||||
* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file.
|
|
||||||
|
|
||||||
## Example Log Output
|
## Example Log Output
|
||||||
|
|
||||||
The expected output of shared variables protected by mutex demonstrates mutually exclusive access from tasks - they do not interrupt each other and do not rewrite the value before the other task has read it back.
|
The expected output of shared variables protected by mutex demonstrates mutually exclusive access from tasks - they do not interrupt each other and do not rewrite the value before the other task has read it back.
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,6 @@ To get more information about the Espressif boards see [Espressif Development Ki
|
||||||
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
||||||
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
||||||
|
|
||||||
#### Using Platform IO
|
|
||||||
|
|
||||||
* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file.
|
|
||||||
|
|
||||||
## Example Log Output
|
## Example Log Output
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,6 @@ To get more information about the Espressif boards see [Espressif Development Ki
|
||||||
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
||||||
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
||||||
|
|
||||||
#### Using Platform IO
|
|
||||||
|
|
||||||
* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file.
|
|
||||||
|
|
||||||
## Example Log Output
|
## Example Log Output
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
// add the file "build_opt.h" to your Arduino project folder with "-DESP32_ARDUINO_NO_RGB_BUILTIN" to use the RMT Legacy driver
|
// add the file "build_opt.h" to your Arduino project folder with "-DESP32_ARDUINO_NO_RGB_BUILTIN" to use the RMT Legacy driver
|
||||||
#error "ESP32_ARDUINO_NO_RGB_BUILTIN is not defined, this example is intended to demonstrate the RMT Legacy driver."
|
#error "ESP32_ARDUINO_NO_RGB_BUILTIN is not defined, this example is intended to demonstrate the RMT Legacy driver."
|
||||||
#error "Please add the file 'build_opt.h' with '-DESP32_ARDUINO_NO_RGB_BUILTIN' to your Arduino project folder."
|
#error "Please add the file 'build_opt.h' with '-DESP32_ARDUINO_NO_RGB_BUILTIN' to your Arduino project folder."
|
||||||
#error "Another way to disable the RGB_BUILTIN is to define it in the platformio.ini file, for instance: '-D ESP32_ARDUINO_NO_RGB_BUILTIN'"
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,10 +64,6 @@ To get more information about the Espressif boards see [Espressif Development Ki
|
||||||
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
||||||
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
||||||
|
|
||||||
#### Using Platform IO
|
|
||||||
|
|
||||||
* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file.
|
|
||||||
|
|
||||||
## Example/Log Output ==(OPTIONAL)==
|
## Example/Log Output ==(OPTIONAL)==
|
||||||
|
|
||||||
==*Add the log/serial output here!*==
|
==*Add the log/serial output here!*==
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
.pio
|
|
||||||
.vscode
|
|
||||||
mklittlefs.exe
|
|
||||||
mklittlefs
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
# How to run on PlatformIO IDE
|
|
||||||
|
|
||||||
- Download and extract to this project root a **mklittlefs** executable for your OS [from a zipped binary here](https://github.com/earlephilhower/mklittlefs/releases)
|
|
||||||
- Open **LITTLEFS_PlatformIO** folder
|
|
||||||
- Run PlatformIO project task: **Upload Filesystem Image**
|
|
||||||
- Run PlatformIO project task: **Upload and Monitor**
|
|
||||||
- You will see a Serial output like:
|
|
||||||
```
|
|
||||||
--- Miniterm on COM5 115200,8,N,1 ---
|
|
||||||
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
|
|
||||||
ets Jun 8 2016 00:22:57
|
|
||||||
|
|
||||||
rst:0x1 (POWERON_RESET),boot:0x13 (Snfigsip: 0, SPIWP:0xee
|
|
||||||
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
|
|
||||||
mode:DIO, clock div:2
|
|
||||||
load:0x3fff0018,len:4
|
|
||||||
load:0x3fff001c,len:1044
|
|
||||||
load:0x40078000,len:10044
|
|
||||||
load:0x40080400,len:5872
|
|
||||||
entry 0x400806ac
|
|
||||||
Listing directory: /
|
|
||||||
FILE: /file1.txt SIZE: 3 LAST WRITE: 2020-10-06 15:10:33
|
|
||||||
DIR : /testfolder LAST WRITE: 2020-10-06 15:10:33
|
|
||||||
Creating Dir: /mydir
|
|
||||||
Dir created
|
|
||||||
Writing file: /mydir/hello2.txt
|
|
||||||
- file written
|
|
||||||
Listing directory: /
|
|
||||||
FILE: /file1.txt SIZE: 3 LAST WRITE: 2020-10-06 15:10:33
|
|
||||||
DIR : /mydir LAST WRITE: 1970-01-01 00:00:00
|
|
||||||
Listing directory: /mydir
|
|
||||||
FILE: /mydir/hello2.txt SIZE: 6 LAST WRITE: 1970-01-01 00:00:00
|
|
||||||
DIR : /testfolder LAST WRITE: 2020-10-06 15:10:33
|
|
||||||
Listing directory: /testfolder
|
|
||||||
FILE: /testfolder/test2.txt SIZE: 3 LAST WRITE: 2020-10-06 15:10:33
|
|
||||||
Deleting file: /mydir/hello2.txt
|
|
||||||
- file deleted
|
|
||||||
Removing Dir: /mydir
|
|
||||||
Dir removed
|
|
||||||
Listing directory: /
|
|
||||||
FILE: /file1.txt SIZE: 3 LAST WRITE: 2020-10-06 15:10:33
|
|
||||||
DIR : /testfolder LAST WRITE: 2020-10-06 15:10:33
|
|
||||||
Listing directory: /testfolder
|
|
||||||
FILE: /testfolder/test2.txt SIZE: 3 LAST WRITE: 2020-10-06 15:10:33
|
|
||||||
Writing file: /hello.txt
|
|
||||||
- file written
|
|
||||||
Appending to file: /hello.txt
|
|
||||||
- message appended
|
|
||||||
Reading file: /hello.txt
|
|
||||||
- read from file:
|
|
||||||
Hello World!
|
|
||||||
Renaming file /hello.txt to /foo.txt
|
|
||||||
- file renamed
|
|
||||||
Reading file: /foo.txt
|
|
||||||
- read from file:
|
|
||||||
Hello World!
|
|
||||||
Deleting file: /foo.txt
|
|
||||||
- file deleted
|
|
||||||
Testing file I/O with /test.txt
|
|
||||||
- writing................................................................
|
|
||||||
- 1048576 bytes written in 12006 ms
|
|
||||||
- reading................................................................
|
|
||||||
- 1048576 bytes read in 547 ms
|
|
||||||
Deleting file: /test.txt
|
|
||||||
- file deleted
|
|
||||||
Test complete
|
|
||||||
```
|
|
||||||
- If you have a module with more than 4 MB flash, you can uncomment **partitions_custom.csv** in **platformio.ini** and modify the csv file accordingly
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
aaa
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
bbb
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
# Name, Type, SubType, Offset, Size, Flags
|
|
||||||
ota_0, app, ota_0, 0x10000, 0x1A0000,
|
|
||||||
ota_1, app, ota_1, , 0x1A0000,
|
|
||||||
otadata, data, ota, 0x350000, 0x2000,
|
|
||||||
nvs, data, nvs, , 0x6000,
|
|
||||||
data, data, spiffs, , 0xA8000,
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
; PlatformIO Project Configuration File
|
|
||||||
;
|
|
||||||
; Build options: build flags, source filter
|
|
||||||
; Upload options: custom upload port, speed and extra flags
|
|
||||||
; Library options: dependencies, extra library storages
|
|
||||||
; Advanced options: extra scripting
|
|
||||||
;
|
|
||||||
; Please visit documentation for the other options and examples
|
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
|
||||||
|
|
||||||
[platformio]
|
|
||||||
default_envs = esp32
|
|
||||||
|
|
||||||
[env]
|
|
||||||
framework = arduino
|
|
||||||
|
|
||||||
[env:esp32]
|
|
||||||
platform = espressif32
|
|
||||||
board = esp32dev
|
|
||||||
board_build.partitions = partitions_custom.csv
|
|
||||||
monitor_filters = esp32_exception_decoder
|
|
||||||
monitor_speed = 115200
|
|
||||||
|
|
@ -1,286 +0,0 @@
|
||||||
#include <Arduino.h>
|
|
||||||
#include "FS.h"
|
|
||||||
#include <LittleFS.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
/* You only need to format LittleFS the first time you run a
|
|
||||||
test or else use the LITTLEFS plugin to create a partition
|
|
||||||
https://github.com/lorol/arduino-esp32littlefs-plugin */
|
|
||||||
|
|
||||||
#define FORMAT_LITTLEFS_IF_FAILED true
|
|
||||||
|
|
||||||
void listDir(fs::FS &fs, const char *dirname, uint8_t levels) {
|
|
||||||
Serial.printf("Listing directory: %s\r\n", dirname);
|
|
||||||
|
|
||||||
File root = fs.open(dirname);
|
|
||||||
if (!root) {
|
|
||||||
Serial.println("- failed to open directory");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!root.isDirectory()) {
|
|
||||||
Serial.println(" - not a directory");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
File file = root.openNextFile();
|
|
||||||
while (file) {
|
|
||||||
if (file.isDirectory()) {
|
|
||||||
Serial.print(" DIR : ");
|
|
||||||
|
|
||||||
Serial.print(file.name());
|
|
||||||
time_t t = file.getLastWrite();
|
|
||||||
struct tm *tmstruct = localtime(&t);
|
|
||||||
Serial.printf(
|
|
||||||
" LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n", (tmstruct->tm_year) + 1900, (tmstruct->tm_mon) + 1, tmstruct->tm_mday, tmstruct->tm_hour,
|
|
||||||
tmstruct->tm_min, tmstruct->tm_sec
|
|
||||||
);
|
|
||||||
|
|
||||||
if (levels) {
|
|
||||||
listDir(fs, file.name(), levels - 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Serial.print(" FILE: ");
|
|
||||||
Serial.print(file.name());
|
|
||||||
Serial.print(" SIZE: ");
|
|
||||||
|
|
||||||
Serial.print(file.size());
|
|
||||||
time_t t = file.getLastWrite();
|
|
||||||
struct tm *tmstruct = localtime(&t);
|
|
||||||
Serial.printf(
|
|
||||||
" LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n", (tmstruct->tm_year) + 1900, (tmstruct->tm_mon) + 1, tmstruct->tm_mday, tmstruct->tm_hour,
|
|
||||||
tmstruct->tm_min, tmstruct->tm_sec
|
|
||||||
);
|
|
||||||
}
|
|
||||||
file = root.openNextFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void createDir(fs::FS &fs, const char *path) {
|
|
||||||
Serial.printf("Creating Dir: %s\n", path);
|
|
||||||
if (fs.mkdir(path)) {
|
|
||||||
Serial.println("Dir created");
|
|
||||||
} else {
|
|
||||||
Serial.println("mkdir failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void removeDir(fs::FS &fs, const char *path) {
|
|
||||||
Serial.printf("Removing Dir: %s\n", path);
|
|
||||||
if (fs.rmdir(path)) {
|
|
||||||
Serial.println("Dir removed");
|
|
||||||
} else {
|
|
||||||
Serial.println("rmdir failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void readFile(fs::FS &fs, const char *path) {
|
|
||||||
Serial.printf("Reading file: %s\r\n", path);
|
|
||||||
|
|
||||||
File file = fs.open(path);
|
|
||||||
if (!file || file.isDirectory()) {
|
|
||||||
Serial.println("- failed to open file for reading");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Serial.println("- read from file:");
|
|
||||||
while (file.available()) {
|
|
||||||
Serial.write(file.read());
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void writeFile(fs::FS &fs, const char *path, const char *message) {
|
|
||||||
Serial.printf("Writing file: %s\r\n", path);
|
|
||||||
|
|
||||||
File file = fs.open(path, FILE_WRITE);
|
|
||||||
if (!file) {
|
|
||||||
Serial.println("- failed to open file for writing");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (file.print(message)) {
|
|
||||||
Serial.println("- file written");
|
|
||||||
} else {
|
|
||||||
Serial.println("- write failed");
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void appendFile(fs::FS &fs, const char *path, const char *message) {
|
|
||||||
Serial.printf("Appending to file: %s\r\n", path);
|
|
||||||
|
|
||||||
File file = fs.open(path, FILE_APPEND);
|
|
||||||
if (!file) {
|
|
||||||
Serial.println("- failed to open file for appending");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (file.print(message)) {
|
|
||||||
Serial.println("- message appended");
|
|
||||||
} else {
|
|
||||||
Serial.println("- append failed");
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void renameFile(fs::FS &fs, const char *path1, const char *path2) {
|
|
||||||
Serial.printf("Renaming file %s to %s\r\n", path1, path2);
|
|
||||||
if (fs.rename(path1, path2)) {
|
|
||||||
Serial.println("- file renamed");
|
|
||||||
} else {
|
|
||||||
Serial.println("- rename failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void deleteFile(fs::FS &fs, const char *path) {
|
|
||||||
Serial.printf("Deleting file: %s\r\n", path);
|
|
||||||
if (fs.remove(path)) {
|
|
||||||
Serial.println("- file deleted");
|
|
||||||
} else {
|
|
||||||
Serial.println("- delete failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// SPIFFS-like write and delete file
|
|
||||||
|
|
||||||
// See: https://github.com/esp8266/Arduino/blob/master/libraries/LittleFS/src/LittleFS.cpp#L60
|
|
||||||
void writeFile2(fs::FS &fs, const char *path, const char *message) {
|
|
||||||
if (!fs.exists(path)) {
|
|
||||||
if (strchr(path, '/')) {
|
|
||||||
Serial.printf("Create missing folders of: %s\r\n", path);
|
|
||||||
char *pathStr = strdup(path);
|
|
||||||
if (pathStr) {
|
|
||||||
char *ptr = strchr(pathStr, '/');
|
|
||||||
while (ptr) {
|
|
||||||
*ptr = 0;
|
|
||||||
fs.mkdir(pathStr);
|
|
||||||
*ptr = '/';
|
|
||||||
ptr = strchr(ptr + 1, '/');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(pathStr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Serial.printf("Writing file to: %s\r\n", path);
|
|
||||||
File file = fs.open(path, FILE_WRITE);
|
|
||||||
if (!file) {
|
|
||||||
Serial.println("- failed to open file for writing");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (file.print(message)) {
|
|
||||||
Serial.println("- file written");
|
|
||||||
} else {
|
|
||||||
Serial.println("- write failed");
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// See: https://github.com/esp8266/Arduino/blob/master/libraries/LittleFS/src/LittleFS.h#L149
|
|
||||||
void deleteFile2(fs::FS &fs, const char *path) {
|
|
||||||
Serial.printf("Deleting file and empty folders on path: %s\r\n", path);
|
|
||||||
|
|
||||||
if (fs.remove(path)) {
|
|
||||||
Serial.println("- file deleted");
|
|
||||||
} else {
|
|
||||||
Serial.println("- delete failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
char *pathStr = strdup(path);
|
|
||||||
if (pathStr) {
|
|
||||||
char *ptr = strrchr(pathStr, '/');
|
|
||||||
if (ptr) {
|
|
||||||
Serial.printf("Removing all empty folders on path: %s\r\n", path);
|
|
||||||
}
|
|
||||||
while (ptr) {
|
|
||||||
*ptr = 0;
|
|
||||||
fs.rmdir(pathStr);
|
|
||||||
ptr = strrchr(pathStr, '/');
|
|
||||||
}
|
|
||||||
free(pathStr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void testFileIO(fs::FS &fs, const char *path) {
|
|
||||||
Serial.printf("Testing file I/O with %s\r\n", path);
|
|
||||||
|
|
||||||
static uint8_t buf[512];
|
|
||||||
size_t len = 0;
|
|
||||||
File file = fs.open(path, FILE_WRITE);
|
|
||||||
if (!file) {
|
|
||||||
Serial.println("- failed to open file for writing");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t i;
|
|
||||||
Serial.print("- writing");
|
|
||||||
uint32_t start = millis();
|
|
||||||
for (i = 0; i < 2048; i++) {
|
|
||||||
if ((i & 0x001F) == 0x001F) {
|
|
||||||
Serial.print(".");
|
|
||||||
}
|
|
||||||
file.write(buf, 512);
|
|
||||||
}
|
|
||||||
Serial.println("");
|
|
||||||
uint32_t end = millis() - start;
|
|
||||||
Serial.printf(" - %u bytes written in %u ms\r\n", 2048 * 512, end);
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
file = fs.open(path);
|
|
||||||
start = millis();
|
|
||||||
end = start;
|
|
||||||
i = 0;
|
|
||||||
if (file && !file.isDirectory()) {
|
|
||||||
len = file.size();
|
|
||||||
size_t flen = len;
|
|
||||||
start = millis();
|
|
||||||
Serial.print("- reading");
|
|
||||||
while (len) {
|
|
||||||
size_t toRead = len;
|
|
||||||
if (toRead > 512) {
|
|
||||||
toRead = 512;
|
|
||||||
}
|
|
||||||
file.read(buf, toRead);
|
|
||||||
if ((i++ & 0x001F) == 0x001F) {
|
|
||||||
Serial.print(".");
|
|
||||||
}
|
|
||||||
len -= toRead;
|
|
||||||
}
|
|
||||||
Serial.println("");
|
|
||||||
end = millis() - start;
|
|
||||||
Serial.printf("- %u bytes read in %u ms\r\n", flen, end);
|
|
||||||
file.close();
|
|
||||||
} else {
|
|
||||||
Serial.println("- failed to open file for reading");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
Serial.begin(115200);
|
|
||||||
if (!LittleFS.begin(FORMAT_LITTLEFS_IF_FAILED)) {
|
|
||||||
Serial.println("LittleFS Mount Failed");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
listDir(LittleFS, "/", 0);
|
|
||||||
createDir(LittleFS, "/mydir");
|
|
||||||
writeFile(LittleFS, "/mydir/hello2.txt", "Hello2");
|
|
||||||
//writeFile(LittleFS, "/mydir/newdir2/newdir3/hello3.txt", "Hello3");
|
|
||||||
writeFile2(LittleFS, "/mydir/newdir2/newdir3/hello3.txt", "Hello3");
|
|
||||||
listDir(LittleFS, "/", 3);
|
|
||||||
deleteFile(LittleFS, "/mydir/hello2.txt");
|
|
||||||
//deleteFile(LittleFS, "/mydir/newdir2/newdir3/hello3.txt");
|
|
||||||
deleteFile2(LittleFS, "/mydir/newdir2/newdir3/hello3.txt");
|
|
||||||
removeDir(LittleFS, "/mydir");
|
|
||||||
listDir(LittleFS, "/", 3);
|
|
||||||
writeFile(LittleFS, "/hello.txt", "Hello ");
|
|
||||||
appendFile(LittleFS, "/hello.txt", "World!\r\n");
|
|
||||||
readFile(LittleFS, "/hello.txt");
|
|
||||||
renameFile(LittleFS, "/hello.txt", "/foo.txt");
|
|
||||||
readFile(LittleFS, "/foo.txt");
|
|
||||||
deleteFile(LittleFS, "/foo.txt");
|
|
||||||
testFileIO(LittleFS, "/test.txt");
|
|
||||||
deleteFile(LittleFS, "/test.txt");
|
|
||||||
|
|
||||||
Serial.println("Test complete");
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {}
|
|
||||||
|
|
@ -32,25 +32,11 @@ This method is similar to the single root certificate verification above, but it
|
||||||
root certificates from Mozilla to authenticate against, while the previous method only accepts a single
|
root certificates from Mozilla to authenticate against, while the previous method only accepts a single
|
||||||
certificate for a given server. This allows the client to connect to all public SSL servers.
|
certificate for a given server. This allows the client to connect to all public SSL servers.
|
||||||
|
|
||||||
To use this feature in PlatformIO:
|
|
||||||
1. create a certificate bundle as described in the document below, or obtain a pre-built one you trust:
|
|
||||||
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/protocols/esp_crt_bundle.html
|
|
||||||
(gen_crt_bundle.py can be found in the /tools folder)
|
|
||||||
a. note: the full bundle will take up around 64k of flash space, but has minimal RAM usage, as only
|
|
||||||
the index of the certificates is kept in RAM
|
|
||||||
2. Place the bundle under the file name "data/cert/x509_crt_bundle.bin" in your platformio project
|
|
||||||
3. add "board_build.embed_files = data/cert/x509_crt_bundle.bin" in your platformio.ini
|
|
||||||
4. add the following global declaration in your project:
|
|
||||||
extern const uint8_t rootca_crt_bundle_start[] asm("_binary_data_cert_x509_crt_bundle_bin_start");
|
|
||||||
5. before initiating the first SSL connection, call
|
|
||||||
my_client.setCACertBundle(rootca_crt_bundle_start);
|
|
||||||
|
|
||||||
To use this feature in Arduino IDE:
|
To use this feature in Arduino IDE:
|
||||||
If the Arduino IDE added support for embedding files in the meantime, then follow the instructions above.
|
If the Arduino IDE added support for embedding files in the meantime, then follow the instructions above.
|
||||||
If not, you have three choices:
|
If not, you have two choices:
|
||||||
1. convert your project to PlatformIO
|
1. create a makefile where you can add the idf_component_register() declaration to include the certificate bundle
|
||||||
2. create a makefile where you can add the idf_component_register() declaration to include the certificate bundle
|
2. Store the bundle as a SPIFFS file, but then you have to load it into RAM in runtime and waste 64k of precious memory
|
||||||
3. Store the bundle as a SPIFFS file, but then you have to load it into RAM in runtime and waste 64k of precious memory
|
|
||||||
|
|
||||||
Using a root CA cert and client cert/keys
|
Using a root CA cert and client cert/keys
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -67,10 +67,6 @@ To get more information about the Espressif boards see [Espressif Development Ki
|
||||||
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
||||||
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
||||||
|
|
||||||
#### Using Platform IO
|
|
||||||
|
|
||||||
* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file.
|
|
||||||
|
|
||||||
## Example Log Output
|
## Example Log Output
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,6 @@ To get more information about the Espressif boards see [Espressif Development Ki
|
||||||
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
||||||
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
||||||
|
|
||||||
#### Using Platform IO
|
|
||||||
|
|
||||||
* Select the COM port: `Devices` or setting the `upload_port` option on the `platformio.ini` file.
|
|
||||||
|
|
||||||
## Log Output
|
## Log Output
|
||||||
|
|
||||||
Expected log output:
|
Expected log output:
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,6 @@ To get more information about the Espressif boards see [Espressif Development Ki
|
||||||
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
||||||
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
||||||
|
|
||||||
#### Using Platform IO
|
|
||||||
|
|
||||||
* Select the COM port: `Devices` or setting the `upload_port` option on the `platformio.ini` file.
|
|
||||||
|
|
||||||
## Log Output
|
## Log Output
|
||||||
|
|
||||||
Expected log output:
|
Expected log output:
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,6 @@ To get more information about the Espressif boards see [Espressif Development Ki
|
||||||
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
||||||
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
||||||
|
|
||||||
#### Using Platform IO
|
|
||||||
|
|
||||||
* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file.
|
|
||||||
|
|
||||||
## Example Log Output
|
## Example Log Output
|
||||||
|
|
||||||
The initial output which is common for all examples can be ignored:
|
The initial output which is common for all examples can be ignored:
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,6 @@ Currently, this example supports the following targets.
|
||||||
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
||||||
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
||||||
|
|
||||||
#### Using Platform IO
|
|
||||||
|
|
||||||
* Select the COM port: `Devices` or set the `upload_port`` option on the `platformio.ini` file.
|
|
||||||
|
|
||||||
## Example/Log Output
|
## Example/Log Output
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,6 @@ Currently, this example supports the following targets.
|
||||||
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
||||||
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
||||||
|
|
||||||
#### Using Platform IO
|
|
||||||
|
|
||||||
* Select the COM port: `Devices` or setting the `upload_port` option on the `platformio.ini` file.
|
|
||||||
|
|
||||||
## Example/Log Output
|
## Example/Log Output
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,6 @@ Currently, this example supports the following targets.
|
||||||
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
||||||
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
||||||
|
|
||||||
#### Using Platform IO
|
|
||||||
|
|
||||||
* Select the COM port: `Devices` or setting the `upload_port` option on the `platformio.ini` file.
|
|
||||||
|
|
||||||
## Example/Log Output
|
## Example/Log Output
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,6 @@ This example is compatible with the ESP32-WROOM-DA.
|
||||||
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
||||||
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
||||||
|
|
||||||
#### Using Platform IO
|
|
||||||
|
|
||||||
* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file.
|
|
||||||
|
|
||||||
## Example/Log Output
|
## Example/Log Output
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,6 @@ Currently, this example supports the following targets.
|
||||||
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
||||||
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
||||||
|
|
||||||
#### Using Platform IO
|
|
||||||
|
|
||||||
* Select the COM port: `Devices` or setting the `upload_port` option on the `platformio.ini` file.
|
|
||||||
|
|
||||||
## Example/Log Output
|
## Example/Log Output
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue