Skip to content

Files

Latest commit

e7e2653 · May 1, 2019

History

History

cpp_utils

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Oct 14, 2018
Jan 1, 2018
Feb 8, 2019
Sep 10, 2017
Aug 6, 2018
Aug 6, 2018
Oct 14, 2018
Oct 22, 2017
Nov 25, 2017
Oct 15, 2017
Oct 14, 2018
Jul 29, 2017
Oct 14, 2018
Dec 25, 2017
Oct 14, 2018
Jul 29, 2017
Jan 22, 2019
Jan 30, 2019
Jan 22, 2019
Nov 19, 2018
Jan 22, 2019
Oct 14, 2018
Feb 8, 2019
Jan 30, 2019
Oct 15, 2018
Jan 30, 2019
Jan 30, 2019
Jan 22, 2019
Nov 19, 2018
Nov 19, 2018
Jan 30, 2019
Jan 30, 2019
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Nov 28, 2017
Oct 14, 2018
Feb 12, 2019
Oct 14, 2018
Jan 30, 2019
Jan 30, 2019
Jan 22, 2019
Nov 28, 2017
Jan 22, 2019
Nov 17, 2018
Jan 22, 2019
Nov 27, 2018
Jan 30, 2019
Jan 30, 2019
Jan 30, 2019
Jan 30, 2019
Jan 22, 2019
Nov 14, 2018
Nov 17, 2018
Jan 22, 2019
Nov 14, 2018
Jan 17, 2019
Oct 14, 2018
Jan 22, 2019
Oct 14, 2018
Dec 25, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Nov 1, 2017
Sep 10, 2017
Sep 10, 2017
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 18, 2018
Oct 14, 2018
Oct 14, 2018
Sep 19, 2017
May 1, 2019
Oct 15, 2018
Oct 14, 2018
Oct 14, 2018
Oct 15, 2018
Oct 14, 2018
Jan 22, 2019
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 15, 2018
Oct 15, 2018
Oct 14, 2018
Oct 14, 2018
Oct 15, 2018
Oct 15, 2018
Oct 14, 2018
Jul 29, 2017
Oct 14, 2018
May 22, 2017
Oct 14, 2018
Oct 14, 2018
May 22, 2017
Oct 14, 2018
Oct 14, 2018
Nov 11, 2018
Oct 14, 2018
Oct 14, 2018
Dec 7, 2018
Aug 6, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 15, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Dec 21, 2018
Oct 15, 2018
Oct 15, 2018
Oct 15, 2018
Oct 15, 2018
Oct 14, 2018
Oct 15, 2018
Oct 15, 2018
Aug 13, 2017
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
May 22, 2017
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Sep 17, 2017
Oct 14, 2018
Oct 14, 2018
Oct 18, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 15, 2018
Oct 14, 2018
Oct 18, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
May 22, 2017
Oct 14, 2018
Oct 18, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 15, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 14, 2018
Oct 5, 2017
Sep 12, 2017
Oct 14, 2018

CPP Utils

This directory contains a wealth of C++ classes that have been found useful when working in C++ in conjunction with the ESP-IDF. The classes have been documented using doxygen so one can run a doxygen processor over them to create the user guides and programming references.

Compiling the C++ classes

The C++ classes found here exist as an ESP-IDF component. To build the classes and then use them in your project perform the following steps:

  1. Create an ESP-IDF project.
  2. Create a directory called components in the root of your ESP-IDF project.
  3. Copy this directory (cpp_utils) into your new components directory. The result will be <project>/components/cpp_utils/<files>.
  4. In your ESP-IDF project build as normal.

The C++ classes will be compiled and available to be used in your own code.

Adding a main function

When working with C++, your calling function should also be written in C++. Consider replacing your main.c with the following main.cpp file:

extern "C" {
   void app_main();
}

void app_main() {
   // Your code goes here
}

The way to read the above is that we are defining a global function called app_main but we are saying that its external linkage (i.e. how it is found and called) is using the C language convention. However, since the source file is main.cpp and hence compiled by the C++ compiler, you can utilize C++ classes and language features within and, since it has C linkage, it will satisfy the ESP-IDF environment as the entry point into your own code.

BLE Functions

The Bluetooth BLE functions are only compiled if Bluetooth is enabled in make menuconfig. This is primarily because the ESP-IDF build system has chosen to only compile the underlying BLE functions if Bluetooth is enabled.

Building the Documentation

The code is commented using the Doxygen tags. As such we can run Doxygen to generate the data. I use doxywizard using the Doxyfile located in this directory.

Building the Arduino libraries

Some of the classes in this package also have applicability in an Arduino environment. A Makefile called Makefile.arduino is provided to build the libraries. For example:

$ make -f Makefile.arduino

The results of this will be ZIP files found in the Arduino directory relative to this one. Targets include: