acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
lv_assert.h (2017B)
1 /** 2 * @file lv_assert.h 3 * 4 */ 5 6 #ifndef LV_ASSERT_H 7 #define LV_ASSERT_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include "../lv_conf_internal.h" 17 #include "lv_log.h" 18 #include "lv_mem.h" 19 #include LV_ASSERT_HANDLER_INCLUDE 20 21 /********************* 22 * DEFINES 23 *********************/ 24 25 /********************** 26 * TYPEDEFS 27 **********************/ 28 29 /********************** 30 * GLOBAL PROTOTYPES 31 **********************/ 32 33 /********************** 34 * MACROS 35 **********************/ 36 37 #define LV_ASSERT(expr) \ 38 do { \ 39 if(!(expr)) { \ 40 LV_LOG_ERROR("Asserted at expression: %s", #expr); \ 41 LV_ASSERT_HANDLER \ 42 } \ 43 } while(0) 44 45 #define LV_ASSERT_MSG(expr, msg) \ 46 do { \ 47 if(!(expr)) { \ 48 LV_LOG_ERROR("Asserted at expression: %s (%s)", #expr, msg); \ 49 LV_ASSERT_HANDLER \ 50 } \ 51 } while(0) 52 53 /*----------------- 54 * ASSERTS 55 *-----------------*/ 56 57 #if LV_USE_ASSERT_NULL 58 # define LV_ASSERT_NULL(p) LV_ASSERT_MSG(p != NULL, "NULL pointer"); 59 #else 60 # define LV_ASSERT_NULL(p) 61 #endif 62 63 #if LV_USE_ASSERT_MALLOC 64 # define LV_ASSERT_MALLOC(p) LV_ASSERT_MSG(p != NULL, "Out of memory"); 65 #else 66 # define LV_ASSERT_MALLOC(p) 67 #endif 68 69 #if LV_USE_ASSERT_MEM_INTEGRITY 70 # define LV_ASSERT_MEM_INTEGRITY() LV_ASSERT_MSG(lv_mem_test() == LV_RES_OK, "Memory integrity error"); 71 #else 72 # define LV_ASSERT_MEM_INTEGRITY() 73 #endif 74 75 #ifdef __cplusplus 76 } /*extern "C"*/ 77 #endif 78 79 #endif /*LV_ASSERT_H*/