summaryrefslogtreecommitdiff
path: root/tinyusb/common/assertion.h
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-03-22 17:08:51 +0700
committerhathach <[email protected]>2013-03-22 17:08:51 +0700
commitdbaf6c0d30657ec1659ddb13269edc4ae28b7bc2 (patch)
tree59685ec0d0e0eea4b29cbff5d308e1befe4a8dd6 /tinyusb/common/assertion.h
parentcd2915e78cdd261713f1b0aa4ebe0441f99f9456 (diff)
- fix bug when unplugged unmounted-already device (mostly plugged when power on)
- add hal_debugger_is_attached & hal_debugger_breakpoint - assert will suspend (place breakpoint) if the condition is failed and debugger is attached. Otherwise, a message to uart is printed - fix get control qhd function when dev_addr is not zero (shifted 1) - fix wrong logic for unsupported class
Diffstat (limited to 'tinyusb/common/assertion.h')
-rw-r--r--tinyusb/common/assertion.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/tinyusb/common/assertion.h b/tinyusb/common/assertion.h
index 4082f4b59..6ac46086c 100644
--- a/tinyusb/common/assertion.h
+++ b/tinyusb/common/assertion.h
@@ -57,6 +57,7 @@ extern "C"
#endif
#include "tusb_option.h"
+#include "hal/hal.h"
//--------------------------------------------------------------------+
// Compile-time Assert
@@ -92,7 +93,8 @@ extern "C"
#endif
#ifndef _TEST_ASSERT_
- #define ASSERT_ERROR_HANDLER(x, para) return (x)
+ #define ASSERT_ERROR_HANDLER(x, para) \
+ return (x)
#else
#define ASSERT_ERROR_HANDLER(x, para) Throw(x)
#endif
@@ -101,7 +103,11 @@ extern "C"
do{\
setup_statement;\
if (!(condition)) {\
- ASSERT_MESSAGE(format, __VA_ARGS__);\
+ if (hal_debugger_is_attached()){\
+ hal_debugger_breakpoint();\
+ }else{\
+ ASSERT_MESSAGE(format, __VA_ARGS__);\
+ }\
error_handler(error, handler_para);\
}\
}while(0)