Skip to content

Commit 26d8964

Browse files
committed
Add error check macro.
1 parent 601489c commit 26d8964

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

include/i2c-lcd1602.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ typedef enum
100100
I2C_LCD1602_INDEX_CUSTOM_7, ///< Index of eighth user-defined custom symbol
101101
} i2c_lcd1602_custom_index_t;
102102

103+
#define I2C_LCD1602_ERROR_CHECK(x) do { \
104+
esp_err_t rc = (x); \
105+
if (rc != ESP_OK) { \
106+
ESP_LOGW(TAG, "I2C error %d at %s:%d", rc, __FILE__, __LINE__); \
107+
} \
108+
} while(0);
109+
103110
/**
104111
* @brief Construct a new I2C-LCD1602 info instance.
105112
* New instance should be initialised before calling other functions.

0 commit comments

Comments
 (0)