stm32_assert.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. ******************************************************************************
  3. * @file stm32_assert.h
  4. * @brief STM32 assert file.
  5. ******************************************************************************
  6. * @attention
  7. *
  8. * <h2><center>&copy; Copyright (c) 2018 STMicroelectronics.
  9. * All rights reserved.</center></h2>
  10. *
  11. * This software component is licensed by ST under BSD 3-Clause license,
  12. * the "License"; You may not use this file except in compliance with the
  13. * License. You may obtain a copy of the License at:
  14. * opensource.org/licenses/BSD-3-Clause
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef __STM32_ASSERT_H
  20. #define __STM32_ASSERT_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Exported types ------------------------------------------------------------*/
  25. /* Exported constants --------------------------------------------------------*/
  26. /* Includes ------------------------------------------------------------------*/
  27. /* Exported macro ------------------------------------------------------------*/
  28. #ifdef USE_FULL_ASSERT
  29. /**
  30. * @brief The assert_param macro is used for function's parameters check.
  31. * @param expr: If expr is false, it calls assert_failed function
  32. * which reports the name of the source file and the source
  33. * line number of the call that failed.
  34. * If expr is true, it returns no value.
  35. * @retval None
  36. */
  37. #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
  38. /* Exported functions ------------------------------------------------------- */
  39. void assert_failed(uint8_t* file, uint32_t line);
  40. #else
  41. #define assert_param(expr) ((void)0U)
  42. #endif /* USE_FULL_ASSERT */
  43. #ifdef __cplusplus
  44. }
  45. #endif
  46. #endif /* __STM32_ASSERT_H */
  47. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/