WPILib 2012
WPILibRoboticsLibraryforFRC
SafePWM.h
00001 /*----------------------------------------------------------------------------*/
00002 /* Copyright (c) FIRST 2008. All Rights Reserved.                                                         */
00003 /* Open Source Software - may be modified and shared by FRC teams. The code   */
00004 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */
00005 /*----------------------------------------------------------------------------*/
00006 
00007 #ifndef __SAFE_PWM__
00008 #define __SAFE_PWM__
00009 
00010 #include "MotorSafety.h"
00011 #include "PWM.h"
00012 
00013 class MotorSafetyHelper;
00014 
00022 class SafePWM: public PWM, public MotorSafety
00023 {
00024 public:
00025         explicit SafePWM(UINT32 channel);
00026         SafePWM(UINT8 moduleNumber, UINT32 channel);
00027         ~SafePWM();
00028 
00029         void SetExpiration(float timeout);
00030         float GetExpiration();
00031         bool IsAlive();
00032         void StopMotor();
00033         bool IsSafetyEnabled();
00034         void SetSafetyEnabled(bool enabled);
00035         void GetDescription(char *desc);
00036 
00037         virtual void SetSpeed(float speed);
00038 private:
00039         void InitSafePWM();
00040         MotorSafetyHelper *m_safetyHelper;
00041 };
00042 
00043 #endif
 All Classes Functions Variables