SafePWM Class Reference
#include <SafePWM.h>


Public Member Functions | |
| SafePWM (UINT32 channel) | |
| SafePWM (UINT8 moduleNumber, UINT32 channel) | |
| void | SetExpiration (float timeout) |
| float | GetExpiration () |
| bool | IsAlive () |
| void | StopMotor () |
| bool | IsSafetyEnabled () |
| void | SetSafetyEnabled (bool enabled) |
| void | GetDescription (char *desc) |
| virtual void | SetSpeed (float speed) |
Detailed Description
A safe version of the PWM class. It is safe because it implements the MotorSafety interface that provides timeouts in the event that the motor value is not updated before the expiration time. This delegates the actual work to a MotorSafetyHelper object that is used for all objects that implement MotorSafety.
Definition at line 22 of file SafePWM.h.
Constructor & Destructor Documentation
| SafePWM::SafePWM | ( | UINT32 | channel | ) | [explicit] |
Constructor for a SafePWM object taking a channel number
- Parameters:
-
channel The channel number to be used for the underlying PWM object
Definition at line 24 of file SafePWM.cpp.
| SafePWM::SafePWM | ( | UINT8 | moduleNumber, | |
| UINT32 | channel | |||
| ) |
Constructor for a SafePWM object taking channel and slot numbers.
- Parameters:
-
moduleNumber The digital module (1 or 2). channel The PWM channel number on the module (1..10).
Definition at line 34 of file SafePWM.cpp.
Member Function Documentation
| float SafePWM::GetExpiration | ( | ) | [virtual] |
Return the expiration time for the PWM object.
- Returns:
- The expiration time value.
Implements MotorSafety.
Definition at line 57 of file SafePWM.cpp.
| bool SafePWM::IsAlive | ( | ) | [virtual] |
Check if the PWM object is currently alive or stopped due to a timeout.
- Returns:
- a bool value that is true if the motor has NOT timed out and should still be running.
Implements MotorSafety.
Definition at line 67 of file SafePWM.cpp.
| bool SafePWM::IsSafetyEnabled | ( | ) | [virtual] |
Check if motor safety is enabled for this object
- Returns:
- True if motor safety is enforced for this object
Implements MotorSafety.
Definition at line 96 of file SafePWM.cpp.
| void SafePWM::SetSafetyEnabled | ( | bool | enabled | ) | [virtual] |
Enable/disable motor safety for this device Turn on and off the motor safety option for this PWM object.
- Parameters:
-
enabled True if motor safety is enforced for this object
Implements MotorSafety.
Definition at line 87 of file SafePWM.cpp.
| void SafePWM::SetSpeed | ( | float | speed | ) | [virtual] |
Feed the MotorSafety timer when setting the speed. This method is called by the subclass motor whenever it updates its speed, thereby reseting the timeout value.
- Parameters:
-
speed Value to pass to the PWM class
Definition at line 112 of file SafePWM.cpp.
| void SafePWM::StopMotor | ( | ) | [virtual] |
Stop the motor associated with this PWM object. This is called by the MotorSafetyHelper object when it has a timeout for this PWM and needs to stop it from running.
Implements MotorSafety.
Definition at line 77 of file SafePWM.cpp.
The documentation for this class was generated from the following files:
Generated on Thu Jan 12 2012 22:35:36 for WPILibC++ by
1.7.1