stm32_assert_template.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. ******************************************************************************
  3. * @file stm32_assert.h
  4. * @author MCD Application Team
  5. * @brief STM32 assert template file.
  6. * This file should be copied to the application folder and renamed
  7. * to stm32_assert.h.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * Copyright (c) 2016 STMicroelectronics.
  12. * All rights reserved.
  13. *
  14. * This software is licensed under terms that can be found in the LICENSE file
  15. * in the root directory of this software component.
  16. * If no LICENSE file comes with this software, it is provided AS-IS.
  17. *
  18. ******************************************************************************
  19. */
  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 */