stm32_assert.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file stm32_assert.h
  5. * @author MCD Application Team
  6. * @brief STM32 assert file.
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * Copyright (c) 2018 STMicroelectronics.
  11. * All rights reserved.
  12. *
  13. * This software is licensed under terms that can be found in the LICENSE file
  14. * in the root directory of this software component.
  15. * If no LICENSE file comes with this software, it is provided AS-IS.
  16. *
  17. ******************************************************************************
  18. */
  19. /* USER CODE END Header */
  20. /* Define to prevent recursive inclusion -------------------------------------*/
  21. #ifndef __STM32_ASSERT_H
  22. #define __STM32_ASSERT_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /* Exported types ------------------------------------------------------------*/
  27. /* Exported constants --------------------------------------------------------*/
  28. /* Includes ------------------------------------------------------------------*/
  29. /* Exported macro ------------------------------------------------------------*/
  30. #ifdef USE_FULL_ASSERT
  31. /**
  32. * @brief The assert_param macro is used for function's parameters check.
  33. * @param expr If expr is false, it calls assert_failed function
  34. * which reports the name of the source file and the source
  35. * line number of the call that failed.
  36. * If expr is true, it returns no value.
  37. * @retval None
  38. */
  39. #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
  40. /* Exported functions ------------------------------------------------------- */
  41. void assert_failed(uint8_t *file, uint32_t line);
  42. #else
  43. #define assert_param(expr) ((void)0U)
  44. #endif /* USE_FULL_ASSERT */
  45. #ifdef __cplusplus
  46. }
  47. #endif
  48. #endif /* __STM32_ASSERT_H */