Files
squeezelite-esp32/components/services/tarablessd1306/ssd1306_err.h
philippe44 5a9df7b0d5 refactor display
- part of components
- separation between LMS & driver
- move slimp message to squeezelite
2020-01-18 16:19:06 -08:00

40 lines
940 B
C

#ifndef _SSD1306_ERR_H_
#define _SSD1306_ERR_H_
#include <esp_log.h>
#define SSD1306_DoAbort( )
#if ! defined NullCheck
#define NullCheck( ptr, retexpr ) { \
if ( ptr == NULL ) { \
ESP_LOGE( __FUNCTION__, "%s == NULL", #ptr ); \
SSD1306_DoAbort( ); \
retexpr; \
} \
}
#endif
#if ! defined ESP_ERROR_CHECK_NONFATAL
#define ESP_ERROR_CHECK_NONFATAL( expr, retexpr ) { \
esp_err_t __err_rc = ( expr ); \
if ( __err_rc != ESP_OK ) { \
ESP_LOGE( __FUNCTION__, "%s != ESP_OK, result: %d", #expr, __err_rc ); \
SSD1306_DoAbort( ); \
retexpr; \
} \
}
#endif
#if ! defined CheckBounds
#define CheckBounds( expr, retexpr ) { \
if ( expr ) { \
ESP_LOGE( __FUNCTION__, "Line %d: %s", __LINE__, #expr ); \
SSD1306_DoAbort( ); \
retexpr; \
} \
}
#endif
#endif