stm32_assert.h 1.9 KB

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