factoring code for stm32 boards