Merge branch 'master' into release/v3.3.x
This commit is contained in:
commit
5871a80616
14 changed files with 189 additions and 71 deletions
2
.github/workflows/publishsizes.yml
vendored
2
.github/workflows/publishsizes.yml
vendored
|
|
@ -66,7 +66,7 @@ jobs:
|
||||||
path: ./artifacts/sizes-report/pr_num.txt
|
path: ./artifacts/sizes-report/pr_num.txt
|
||||||
|
|
||||||
- name: Report results
|
- name: Report results
|
||||||
uses: P-R-O-C-H-Y/report-size-deltas@2043188c68f483a7b50527c4eacf609d05bb67a5 # sizes_v2
|
uses: P-R-O-C-H-Y/report-size-deltas@bea91d2c99ca80c88a883b39b1c4012f00ec3d09 # sizes_v2
|
||||||
with:
|
with:
|
||||||
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}
|
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}
|
||||||
github-token: ${{ env.GITHUB_TOKEN }}
|
github-token: ${{ env.GITHUB_TOKEN }}
|
||||||
|
|
|
||||||
|
|
@ -84,16 +84,15 @@ struct spi_struct_t {
|
||||||
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32S2
|
#if CONFIG_IDF_TARGET_ESP32S2
|
||||||
// ESP32S2
|
// ESP32S2
|
||||||
#define SPI_COUNT (3)
|
#define SPI_COUNT (2)
|
||||||
|
|
||||||
#define SPI_CLK_IDX(p) ((p == 0) ? SPICLK_OUT_MUX_IDX : ((p == 1) ? FSPICLK_OUT_MUX_IDX : ((p == 2) ? SPI3_CLK_OUT_MUX_IDX : 0)))
|
#define SPI_CLK_IDX(p) ((p == 0) ? FSPICLK_OUT_MUX_IDX : ((p == 1) ? SPI3_CLK_OUT_MUX_IDX : 0))
|
||||||
#define SPI_MISO_IDX(p) ((p == 0) ? SPIQ_OUT_IDX : ((p == 1) ? FSPIQ_OUT_IDX : ((p == 2) ? SPI3_Q_OUT_IDX : 0)))
|
#define SPI_MISO_IDX(p) ((p == 0) ? FSPIQ_OUT_IDX : ((p == 1) ? SPI3_Q_OUT_IDX : 0))
|
||||||
#define SPI_MOSI_IDX(p) ((p == 0) ? SPID_IN_IDX : ((p == 1) ? FSPID_IN_IDX : ((p == 2) ? SPI3_D_IN_IDX : 0)))
|
#define SPI_MOSI_IDX(p) ((p == 0) ? FSPID_IN_IDX : ((p == 1) ? SPI3_D_IN_IDX : 0))
|
||||||
|
|
||||||
#define SPI_SPI_SS_IDX(n) ((n == 0) ? SPICS0_OUT_IDX : ((n == 1) ? SPICS1_OUT_IDX : 0))
|
#define SPI_HSPI_SS_IDX(n) ((n == 0) ? SPI3_CS0_OUT_IDX : ((n == 1) ? SPI3_CS1_OUT_IDX : ((n == 2) ? SPI3_CS2_OUT_IDX : 0)))
|
||||||
#define SPI_HSPI_SS_IDX(n) ((n == 0) ? SPI3_CS0_OUT_IDX : ((n == 1) ? SPI3_CS1_OUT_IDX : ((n == 2) ? SPI3_CS2_OUT_IDX : SPI3_CS0_OUT_IDX)))
|
#define SPI_FSPI_SS_IDX(n) ((n == 0) ? FSPICS0_OUT_IDX : ((n == 1) ? FSPICS1_OUT_IDX : ((n == 2) ? FSPICS2_OUT_IDX : 0)))
|
||||||
#define SPI_FSPI_SS_IDX(n) ((n == 0) ? FSPICS0_OUT_IDX : ((n == 1) ? FSPICS1_OUT_IDX : ((n == 2) ? FSPICS2_OUT_IDX : FSPICS0_OUT_IDX)))
|
#define SPI_SS_IDX(p, n) ((p == 0) ? SPI_FSPI_SS_IDX(n) : ((p == 1) ? SPI_HSPI_SS_IDX(n) : 0))
|
||||||
#define SPI_SS_IDX(p, n) ((p == 0) ? SPI_SPI_SS_IDX(n) : ((p == 1) ? SPI_SPI_SS_IDX(n) : ((p == 2) ? SPI_HSPI_SS_IDX(n) : 0)))
|
|
||||||
|
|
||||||
#elif CONFIG_IDF_TARGET_ESP32S3
|
#elif CONFIG_IDF_TARGET_ESP32S3
|
||||||
// ESP32S3
|
// ESP32S3
|
||||||
|
|
@ -103,8 +102,8 @@ struct spi_struct_t {
|
||||||
#define SPI_MISO_IDX(p) ((p == 0) ? FSPIQ_OUT_IDX : ((p == 1) ? SPI3_Q_OUT_IDX : 0))
|
#define SPI_MISO_IDX(p) ((p == 0) ? FSPIQ_OUT_IDX : ((p == 1) ? SPI3_Q_OUT_IDX : 0))
|
||||||
#define SPI_MOSI_IDX(p) ((p == 0) ? FSPID_IN_IDX : ((p == 1) ? SPI3_D_IN_IDX : 0))
|
#define SPI_MOSI_IDX(p) ((p == 0) ? FSPID_IN_IDX : ((p == 1) ? SPI3_D_IN_IDX : 0))
|
||||||
|
|
||||||
#define SPI_HSPI_SS_IDX(n) ((n == 0) ? SPI3_CS0_OUT_IDX : ((n == 1) ? SPI3_CS1_OUT_IDX : 0))
|
#define SPI_HSPI_SS_IDX(n) ((n == 0) ? SPI3_CS0_OUT_IDX : ((n == 1) ? SPI3_CS1_OUT_IDX : ((n == 2) ? SPI3_CS2_OUT_IDX : 0)))
|
||||||
#define SPI_FSPI_SS_IDX(n) ((n == 0) ? FSPICS0_OUT_IDX : ((n == 1) ? FSPICS1_OUT_IDX : 0))
|
#define SPI_FSPI_SS_IDX(n) ((n == 0) ? FSPICS0_OUT_IDX : ((n == 1) ? FSPICS1_OUT_IDX : ((n == 2) ? FSPICS2_OUT_IDX : 0)))
|
||||||
#define SPI_SS_IDX(p, n) ((p == 0) ? SPI_FSPI_SS_IDX(n) : ((p == 1) ? SPI_HSPI_SS_IDX(n) : 0))
|
#define SPI_SS_IDX(p, n) ((p == 0) ? SPI_FSPI_SS_IDX(n) : ((p == 1) ? SPI_HSPI_SS_IDX(n) : 0))
|
||||||
|
|
||||||
#elif CONFIG_IDF_TARGET_ESP32P4
|
#elif CONFIG_IDF_TARGET_ESP32P4
|
||||||
|
|
@ -156,11 +155,7 @@ struct spi_struct_t {
|
||||||
#define SPI_MUTEX_UNLOCK()
|
#define SPI_MUTEX_UNLOCK()
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static spi_t _spi_bus_array[] = {
|
static spi_t _spi_bus_array[] = {
|
||||||
#if CONFIG_IDF_TARGET_ESP32S2
|
#if CONFIG_IDF_TARGET_ESP32S2 ||CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4
|
||||||
{(volatile spi_dev_t *)(DR_REG_SPI1_BASE), 0, -1, -1, -1, -1, false},
|
|
||||||
{(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 1, -1, -1, -1, -1, false},
|
|
||||||
{(volatile spi_dev_t *)(DR_REG_SPI3_BASE), 2, -1, -1, -1, -1, false}
|
|
||||||
#elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4
|
|
||||||
{(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1, false},
|
{(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1, false},
|
||||||
{(volatile spi_dev_t *)(DR_REG_SPI3_BASE), 1, -1, -1, -1, -1, false}
|
{(volatile spi_dev_t *)(DR_REG_SPI3_BASE), 1, -1, -1, -1, -1, false}
|
||||||
#elif CONFIG_IDF_TARGET_ESP32C2
|
#elif CONFIG_IDF_TARGET_ESP32C2
|
||||||
|
|
@ -184,11 +179,7 @@ static spi_t _spi_bus_array[] = {
|
||||||
#define SPI_MUTEX_UNLOCK() xSemaphoreGive(spi->lock)
|
#define SPI_MUTEX_UNLOCK() xSemaphoreGive(spi->lock)
|
||||||
|
|
||||||
static spi_t _spi_bus_array[] = {
|
static spi_t _spi_bus_array[] = {
|
||||||
#if CONFIG_IDF_TARGET_ESP32S2
|
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4
|
||||||
{(volatile spi_dev_t *)(DR_REG_SPI1_BASE), NULL, 0, -1, -1, -1, -1, false},
|
|
||||||
{(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 1, -1, -1, -1, -1, false},
|
|
||||||
{(volatile spi_dev_t *)(DR_REG_SPI3_BASE), NULL, 2, -1, -1, -1, -1, false}
|
|
||||||
#elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4
|
|
||||||
{(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1, false}, {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), NULL, 1, -1, -1, -1, -1, false}
|
{(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1, false}, {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), NULL, 1, -1, -1, -1, -1, false}
|
||||||
#elif CONFIG_IDF_TARGET_ESP32C2
|
#elif CONFIG_IDF_TARGET_ESP32C2
|
||||||
{(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1, false}
|
{(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1, false}
|
||||||
|
|
@ -626,6 +617,7 @@ void spiStopBus(spi_t *spi) {
|
||||||
|
|
||||||
spi_t *spiStartBus(uint8_t spi_num, uint32_t clockDiv, uint8_t dataMode, uint8_t bitOrder) {
|
spi_t *spiStartBus(uint8_t spi_num, uint32_t clockDiv, uint8_t dataMode, uint8_t bitOrder) {
|
||||||
if (spi_num >= SPI_COUNT) {
|
if (spi_num >= SPI_COUNT) {
|
||||||
|
log_e("SPI bus index %d is out of range", spi_num);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,19 +27,13 @@ extern "C" {
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define SPI_HAS_TRANSACTION
|
#define SPI_HAS_TRANSACTION
|
||||||
|
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP32S2
|
|
||||||
#define FSPI 1 //SPI 1 bus. ESP32S2: for external memory only (can use the same data lines but different SS)
|
|
||||||
#define HSPI 2 //SPI 2 bus. ESP32S2: external memory or device - it can be matrixed to any pins
|
|
||||||
#define SPI2 2 // Another name for ESP32S2 SPI 2
|
|
||||||
#define SPI3 3 //SPI 3 bus. ESP32S2: device only - it can be matrixed to any pins
|
|
||||||
#elif CONFIG_IDF_TARGET_ESP32
|
|
||||||
#define FSPI 1 //SPI 1 bus attached to the flash (can use the same data lines but different SS)
|
#define FSPI 1 //SPI 1 bus attached to the flash (can use the same data lines but different SS)
|
||||||
#define HSPI 2 //SPI 2 bus normally mapped to pins 12 - 15, but can be matrixed to any pins
|
#define HSPI 2 //SPI 2 bus normally mapped to pins 12 - 15, but can be matrixed to any pins
|
||||||
#define VSPI 3 //SPI 3 bus normally attached to pins 5, 18, 19 and 23, but can be matrixed to any pins
|
#define VSPI 3 //SPI 3 bus normally attached to pins 5, 18, 19 and 23, but can be matrixed to any pins
|
||||||
#else
|
#else
|
||||||
#define FSPI 0 // ESP32C2, C3, C6, H2, S3, P4 - SPI 2 bus
|
#define FSPI 0 // ESP32C2, C3, C6, H2, S2, S3, P4 - SPI 2 bus
|
||||||
#define HSPI 1 // ESP32S3, P4 - SPI 3 bus
|
#define HSPI 1 // ESP32S2, S3, P4 - SPI 3 bus
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This defines are not representing the real Divider of the ESP32
|
// This defines are not representing the real Divider of the ESP32
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,12 @@
|
||||||
|
|
||||||
from esp_docs.conf_docs import * # noqa: F403,F401
|
from esp_docs.conf_docs import * # noqa: F403,F401
|
||||||
|
|
||||||
|
# Used for substituting variables in the documentation
|
||||||
|
rst_prolog = """
|
||||||
|
.. |version| replace:: 3.2.0
|
||||||
|
.. |idf_version| replace:: 5.4
|
||||||
|
"""
|
||||||
|
|
||||||
languages = ["en"]
|
languages = ["en"]
|
||||||
|
|
||||||
# idf_targets = [
|
# idf_targets = [
|
||||||
|
|
@ -27,6 +33,7 @@ html_static_path = ["../_static"]
|
||||||
extensions += [ # noqa: F405
|
extensions += [ # noqa: F405
|
||||||
"sphinx_copybutton",
|
"sphinx_copybutton",
|
||||||
"sphinx_tabs.tabs",
|
"sphinx_tabs.tabs",
|
||||||
|
"sphinx_substitution_extensions", # For allowing substitutions inside code blocks
|
||||||
"esp_docs.esp_extensions.dummy_build_system",
|
"esp_docs.esp_extensions.dummy_build_system",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ Documentation
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
If you are contributing to the documentation, please follow the instructions described in the
|
If you are contributing to the documentation, please follow the instructions described in the
|
||||||
`documentation guidelines <guides/docs_contributing>`_ to properly format and test your changes.
|
`documentation guidelines <guides/docs_contributing.html>`_ to properly format and test your changes.
|
||||||
|
|
||||||
Testing and CI
|
Testing and CI
|
||||||
--------------
|
--------------
|
||||||
|
|
@ -435,7 +435,7 @@ Documentation Checks
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The CI also checks the documentation for any compilation errors. This is important to ensure that the documentation layout is not broken.
|
The CI also checks the documentation for any compilation errors. This is important to ensure that the documentation layout is not broken.
|
||||||
To build the documentation locally, please refer to the `documentation guidelines <guides/docs_contributing>`_.
|
To build the documentation locally, please refer to the `documentation guidelines <guides/docs_contributing.html>`_.
|
||||||
|
|
||||||
Code Style Checks
|
Code Style Checks
|
||||||
^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ For a simplified method, see `Installing using Boards Manager <https://docs.espr
|
||||||
If you plan to use these modified settings multiple times, for different projects and targets, you can recompile the Arduino core with the new settings using the Arduino Static Library Builder.
|
If you plan to use these modified settings multiple times, for different projects and targets, you can recompile the Arduino core with the new settings using the Arduino Static Library Builder.
|
||||||
For more information, see the `Lib Builder documentation <lib_builder.html>`_.
|
For more information, see the `Lib Builder documentation <lib_builder.html>`_.
|
||||||
|
|
||||||
.. note:: Latest Arduino Core ESP32 version (3.0.X) is now compatible with `ESP-IDF v5.1 <https://github.com/espressif/esp-idf/tree/release/v5.1>`_. Please consider this compatibility when using Arduino as a component in ESP-IDF.
|
.. note:: Latest Arduino Core ESP32 version (|version|) is now compatible with ESP-IDF v\ |idf_version|\ . Please consider this compatibility when using Arduino as a component in ESP-IDF.
|
||||||
|
|
||||||
For easiest use of Arduino framework as a ESP-IDF component, you can use the `IDF Component Manager <https://docs.espressif.com/projects/esp-idf/en/v5.1.4/esp32/api-guides/tools/idf-component-manager.html>`_ to add the Arduino component to your project.
|
For easiest use of Arduino framework as a ESP-IDF component, you can use the `IDF Component Manager <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-component-manager.html>`_ to add the Arduino component to your project.
|
||||||
This will automatically clone the repository and its submodules. You can find the Arduino component in the `ESP Registry <https://components.espressif.com/components/espressif/arduino-esp32>`_ together with dependencies list and examples.
|
This will automatically clone the repository and its submodules. You can find the Arduino component in the `ESP Registry <https://components.espressif.com/components/espressif/arduino-esp32>`_ together with dependencies list and examples.
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
|
|
@ -32,14 +32,16 @@ Installing using IDF Component Manager
|
||||||
To add the Arduino component to your project using the IDF Component Manager, run the following command in your project directory:
|
To add the Arduino component to your project using the IDF Component Manager, run the following command in your project directory:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
:substitutions:
|
||||||
|
|
||||||
idf.py add-dependency "espressif/arduino-esp32^3.0.2"
|
idf.py add-dependency "espressif/arduino-esp32^|version|"
|
||||||
|
|
||||||
Or you can start a new project from a template with the Arduino component:
|
Or you can start a new project from a template with the Arduino component:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
:substitutions:
|
||||||
|
|
||||||
idf.py create-project-from-example "espressif/arduino-esp32^3.0.2:hello_world"
|
idf.py create-project-from-example "espressif/arduino-esp32^|version|:hello_world"
|
||||||
|
|
||||||
Manual installation of Arduino framework
|
Manual installation of Arduino framework
|
||||||
****************************************
|
****************************************
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,11 @@ Before starting your collaboration, you need to get the documentation source cod
|
||||||
Requirements
|
Requirements
|
||||||
************
|
************
|
||||||
|
|
||||||
To properly work with the documentation, you need to install some packages in your system.
|
To build the documentation properly, you need to install some packages in your system. Note that depending on
|
||||||
|
your system, you may need to use a virtual environment to install the packages.
|
||||||
|
|
||||||
.. code-block::
|
.. code-block::
|
||||||
|
|
||||||
pip install -U Sphinx
|
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
The requirements file is under the ``docs`` folder.
|
The requirements file is under the ``docs`` folder.
|
||||||
|
|
@ -62,17 +62,14 @@ Using Visual Studio Code
|
||||||
************************
|
************************
|
||||||
|
|
||||||
If you are using the Visual Studio Code, you can install some extensions to help you while writing documentation.
|
If you are using the Visual Studio Code, you can install some extensions to help you while writing documentation.
|
||||||
|
For reStructuredText, you can install the `reStructuredText Pack <https://marketplace.visualstudio.com/items?itemName=lextudio.restructuredtext-pack>`_ extension.
|
||||||
|
|
||||||
`reStructuredText Pack <https://marketplace.visualstudio.com/items?itemName=lextudio.restructuredtext-pack>`_
|
We also recommend you to install some grammar check extension to help you to review English grammar.
|
||||||
|
|
||||||
We also recommend you install to grammar check extension to help you to review English grammar.
|
|
||||||
|
|
||||||
`Grammarly <https://marketplace.visualstudio.com/items?itemName=znck.grammarly>`_
|
|
||||||
|
|
||||||
Building
|
Building
|
||||||
********
|
********
|
||||||
|
|
||||||
To build the documentation and generate the HTML files, you can use the following command inside the ``docs`` folder. After a successful build, you can check the files inside the `_build/en/generic/html` folder.
|
To build the documentation and generate the HTML files, you can use the following command inside the ``docs`` folder. After a successful build, you can check the files inside the ``_build/en/generic/html`` folder.
|
||||||
|
|
||||||
.. code-block::
|
.. code-block::
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ Welcome to ESP32 Arduino Core's documentation
|
||||||
#############################################
|
#############################################
|
||||||
|
|
||||||
Here you will find all the relevant information about the project.
|
Here you will find all the relevant information about the project.
|
||||||
|
This documentation is valid for the Arduino Core for ESP32 version |version| based on ESP-IDF |idf_version|.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
This is a work in progress documentation and we will appreciate your help! We are looking for contributors!
|
This is a work in progress documentation and we will appreciate your help! We are looking for contributors!
|
||||||
|
|
|
||||||
|
|
@ -293,8 +293,9 @@ You have two options to run the Docker image to build the libraries. Manually or
|
||||||
To run the Docker image manually, use the following command from the root of the ``arduino-esp32`` repository:
|
To run the Docker image manually, use the following command from the root of the ``arduino-esp32`` repository:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
:substitutions:
|
||||||
|
|
||||||
docker run --rm -it -v $PWD:/arduino-esp32 -e TERM=xterm-256color espressif/esp32-arduino-lib-builder:release-v5.1
|
docker run --rm -it -v $PWD:/arduino-esp32 -e TERM=xterm-256color espressif/esp32-arduino-lib-builder:release-v|idf_version|
|
||||||
|
|
||||||
This will start the Lib Builder UI for compiling the libraries. The above command explained:
|
This will start the Lib Builder UI for compiling the libraries. The above command explained:
|
||||||
|
|
||||||
|
|
@ -304,7 +305,7 @@ This will start the Lib Builder UI for compiling the libraries. The above comman
|
||||||
- ``-t`` Allocate a pseudo-TTY;
|
- ``-t`` Allocate a pseudo-TTY;
|
||||||
- ``-e TERM=xterm-256color``: Optional. Sets the terminal type to ``xterm-256color`` to display colors correctly;
|
- ``-e TERM=xterm-256color``: Optional. Sets the terminal type to ``xterm-256color`` to display colors correctly;
|
||||||
- ``-v $PWD:/arduino-esp32``: Optional. Mounts the current folder at ``/arduino-esp32`` inside the container. If not provided, the container will not copy the compiled libraries to the host machine;
|
- ``-v $PWD:/arduino-esp32``: Optional. Mounts the current folder at ``/arduino-esp32`` inside the container. If not provided, the container will not copy the compiled libraries to the host machine;
|
||||||
- ``espressif/esp32-arduino-lib-builder:release-v5.1``: uses Docker image ``espressif/esp32-arduino-lib-builder`` with tag ``release-v5.1``.
|
- :substitution-code:`espressif/esp32-arduino-lib-builder:release-v|idf_version|`: uses Docker image ``espressif/esp32-arduino-lib-builder`` with tag :substitution-code:`release-v|idf_version|`.
|
||||||
The ``latest`` tag is implicitly added by Docker when no tag is specified. It is recommended to use a specific version tag to ensure reproducibility of the build process.
|
The ``latest`` tag is implicitly added by Docker when no tag is specified. It is recommended to use a specific version tag to ensure reproducibility of the build process.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
@ -324,24 +325,27 @@ By default the docker container will run the user interface script. If you want
|
||||||
For example, to run a terminal inside the container, you can run:
|
For example, to run a terminal inside the container, you can run:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
:substitutions:
|
||||||
|
|
||||||
docker run -it espressif/esp32-arduino-lib-builder:release-v5.1 /bin/bash
|
docker run -it espressif/esp32-arduino-lib-builder:release-v|idf_version| /bin/bash
|
||||||
|
|
||||||
Running the Docker image using the provided run script will depend on the host OS.
|
Running the Docker image using the provided run script will depend on the host OS.
|
||||||
Use the following command from the root of the ``arduino-esp32`` repository to execute the image in a Linux or macOS environment for
|
Use the following command from the root of the ``arduino-esp32`` repository to execute the image in a Linux or macOS environment for
|
||||||
the ``release-v5.1`` tag:
|
the :substitution-code:`release-v|idf_version|` tag:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
:substitutions:
|
||||||
|
|
||||||
curl -LJO https://raw.githubusercontent.com/espressif/esp32-arduino-lib-builder/refs/heads/release/v5.1/tools/docker/run.sh
|
curl -LJO https://raw.githubusercontent.com/espressif/esp32-arduino-lib-builder/refs/heads/release/v|idf_version|/tools/docker/run.sh
|
||||||
chmod +x run.sh
|
chmod +x run.sh
|
||||||
./run.sh $PWD
|
./run.sh $PWD
|
||||||
|
|
||||||
For Windows, use the following command in PowerShell from the root of the ``arduino-esp32`` repository:
|
For Windows, use the following command in PowerShell from the root of the ``arduino-esp32`` repository:
|
||||||
|
|
||||||
.. code-block:: powershell
|
.. code-block:: powershell
|
||||||
|
:substitutions:
|
||||||
|
|
||||||
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/espressif/esp32-arduino-lib-builder/refs/heads/release/v5.1/tools/docker/run.ps1" -OutFile "run.ps1"
|
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/espressif/esp32-arduino-lib-builder/refs/heads/release/v|idf_version|/tools/docker/run.ps1" -OutFile "run.ps1"
|
||||||
.\run.ps1 $pwd
|
.\run.ps1 $pwd
|
||||||
|
|
||||||
As the script is unsigned, you may need to change the execution policy of the current session before running the script.
|
As the script is unsigned, you may need to change the execution policy of the current session before running the script.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
|
sphinx==4.5.0
|
||||||
esp-docs>=1.4.0
|
esp-docs>=1.4.0
|
||||||
sphinx-copybutton==0.5.0
|
sphinx-copybutton==0.5.0
|
||||||
sphinx-tabs==3.2.0
|
sphinx-tabs==3.2.0
|
||||||
numpydoc==1.5.0
|
numpydoc==1.5.0
|
||||||
standard-imghdr==3.13.0
|
standard-imghdr==3.13.0
|
||||||
|
Sphinx-Substitution-Extensions==2022.2.16
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,9 @@ bool SDFS::begin(uint8_t ssPin, SPIClass &spi, uint32_t frequency, const char *m
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
spi.begin();
|
if (!spi.begin()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
_pdrv = sdcard_init(ssPin, &spi, frequency);
|
_pdrv = sdcard_init(ssPin, &spi, frequency);
|
||||||
if (_pdrv == 0xFF) {
|
if (_pdrv == 0xFF) {
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ bool SPIClass::begin(int8_t sck, int8_t miso, int8_t mosi, int8_t ss) {
|
||||||
|
|
||||||
_spi = spiStartBus(_spi_num, _div, SPI_MODE0, SPI_MSBFIRST);
|
_spi = spiStartBus(_spi_num, _div, SPI_MODE0, SPI_MSBFIRST);
|
||||||
if (!_spi) {
|
if (!_spi) {
|
||||||
|
log_e("SPI bus %d start failed.", _spi_num);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,139 @@
|
||||||
|
#include <Arduino.h>
|
||||||
#include <Preferences.h>
|
#include <Preferences.h>
|
||||||
|
|
||||||
|
struct TestData {
|
||||||
|
uint8_t id;
|
||||||
|
uint16_t value;
|
||||||
|
};
|
||||||
|
|
||||||
Preferences preferences;
|
Preferences preferences;
|
||||||
|
|
||||||
|
void validate_types() {
|
||||||
|
assert(preferences.getType("char") == PT_I8);
|
||||||
|
assert(preferences.getType("uchar") == PT_U8);
|
||||||
|
assert(preferences.getType("short") == PT_I16);
|
||||||
|
assert(preferences.getType("ushort") == PT_U16);
|
||||||
|
assert(preferences.getType("int") == PT_I32);
|
||||||
|
assert(preferences.getType("uint") == PT_U32);
|
||||||
|
assert(preferences.getType("long") == PT_I32);
|
||||||
|
assert(preferences.getType("ulong") == PT_U32);
|
||||||
|
assert(preferences.getType("long64") == PT_I64);
|
||||||
|
assert(preferences.getType("ulong64") == PT_U64);
|
||||||
|
assert(preferences.getType("float") == PT_BLOB);
|
||||||
|
assert(preferences.getType("double") == PT_BLOB);
|
||||||
|
assert(preferences.getType("bool") == PT_U8);
|
||||||
|
assert(preferences.getType("str") == PT_STR);
|
||||||
|
assert(preferences.getType("strLen") == PT_STR);
|
||||||
|
assert(preferences.getType("struct") == PT_BLOB);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to increment string values
|
||||||
|
void incrementStringValues(String &val_string, char *val_string_buf, size_t buf_size) {
|
||||||
|
// Extract the number from string and increment it
|
||||||
|
val_string = "str" + String(val_string.substring(3).toInt() + 1);
|
||||||
|
|
||||||
|
// Extract the number from strLen and increment it
|
||||||
|
String strLen_str = String(val_string_buf);
|
||||||
|
int strLen_num = strLen_str.substring(6).toInt();
|
||||||
|
snprintf(val_string_buf, buf_size, "strLen%d", strLen_num + 1);
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
while (!Serial) {
|
while (!Serial) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
preferences.begin("my-app", false);
|
preferences.begin("my-app", false);
|
||||||
|
|
||||||
// Get the counter value, if the key does not exist, return a default value of 0
|
// Get the preferences value and if not exists, use default parameter
|
||||||
unsigned int counter = preferences.getUInt("counter", 0);
|
char val_char = preferences.getChar("char", 'A');
|
||||||
|
unsigned char val_uchar = preferences.getUChar("uchar", 0);
|
||||||
|
int16_t val_short = preferences.getShort("short", 0);
|
||||||
|
uint16_t val_ushort = preferences.getUShort("ushort", 0);
|
||||||
|
int32_t val_int = preferences.getInt("int", 0);
|
||||||
|
uint32_t val_uint = preferences.getUInt("uint", 0);
|
||||||
|
int64_t val_long = preferences.getLong("long", 0);
|
||||||
|
uint32_t val_ulong = preferences.getULong("ulong", 0);
|
||||||
|
int64_t val_long64 = preferences.getLong64("long64", 0);
|
||||||
|
uint64_t val_ulong64 = preferences.getULong64("ulong64", 0);
|
||||||
|
float val_float = preferences.getFloat("float", 0.0f);
|
||||||
|
double val_double = preferences.getDouble("double", 0.0);
|
||||||
|
bool val_bool = preferences.getBool("bool", false);
|
||||||
|
|
||||||
// Print the counter to Serial Monitor
|
// Strings
|
||||||
Serial.printf("Current counter value: %u\n", counter);
|
String val_string = preferences.getString("str", "str0");
|
||||||
|
char val_string_buf[20] = "strLen0";
|
||||||
|
preferences.getString("strLen", val_string_buf, sizeof(val_string_buf));
|
||||||
|
|
||||||
// Increase counter by 1
|
// Structure data
|
||||||
counter++;
|
TestData test_data = {0, 0};
|
||||||
|
|
||||||
// Store the counter to the Preferences
|
size_t struct_size = preferences.getBytes("struct", &test_data, sizeof(test_data));
|
||||||
preferences.putUInt("counter", counter);
|
if (struct_size == 0) {
|
||||||
|
// First time - set initial values using parameter names
|
||||||
|
test_data.id = 1;
|
||||||
|
test_data.value = 100;
|
||||||
|
}
|
||||||
|
|
||||||
// Close the Preferences
|
Serial.printf("Values from Preferences: ");
|
||||||
|
Serial.printf("char: %c | uchar: %u | short: %d | ushort: %u | int: %ld | uint: %lu | ", val_char, val_uchar, val_short, val_ushort, val_int, val_uint);
|
||||||
|
Serial.printf("long: %lld | ulong: %lu | long64: %lld | ulong64: %llu | ", val_long, val_ulong, val_long64, val_ulong64);
|
||||||
|
Serial.printf(
|
||||||
|
"float: %.2f | double: %.2f | bool: %s | str: %s | strLen: %s | struct: {id:%u,val:%u}\n", val_float, val_double, val_bool ? "true" : "false",
|
||||||
|
val_string.c_str(), val_string_buf, test_data.id, test_data.value
|
||||||
|
);
|
||||||
|
|
||||||
|
// Increment the values
|
||||||
|
val_char += 1; // Increment char A -> B
|
||||||
|
val_uchar += 1;
|
||||||
|
val_short += 1;
|
||||||
|
val_ushort += 1;
|
||||||
|
val_int += 1;
|
||||||
|
val_uint += 1;
|
||||||
|
val_long += 1;
|
||||||
|
val_ulong += 1;
|
||||||
|
val_long64 += 1;
|
||||||
|
val_ulong64 += 1;
|
||||||
|
val_float += 1.1f;
|
||||||
|
val_double += 1.1;
|
||||||
|
val_bool = !val_bool; // Toggle boolean value
|
||||||
|
|
||||||
|
// Increment string values using function
|
||||||
|
incrementStringValues(val_string, val_string_buf, sizeof(val_string_buf));
|
||||||
|
|
||||||
|
test_data.id += 1;
|
||||||
|
test_data.value += 10;
|
||||||
|
|
||||||
|
// Store the updated values back to Preferences
|
||||||
|
preferences.putChar("char", val_char);
|
||||||
|
preferences.putUChar("uchar", val_uchar);
|
||||||
|
preferences.putShort("short", val_short);
|
||||||
|
preferences.putUShort("ushort", val_ushort);
|
||||||
|
preferences.putInt("int", val_int);
|
||||||
|
preferences.putUInt("uint", val_uint);
|
||||||
|
preferences.putLong("long", val_long);
|
||||||
|
preferences.putULong("ulong", val_ulong);
|
||||||
|
preferences.putLong64("long64", val_long64);
|
||||||
|
preferences.putULong64("ulong64", val_ulong64);
|
||||||
|
preferences.putFloat("float", val_float);
|
||||||
|
preferences.putDouble("double", val_double);
|
||||||
|
preferences.putBool("bool", val_bool);
|
||||||
|
preferences.putString("str", val_string);
|
||||||
|
preferences.putString("strLen", val_string_buf);
|
||||||
|
preferences.putBytes("struct", &test_data, sizeof(test_data));
|
||||||
|
|
||||||
|
// Check if the keys exist
|
||||||
|
assert(preferences.isKey("char"));
|
||||||
|
assert(preferences.isKey("struct"));
|
||||||
|
|
||||||
|
// Validate the types of the keys
|
||||||
|
validate_types();
|
||||||
|
|
||||||
|
// Close the Preferences, wait and restart
|
||||||
preferences.end();
|
preferences.end();
|
||||||
|
Serial.flush();
|
||||||
// Wait 1 second
|
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
|
||||||
// Restart ESP
|
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,23 @@ import logging
|
||||||
def test_nvs(dut):
|
def test_nvs(dut):
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
LOGGER.info("Expecting counter value 0")
|
LOGGER.info("Expecting default values from Preferences")
|
||||||
dut.expect_exact("Current counter value: 0")
|
dut.expect_exact(
|
||||||
|
"Values from Preferences: char: A | uchar: 0 | short: 0 | ushort: 0 | int: 0 | uint: 0 | long: 0 | ulong: 0 | "
|
||||||
|
"long64: 0 | ulong64: 0 | float: 0.00 | double: 0.00 | bool: false | str: str0 | strLen: strLen0 | "
|
||||||
|
"struct: {id:1,val:100}"
|
||||||
|
)
|
||||||
|
|
||||||
LOGGER.info("Expecting counter value 1")
|
LOGGER.info("Expecting updated preferences for the first time")
|
||||||
dut.expect_exact("Current counter value: 1")
|
dut.expect_exact(
|
||||||
|
"Values from Preferences: char: B | uchar: 1 | short: 1 | ushort: 1 | int: 1 | uint: 1 | long: 1 | ulong: 1 | "
|
||||||
|
"long64: 1 | ulong64: 1 | float: 1.10 | double: 1.10 | bool: true | str: str1 | strLen: strLen1 | "
|
||||||
|
"struct: {id:2,val:110}"
|
||||||
|
)
|
||||||
|
|
||||||
LOGGER.info("Expecting counter value 2")
|
LOGGER.info("Expecting updated preferences for the second time")
|
||||||
dut.expect_exact("Current counter value: 2")
|
dut.expect_exact(
|
||||||
|
"Values from Preferences: char: C | uchar: 2 | short: 2 | ushort: 2 | int: 2 | uint: 2 | long: 2 | ulong: 2 | "
|
||||||
|
"long64: 2 | ulong64: 2 | float: 2.20 | double: 2.20 | bool: false | str: str2 | strLen: strLen2 | "
|
||||||
|
"struct: {id:3,val:120}"
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue