Now you can download a copy of these docs so you can use them offline! Download now
HeldButtonScheduler.cpp
00001 /*----------------------------------------------------------------------------*/ 00002 /* Copyright (c) FIRST 2011. 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 #include "Buttons/HeldButtonScheduler.h" 00008 00009 #include "Buttons/Button.h" 00010 #include "Commands/Command.h" 00011 00012 HeldButtonScheduler::HeldButtonScheduler(bool last, Button *button, Command *orders) : 00013 ButtonScheduler(last, button, orders) 00014 { 00015 } 00016 00017 void HeldButtonScheduler::Execute() 00018 { 00019 if (m_button->Grab()) 00020 { 00021 m_pressedLast = true; 00022 m_command->Start(); 00023 } 00024 else 00025 { 00026 if (m_pressedLast) 00027 { 00028 m_pressedLast = false; 00029 m_command->Cancel(); 00030 } 00031 } 00032 }
Generated on Thu Jan 12 2012 22:35:20 for WPILibC++ by
1.7.1