lv_coord_t: use typdef in lv_conf.h

This commit is contained in:
Gabor Kiss-Vamosi
2019-06-07 00:08:48 +02:00
parent f2ca0b15f3
commit 5cc1548b83
3 changed files with 8 additions and 9 deletions
+3 -1
View File
@@ -13,6 +13,8 @@
#define LV_CONF_H #define LV_CONF_H
/* clang-format off */ /* clang-format off */
#include <stdint.h>
/*==================== /*====================
Graphical settings Graphical settings
*====================*/ *====================*/
@@ -54,7 +56,7 @@
#define LV_DPI 100 /*[px]*/ #define LV_DPI 100 /*[px]*/
/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */ /* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
#define LV_COORD_T int32_t typedef int16_t lv_coord_t;
/*========================= /*=========================
Memory manager settings Memory manager settings
+2 -3
View File
@@ -8,6 +8,8 @@
#define LV_CONF_CHECKER_H #define LV_CONF_CHECKER_H
/* clang-format off */ /* clang-format off */
#include <stdint.h>
/*==================== /*====================
Graphical settings Graphical settings
*====================*/ *====================*/
@@ -67,9 +69,6 @@
#endif #endif
/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */ /* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
#ifndef LV_COORD_T
#define LV_COORD_T int32_t
#endif
/*========================= /*=========================
Memory manager settings Memory manager settings
+3 -5
View File
@@ -25,11 +25,13 @@ extern "C" {
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
/*To avoid overflow don't let the max ranges (reduce with 1000) */
#define LV_COORD_MAX ((lv_coord_t)((uint32_t)((uint32_t)1 << (8 * sizeof(lv_coord_t) - 1)) - 1000))
#define LV_COORD_MIN (-LV_COORD_MAX)
/********************** /**********************
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
typedef LV_COORD_T lv_coord_t;
typedef struct typedef struct
{ {
@@ -163,10 +165,6 @@ bool lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p);
* MACROS * MACROS
**********************/ **********************/
/*To avoid overflow don't let the max ranges (reduce with 1000) */
#define LV_COORD_MAX ((lv_coord_t)((uint32_t)((uint32_t)1 << (8 * sizeof(lv_coord_t) - 1)) - 1000))
#define LV_COORD_MIN (-LV_COORD_MAX)
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif