This and some PID motor controller code makes for a straightforward task on the little chip, and with the help of a probably considerably more expensive MAX14870 it can drive the motor.
The Smart Motor Driver for Robotics allows a DC brushed motor to be controlled by a host microcontroller over I2C, and sends back the speed and direction of the motor. PID is implemented ...