WPILib 2012
WPILibRoboticsLibraryforFRC
|
#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) |
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.
SafePWM::SafePWM | ( | UINT32 | channel | ) | [explicit] |
SafePWM::SafePWM | ( | UINT8 | moduleNumber, |
UINT32 | channel | ||
) |
float SafePWM::GetExpiration | ( | ) | [virtual] |
Return the expiration time for the PWM object.
Implements MotorSafety.
bool SafePWM::IsAlive | ( | ) | [virtual] |
Check if the PWM object is currently alive or stopped due to a timeout.
Implements MotorSafety.
bool SafePWM::IsSafetyEnabled | ( | ) | [virtual] |
Check if motor safety is enabled for this object
Implements MotorSafety.
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.
enabled | True if motor safety is enforced for this object |
Implements MotorSafety.
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.
speed | Value to pass to the PWM class |
Reimplemented from PWM.
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.