mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-19 09:54:15 +01:00
Enabled USE_FULL_ASSERT. See comments for details.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@27 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
3a1454c0d1
commit
208c918acc
@ -92,3 +92,31 @@ void NVIC_Configuration(void)
|
||||
/* Configure HCLK clock as SysTick clock source. */
|
||||
SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );
|
||||
}
|
||||
|
||||
#ifdef USE_FULL_ASSERT
|
||||
/**
|
||||
* Reports the name of the source file and the source line number
|
||||
* where the assert_param error has occurred.
|
||||
* \param[in] file pointer to the source file name
|
||||
* \param[in] line assert_param error line source number
|
||||
* \retval None
|
||||
*/
|
||||
void assert_failed(uint8_t* file, uint32_t line)
|
||||
{
|
||||
/* When serial debugging is implemented, use something like this. */
|
||||
/* printf("Wrong parameters value: file %s on line %d\r\n", file, line); */
|
||||
|
||||
/* Setup the LEDs to Alternate */
|
||||
LED_ON(LED1);
|
||||
LED_OFF(LED2);
|
||||
|
||||
/* Infinite loop */
|
||||
while (1)
|
||||
{
|
||||
for(int i = 0; i < 1000; i++);
|
||||
LED_TOGGLE(LED1);
|
||||
for(int i = 0; i < 1000; i++);
|
||||
LED_TOGGLE(LED2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -51,22 +51,22 @@
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Uncomment the line below to expanse the "assert_param" macro in the
|
||||
Standard Peripheral Library drivers code */
|
||||
/* #define USE_FULL_ASSERT 1 */
|
||||
#define USE_FULL_ASSERT 1
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
#ifdef USE_FULL_ASSERT
|
||||
|
||||
/**
|
||||
* @brief The assert_param macro is used for function's parameters check.
|
||||
* @param expr: If expr is false, it calls assert_failed function
|
||||
* which reports the name of the source file and the source
|
||||
* line number of the call that failed.
|
||||
* If expr is true, it returns no value.
|
||||
* @retval None
|
||||
*/
|
||||
* The assert_param macro is used for function's parameters check.
|
||||
* \param[in] expr: If expr is false, it calls assert_failed function
|
||||
* which reports the name of the source file and the source
|
||||
* line number of the call that failed.
|
||||
* If expr is true, it returns no value.
|
||||
* \retval None
|
||||
*/
|
||||
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void assert_failed(uint8_t* file, uint32_t line);
|
||||
extern void assert_failed(uint8_t* file, uint32_t line);
|
||||
#else
|
||||
#define assert_param(expr) ((void)0)
|
||||
#endif /* USE_FULL_ASSERT */
|
||||
|
Loading…
x
Reference in New Issue
Block a user