Now you can download a copy of these docs so you can use them offline! Download now
AnalogTriggerOutput.cpp
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 #include "AnalogTriggerOutput.h"
8 #include "AnalogTrigger.h"
9 #include "NetworkCommunication/UsageReporting.h"
10 #include "WPIErrors.h"
11 
21 AnalogTriggerOutput::AnalogTriggerOutput(AnalogTrigger *trigger, AnalogTriggerOutput::Type outputType)
22  : m_trigger (trigger)
23  , m_outputType (outputType)
24 {
25  nUsageReporting::report(nUsageReporting::kResourceType_AnalogTriggerOutput, trigger->GetIndex(), outputType);
26 }
27 
28 AnalogTriggerOutput::~AnalogTriggerOutput()
29 {
30 }
31 
37 {
38  tRioStatusCode localStatus = NiFpga_Status_Success;
39  bool result = false;
40  switch(m_outputType)
41  {
42  case kInWindow:
43  result = m_trigger->m_trigger->readOutput_InHysteresis(m_trigger->m_index, &localStatus);
44  case kState:
45  result = m_trigger->m_trigger->readOutput_OverLimit(m_trigger->m_index, &localStatus);
46  case kRisingPulse:
47  case kFallingPulse:
48  wpi_setWPIError(AnalogTriggerPulseOutputError);
49  return false;
50  }
51  wpi_setError(localStatus);
52  return result;
53 }
54 
59 {
60  return (m_trigger->m_index << 2) + m_outputType;
61 }
62 
67 {
68  return m_trigger->m_index >> 2;
69 }
70 
75 {
76  return true;
77 }
78 
83 void AnalogTriggerOutput::RequestInterrupts(tInterruptHandler handler, void *param)
84 {
85 }
86 
92 {
93 }
94 
AnalogTriggerOutput(AnalogTrigger *trigger, Type outputType)
uint32_t GetIndex()
virtual uint32_t GetModuleForRouting()
virtual bool GetAnalogTriggerForRouting()
virtual uint32_t GetChannelForRouting()
virtual void RequestInterrupts()
Synchronus Wait version.

Generated on Sat Apr 26 2014 12:26:45 for WPILibC++ by doxygen 1.8.6