esp_idf_version.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2019 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /** Major version number (X.x.x) */
  19. #define ESP_IDF_VERSION_MAJOR 4
  20. /** Minor version number (x.X.x) */
  21. #define ESP_IDF_VERSION_MINOR 2
  22. /** Patch version number (x.x.X) */
  23. #define ESP_IDF_VERSION_PATCH 0
  24. /**
  25. * Macro to convert IDF version number into an integer
  26. *
  27. * To be used in comparisons, such as ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
  28. */
  29. #define ESP_IDF_VERSION_VAL(major, minor, patch) ((major << 16) | (minor << 8) | (patch))
  30. /**
  31. * Current IDF version, as an integer
  32. *
  33. * To be used in comparisons, such as ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
  34. */
  35. #define ESP_IDF_VERSION ESP_IDF_VERSION_VAL(ESP_IDF_VERSION_MAJOR, \
  36. ESP_IDF_VERSION_MINOR, \
  37. ESP_IDF_VERSION_PATCH)
  38. /**
  39. * Return full IDF version string, same as 'git describe' output.
  40. *
  41. * @note If you are printing the ESP-IDF version in a log file or other information,
  42. * this function provides more information than using the numerical version macros.
  43. * For example, numerical version macros don't differentiate between development,
  44. * pre-release and release versions, but the output of this function does.
  45. *
  46. * @return constant string from IDF_VER
  47. */
  48. const char* esp_get_idf_version(void);
  49. #ifdef __cplusplus
  50. }
  51. #endif