I'm using an STM32F4 discovery board for a project and am wondering if I'm approaching the problem correctly. When I press a button, an external interrupt is triggered which runs a routine; without using a delay, this part works fine. As the routine moves a servo then returns it to its original position, a delay is added to allow the servo to catch up with the new PWM output before returning to the original position. When I run the new interrupt routine with the delay, the board locks up. In debug the code appears to stall at the delay loop.
The delay is a simple systick routine. Is it bad practice (thus the reason for my crashes) to put this inside my interrupt, and should I use a different method? For example setting a one shot timer inside the external interrupt routine which returns the servo after a set time?
Thanks!