This is the repository for some c++ components developed for the
ESP-IDF framework. Specifically we are
targeting ESP-IDF 5.4 currently.
NOTE: This repo attempts to stay up to date with ESP-IDF. This means that the code within may not be supported on older ESP-IDF targets.
Each component has an example folder which contains c++ code showing how to
use the component and which has a README including instructions for how to run
the example
If you have questions or would like to chat, feel free to hop over to our discord!
Table of Contents
The components in this repository are targeted towards ESP-IDF >=5.0, though they are mainly tested against 5.4 right now.
To use the components in this repository, you have a few options:
-
You can use the esp-cppp/template repository as a starting point, which is very similar to the esp-idf template, but is geared towards c++ development and already has
esppas a submodule, along with the appropriate configuration in the top-level CMakeLists.txt. -
You can add dependencies on the components you want using the
idf component manager. Allesppcomponents are published to the ESP Component Registry under the namespaceespp.For example, if you want to use the
taskcomponent and theble_gatt_servercomponents, you could run:idf.py add-dependency "espp/task^1.0" idf.py add-dependency "espp/ble_gatt_server^1.0"
Alternatively, you could add the following dependencies to your
main/idf_component.yml:dependencies: esp-cpp/ble_gatt_server: '>=1.0' esp-cpp/task: '>=1.0' # other dependencies here...
-
If you have an existing project with a
componentsdirectory, then you can cloneesppas a submodule within that directory e.g.git submodule add https://github.com/esp-cpp/espp components/espp, then make sure to rungit submodule update --init --recursive. Afterwards, simply update yourCMakeLists.txtto add# add the component directories that we want to use set(EXTRA_COMPONENT_DIRS "components/espp/components" )
-
You can clone espp somewhere on your computer and then point your project to its
componentsdirectory to use any of the components it contains, similar to the step above.
- Documentation - github hosted version of
the documentation found in ./docs. This documentation is
automatically built as part of the CI, but can be locally built for
validation by running ./build_docs.sh. NOTE: to ensure
proper build environments, the local documentation build relies on docker, so
you'll need to run
docker build -t esp-docs doconce before runningbuild_docs.sh. This is only required if you want to build the documentation locally.
Many components in this repo contain example code (referenced in the
documentation above) that shows some basic usage. This example code can be found
in that component's example directory. NOTE: many component examples also make
use of other components (esp. some of the foundational components such as
format, logger, and task.
The esp-cpp github organization contains other repositories that build specific demonstrations with these (and other) components.
One such example is the esp-box-emu repository, which builds upon these components to create a multiplatform emulation system using the ESP32-S3-BOX hardware.
If you plan to develop espp components, then it is recommended to configure your development environment:
- Ensure
clang-formatis installed - Ensure pre-commit is installed
- Set up
pre-commitfor this repository:
pre-commit installThis helps ensure that consistent code formatting is applied.
If you wish to build the documentation, you should have docker installed, then you can run
docker build -t esp-docs docTo build the docker container which you will use to build the documentation locally (for testing).
Thereafter, you can use the included build script to build the documentation locally.
./build_docs.sh