esp_common: add version definitions in code and build system
This commit is contained in:
@@ -109,10 +109,26 @@ SDK version
|
||||
|
||||
:cpp:func:`esp_get_idf_version` returns a string describing the IDF version which was used to compile the application. This is the same value as the one available through ``IDF_VER`` variable of the build system. The version string generally has the format of ``git describe`` output.
|
||||
|
||||
To get the version at build time, additional version macros are provided. They can be used to enable or disable parts of the program depending on IDF version.
|
||||
|
||||
* :c:macro:`ESP_IDF_VERSION_MAJOR`, :c:macro:`ESP_IDF_VERSION_MINOR`, :c:macro:`ESP_IDF_VERSION_PATCH` are defined to integers representing major, minor, and patch version.
|
||||
|
||||
* :c:macro:`ESP_IDF_VERSION_VAL` and :c:macro:`ESP_IDF_VERSION` can be used when implementing version checks:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
#include "esp_idf_version.h"
|
||||
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
|
||||
// enable functionality present in IDF v4.0
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
API Reference
|
||||
-------------
|
||||
|
||||
.. include:: /_build/inc/esp_system.inc
|
||||
.. include:: /_build/inc/esp_idf_version.inc
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user