Created
August 10, 2020 00:16
-
-
Save Carbon225/f777f7cd56c8ed46b86e280935852ce4 to your computer and use it in GitHub Desktop.
The most useful ESP-IDF macro. Check for errors and return if not ESP_OK.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef COMPONENTS_ERROR_CHECK_RETURN_INCLUDE_ERROR_CHECK_RETURN_H_ | |
#define COMPONENTS_ERROR_CHECK_RETURN_INCLUDE_ERROR_CHECK_RETURN_H_ | |
#define ESP_ERROR_CHECK_RETURN(fn) ({ \ | |
esp_err_t __ret = ESP_ERROR_CHECK_WITHOUT_ABORT((fn)); \ | |
if (__ret != ESP_OK) { \ | |
return __ret; \ | |
} \ | |
__ret; \ | |
}) | |
#endif /* COMPONENTS_ERROR_CHECK_RETURN_INCLUDE_ERROR_CHECK_RETURN_H_ */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment