Forwards, stop, and backwards control of 10V DC motor

So I have a 10 volt motor that im running, and I created my own H bridge with nMos and pMos transistors. You run the motor in one direction by calling High1 Low2 for forward and High2 Low1 for backward. My objective seems pretty simple: to run the DC motor in one direction for a certain period of time, say 1000 ms, stop for 1000 ms, and reverse for 1000 ms, where it will then come to a permanent stop. And I am trying to trigger this action by using a 6mm x 6mm tact switch. For the life of me, I cannot get this code to work. If been working with an If statement by identifying the signal coming from the switch, but the motor does not want to cooperate with me from there. Any ideas?

Post your full code.

And schematic would be nice too...