Maybe I am missing something but if you stop the motor and then restart it you know the direction?? Set the direction bit when you start the motor.