Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BridgeDriver FrontPanelButtons MCP23017 SDFileSystem TextLCD mbed
Diff: Devices/Motor.cpp
- Revision:
- 10:e8db892fbc52
- Parent:
- 9:5a0c4c6e39c7
- Child:
- 11:bc9cd2869f95
--- a/Devices/Motor.cpp Wed Sep 24 22:23:00 2014 +0000
+++ b/Devices/Motor.cpp Wed Sep 24 22:54:36 2014 +0000
@@ -56,7 +56,11 @@
ErrorOut("Parameter Unknown, enableBrake value can't be converted", lineData.lineNumber);
return -1;
}
-
+
+ //All syntax checking done by this point, if Dummy then return success in order to check the code, no need to perform functionality
+ if (DummyMode)
+ return 0; //Function operated successfully but doesn't return a value
+
bridges.enableBraking(getMotor(), enableValue);
}
@@ -70,6 +74,10 @@
return -1;
}
+ //All syntax checking done by this point, if Dummy then return success in order to check the code, no need to perform functionality
+ if (DummyMode)
+ return 0; //Function operated successfully but doesn't return a value
+
bridges.forceBrake(getMotor());
}
@@ -118,6 +126,10 @@
return -1;
}
+ //All syntax checking done by this point, if Dummy then return success in order to check the code, no need to perform functionality
+ if (DummyMode)
+ return 0; //Function operated successfully but doesn't return a value
+
bridges.drive(getMotor(), dirValue, speedValue); //Turn on the Motor
}
@@ -131,7 +143,11 @@
ErrorOut("Incorrect number of parameters", lineData.lineNumber);
return -1;
}
-
+
+ //All syntax checking done by this point, if Dummy then return success in order to check the code, no need to perform functionality
+ if (DummyMode)
+ return 0; //Function operated successfully but doesn't return a value
+
off();
}
@@ -148,6 +164,7 @@
//For stopping the entire system if an error occurs, can be called from main
int Motor::off(void){
bridges.drive(getMotor(), 0, 0); //Turn off the Motor
+ return 0;
}