WPILib  2014.0
WPIRoboticsLibraryforFRC
 All Classes Functions Variables Pages
SafePWM.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2008. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
5 /*----------------------------------------------------------------------------*/
6 
7 #ifndef __SAFE_PWM__
8 #define __SAFE_PWM__
9 
10 #include "MotorSafety.h"
11 #include "PWM.h"
12 
13 class MotorSafetyHelper;
14 
22 class SafePWM: public PWM, public MotorSafety
23 {
24 public:
25  explicit SafePWM(uint32_t channel);
26  SafePWM(uint8_t moduleNumber, uint32_t channel);
27  ~SafePWM();
28 
29  void SetExpiration(float timeout);
30  float GetExpiration();
31  bool IsAlive();
32  void StopMotor();
33  bool IsSafetyEnabled();
34  void SetSafetyEnabled(bool enabled);
35  void GetDescription(char *desc);
36 
37  virtual void SetSpeed(float speed);
38 private:
39  void InitSafePWM();
40  MotorSafetyHelper *m_safetyHelper;
41 };
42 
43 #endif
SafePWM(uint32_t channel)
Definition: SafePWM.cpp:24
bool IsAlive()
Definition: SafePWM.cpp:67
Definition: MotorSafety.h:11
bool IsSafetyEnabled()
Definition: SafePWM.cpp:96
Definition: PWM.h:32
Definition: SafePWM.h:22
void SetSafetyEnabled(bool enabled)
Definition: SafePWM.cpp:87
Definition: MotorSafetyHelper.h:16
virtual void SetSpeed(float speed)
Definition: SafePWM.cpp:112
float GetExpiration()
Definition: SafePWM.cpp:57
void StopMotor()
Definition: SafePWM.cpp:77