From bffa23c4b22f0f8c90a2603076e925ed55e26e56 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 26 Dec 2018 08:24:47 +0100 Subject: [PATCH] add LV_VERSION_CHECK --- lv_version.h | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++ lvgl.h | 8 ++----- 2 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 lv_version.h diff --git a/lv_version.h b/lv_version.h new file mode 100644 index 000000000..602c42332 --- /dev/null +++ b/lv_version.h @@ -0,0 +1,66 @@ +/** + * @file lv_version.h + * + */ + +#ifndef LV_VERSION_H +#define LV_VERSION_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +/*Current version of LittlevGL*/ +#define LVGL_VERSION_MAJOR 5 +#define LVGL_VERSION_MINOR 3 +#define LVGL_VERSION_PATCH 0 +#define LVGL_VERSION_INFO "dev" + + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ +/* Gives 1 if the x.y.z version is supported in the current version + * Usage: + * + * - Require v6 + * #if LV_VERSION_CHECK(6,0,0) + * new_func_in_v6(); + * #endif + * + * + * - Require at least v5.3 + * #if LV_VERSION_CHECK(5,3,0) + * new_feature_from_v5_3(); + * #endif + * + * + * - Require v5.3.2 bugfixes + * #if LV_VERSION_CHECK(5,3,2) + * bugfix_in_v5_3_2(); + * #endif + * + * */ +#define LV_VERSION_CHECK(x,y,z) (x == LVGL_VERSION_MAJOR && (y < LVGL_VERSION_MINOR || (y == LVGL_VERSION_MINOR && z <= LVGL_VERSION_PATCH))) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_VERSION_H*/ diff --git a/lvgl.h b/lvgl.h index 7e0792c48..209ce6bc2 100644 --- a/lvgl.h +++ b/lvgl.h @@ -14,7 +14,8 @@ extern "C" { * INCLUDES *********************/ -/*Test misc. module version*/ +#include "lv_version.h" + #include "lv_misc/lv_log.h" #include "lv_misc/lv_task.h" @@ -62,11 +63,6 @@ extern "C" { /********************* * DEFINES *********************/ -/*Current version of LittlevGL*/ -#define LVGL_VERSION_MAJOR 5 -#define LVGL_VERSION_MINOR 3 -#define LVGL_VERSION_PATCH 0 -#define LVGL_VERSION_INFO "dev" /********************** * TYPEDEFS