WPILib 2012
WPILibRoboticsLibraryforFRC
|
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 DIGITAL_INPUT_H_ 00008 #define DIGITAL_INPUT_H_ 00009 00010 class DigitalModule; 00011 00012 #include "DigitalSource.h" 00013 00021 class DigitalInput : public DigitalSource { 00022 public: 00023 explicit DigitalInput(UINT32 channel); 00024 DigitalInput(UINT8 moduleNumber, UINT32 channel); 00025 virtual ~DigitalInput(); 00026 UINT32 Get(); 00027 UINT32 GetChannel(); 00028 00029 // Digital Source Interface 00030 virtual UINT32 GetChannelForRouting(); 00031 virtual UINT32 GetModuleForRouting(); 00032 virtual bool GetAnalogTriggerForRouting(); 00033 00034 // Interruptable Interface 00035 virtual void RequestInterrupts(tInterruptHandler handler, void *param=NULL); 00036 virtual void RequestInterrupts(); 00037 void SetUpSourceEdge(bool risingEdge, bool fallingEdge); 00038 00039 private: 00040 void InitDigitalInput(UINT8 moduleNumber, UINT32 channel); 00041 UINT32 m_channel; 00042 DigitalModule *m_module; 00043 bool m_lastValue; 00044 }; 00045 00046 #endif 00047