Stm32 State Machine