diff --git a/flight/sys/pios_sys.c b/flight/sys/pios_sys.c index b5bbafef2..a42eab34d 100644 --- a/flight/sys/pios_sys.c +++ b/flight/sys/pios_sys.c @@ -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 diff --git a/flight/sys/stm32f10x_conf.h b/flight/sys/stm32f10x_conf.h index ae9132af6..efe144761 100644 --- a/flight/sys/stm32f10x_conf.h +++ b/flight/sys/stm32f10x_conf.h @@ -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 */