refactored fsm with transitions
adds systick handler and delay functions (sync and async)