Home
Roadside
Carputer
geoHist
software
FRC
Blog
Now you can download a copy of these docs so you can use them offline!
Download now
Main Page
Related Pages
Classes
Files
File List
MotorSafetyHelper.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 __MOTOR_SAFETY_HELPER__
8
#define __MOTOR_SAFETY_HELPER__
9
10
#include "ErrorBase.h"
11
#include "Synchronized.h"
12
#include <semLib.h>
13
14
class
MotorSafety
;
15
16
class
MotorSafetyHelper
:
public
ErrorBase
17
{
18
public
:
19
MotorSafetyHelper
(
MotorSafety
*safeObject);
20
~
MotorSafetyHelper
();
21
void
Feed();
22
void
SetExpiration(
float
expirationTime);
23
float
GetExpiration
();
24
bool
IsAlive
();
25
void
Check
();
26
void
SetSafetyEnabled
(
bool
enabled);
27
bool
IsSafetyEnabled
();
28
static
void
CheckMotors
();
29
private
:
30
double
m_expiration;
// the expiration time for this object
31
bool
m_enabled;
// true if motor safety is enabled for this motor
32
double
m_stopTime;
// the FPGA clock value when this motor has expired
33
ReentrantSemaphore
m_syncMutex;
// protect accesses to the state for this object
34
MotorSafety
*m_safeObject;
// the object that is using the helper
35
MotorSafetyHelper
*m_nextHelper;
// next object in the list of MotorSafetyHelpers
36
static
MotorSafetyHelper
*m_headHelper;
// the head of the list of MotorSafetyHelper objects
37
static
ReentrantSemaphore
m_listMutex;
// protect accesses to the list of helpers
38
};
39
40
#endif
MotorSafetyHelper::MotorSafetyHelper
MotorSafetyHelper(MotorSafety *safeObject)
Definition:
MotorSafetyHelper.cpp:28
ErrorBase
Definition:
ErrorBase.h:37
MotorSafetyHelper::SetSafetyEnabled
void SetSafetyEnabled(bool enabled)
Definition:
MotorSafetyHelper.cpp:127
MotorSafetyHelper::GetExpiration
float GetExpiration()
Definition:
MotorSafetyHelper.cpp:83
MotorSafetyHelper::IsAlive
bool IsAlive()
Definition:
MotorSafetyHelper.cpp:93
MotorSafetyHelper::IsSafetyEnabled
bool IsSafetyEnabled()
Definition:
MotorSafetyHelper.cpp:138
ReentrantSemaphore
Definition:
Synchronized.h:31
MotorSafetyHelper::Check
void Check()
Definition:
MotorSafetyHelper.cpp:105
MotorSafety
Definition:
MotorSafety.h:11
MotorSafetyHelper::CheckMotors
static void CheckMotors()
Definition:
MotorSafetyHelper.cpp:149
MotorSafetyHelper
Definition:
MotorSafetyHelper.h:16
Generated on Sat Apr 26 2014 12:26:45 for WPILibC++ by
1.8.6
© 2006-2009 Dustin Spicuzza. All rights reserved.
Powered by Onnac
I do not condone or encourage graffiti. Please paint responsibly.