Naze32 clone with Frysky receiver
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

mbed_assert.h 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* mbed Microcontroller Library
  2. * Copyright (c) 2006-2013 ARM Limited
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef MBED_ASSERT_H
  17. #define MBED_ASSERT_H
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. /** Internal mbed assert function which is invoked when MBED_ASSERT macro failes.
  22. * This function is active only if NDEBUG is not defined prior to including this
  23. * assert header file.
  24. * In case of MBED_ASSERT failing condition, error() is called with the assertation message.
  25. * @param expr Expresion to be checked.
  26. * @param file File where assertation failed.
  27. * @param line Failing assertation line number.
  28. */
  29. void mbed_assert_internal(const char *expr, const char *file, int line);
  30. #ifdef __cplusplus
  31. }
  32. #endif
  33. #ifdef NDEBUG
  34. #define MBED_ASSERT(expr) ((void)0)
  35. #else
  36. #define MBED_ASSERT(expr) \
  37. do { \
  38. if (!(expr)) { \
  39. mbed_assert_internal(#expr, __FILE__, __LINE__); \
  40. } \
  41. } while (0)
  42. #endif
  43. #endif