Made serial code more generic

Instead of hard-coding support for the motor program, we support messages of
any size.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
README.md: Corrected spelling in MPIDE path

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Support reverse motion

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Various cleanups

 * Corrected state logic for counter-clockwise motion.
 * Moved repeated code in motor.cc into a macro
 * Select TTY with a command line parameter to `controller'.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Increase PWM frequency to 31.25 kHz

This improves the smoothness of operation of the motors.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Change the protocol sync byte to 0xfe

0xff is more likely to consistently appear in the data stream.  Later, probably
want more robust synchronization.

Also replace all references with a macro.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Increase Hall effect sensor threshold to 2.5 V

We've experimentally determined that this value works well, and obviously
provides the maximum margin when operating with 5 V.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Reverse sensor input order for second motor

The wires were accidentally soldered in the wrong order.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Set output values before switching outputs on

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Record whether the motor has a valid orientation

... for future debugging purposes.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Merge branch 'general-serial'

Conflicts:
	serial_arduino.c