WPILib 2012
WPILibRoboticsLibraryforFRC
CInterfaces/CJoystick.h
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 _C_JOYSTICK_H_
00008 #define _C_JOYSTICK_H_
00009 
00010 static const UINT32 kDefaultXAxis = 1;
00011 static const UINT32 kDefaultYAxis = 2;
00012 static const UINT32 kDefaultZAxis = 3;
00013 static const UINT32 kDefaultTwistAxis = 4;
00014 static const UINT32 kDefaultThrottleAxis = 3;
00015 
00016 typedef enum {
00017         kLeftHand = 0,
00018         kRightHand = 1
00019 } JoystickHand;
00020 
00021 typedef enum
00022 {
00023         kXAxis, kYAxis, kZAxis, kTwistAxis, kThrottleAxis, kNumAxisTypes
00024 } AxisType;
00025 static const UINT32 kDefaultTriggerButton = 1;
00026 static const UINT32 kDefaultTopButton = 2;
00027 typedef enum
00028 {
00029         kTriggerButton, kTopButton, kNumButtonTypes
00030 } ButtonType;
00031 
00032 UINT32 GetAxisChannel(UINT32 port, AxisType axis);
00033 void SetAxisChannel(UINT32 port, AxisType axis, UINT32 channel); 
00034 
00035 float GetX(UINT32 port, JoystickHand hand = kRightHand);
00036 float GetY(UINT32 port, JoystickHand hand = kRightHand);
00037 float GetZ(UINT32 port);
00038 float GetTwist(UINT32 port);
00039 float GetThrottle(UINT32 port);
00040 float GetAxis(UINT32 port, AxisType axis);
00041 float GetRawAxis(UINT32 port, UINT32 axis);
00042 
00043 bool GetTrigger(UINT32 port, JoystickHand hand = kRightHand);
00044 bool GetTop(UINT32 port, JoystickHand hand = kRightHand);
00045 bool GetBumper(UINT32 port, JoystickHand hand = kRightHand);
00046 bool GetButton(UINT32 port, ButtonType button);
00047 bool GetRawButton(UINT32 port, UINT32 button);
00048 
00049 #endif
00050  
 All Classes Functions Variables