Basic tank-style drive robot control firmware for Freescale FRDM-K64F. Controls motors on a Dual-Full-H-Bridge with EN, like DBH-1x series, from Bluetooth serial commands

Dependencies:   mbed

Revision:
0:41ca27337c2b
Child:
1:23d0a615756a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MotorDriveBase.h	Tue Jul 28 14:59:19 2015 +0000
@@ -0,0 +1,19 @@
+// Generic interface for "standard" H-Bridge motor driver
+
+class MotorDriveBase
+{
+  virtual void stop() = 0;
+  virtual void emergencyStop() = 0;
+
+  
+  // Set speed -MAX_PWM for max reverse, MAX_PWM for max forward
+  inline void setSpeed(const int spdReq)
+  {
+    setSpeed(spdReq,millis());
+  }
+
+  // many (all?) drivers may have some mode transition times and pauses.
+  // use these to indicate current time, to avoid repeated calls to millis()
+  virtual void setSpeed(const float spd, const long t) = 0;  // pass in current time
+  virtual void update(long t) = 0;  // check if some sort of state change needs to be processed
+};