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
MotorDriveBase.h@4:7620d21baef3, 2015-08-16 (annotated)
- Committer:
- Mr_What
- Date:
- Sun Aug 16 22:46:25 2015 +0000
- Revision:
- 4:7620d21baef3
- Parent:
- 1:23d0a615756a
seems to be running from app with reduced diagnostics
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mr_What | 0:41ca27337c2b | 1 | // Generic interface for "standard" H-Bridge motor driver |
Mr_What | 0:41ca27337c2b | 2 | |
Mr_What | 0:41ca27337c2b | 3 | class MotorDriveBase |
Mr_What | 0:41ca27337c2b | 4 | { |
Mr_What | 0:41ca27337c2b | 5 | virtual void stop() = 0; |
Mr_What | 0:41ca27337c2b | 6 | virtual void emergencyStop() = 0; |
Mr_What | 0:41ca27337c2b | 7 | |
Mr_What | 0:41ca27337c2b | 8 | |
Mr_What | 0:41ca27337c2b | 9 | // Set speed -MAX_PWM for max reverse, MAX_PWM for max forward |
Mr_What | 1:23d0a615756a | 10 | inline void setSpeed(const float spdReq) |
Mr_What | 0:41ca27337c2b | 11 | { |
Mr_What | 0:41ca27337c2b | 12 | setSpeed(spdReq,millis()); |
Mr_What | 0:41ca27337c2b | 13 | } |
Mr_What | 0:41ca27337c2b | 14 | |
Mr_What | 0:41ca27337c2b | 15 | // many (all?) drivers may have some mode transition times and pauses. |
Mr_What | 0:41ca27337c2b | 16 | // use these to indicate current time, to avoid repeated calls to millis() |
Mr_What | 1:23d0a615756a | 17 | virtual void setSpeed(const float spd, const int t) = 0; // pass in current time |
Mr_What | 1:23d0a615756a | 18 | virtual void update(int t) = 0; // check if some sort of state change needs to be processed |
Mr_What | 0:41ca27337c2b | 19 | }; |