Added code from the old stm32f4 library that seems to be missing in the new HAL version