Robin2:
Depends on the motor driver. Many of them have no Direction pin and the direction is determined by whichever input pin is fed with the PWM signal - hence you need 2 Arduino PWM pins (one for FWD and one for REV) or external "steering" hardware..
So input#1 LOW, and input#2 PWM 0-255,
or
input#1 HIGH, and input#2 PWM 255-0,
wouldn't work for speed control in two directions?
Might need a bit of extra code to take care of braking/coasting modes of the DRV8871.
Leo..