By default at power-up, the circuit is in coast mode.
To brake, set in A to 0 V, in B to 0 V, and Q5 to 5 V.
To spin clockwise, set in A to 5 V, in B to 0 V, and Q5 to 5 V.
To spin counterclockwise, set in A to 0 V, in B to 5 V, and Q5 to 5 V.
At any time you can return to coast by applying 0 V to Q5.
Or, you can apply pulses of 0 V/5 V/0 V/5 V (and so on) to control the speed.
The more time spent at 5 V, the faster the motor will spin.
Whenever you change modes, if you set Q5 to 0 V before making changes to in A and in B
(and then set Q5 back to 5 V or pulsing) there will be no shoot-through.