Skip to content

Commit

Permalink
Adding Joystick classes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgco committed Aug 27, 2011
1 parent 7c5ba8a commit db0443f
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Expand Up @@ -36,3 +36,10 @@ Icon?

# ZSH Cake plugin cache
/.cake_task_cache

# Xcode
*xcodeproj/*mode*
*xcodeproj/*pbxuser
*xcodeproj/*per*
*xcodeproj/project.xcworkspace
*xcodeproj/xcuserdata
13 changes: 13 additions & 0 deletions Arduino Helicopter Controller/Joysticks/Controller.h
@@ -0,0 +1,13 @@
//
// Controller.h
// ArduinoCopterS107
//
// Created by Tom Gallacher on 27/08/2011.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface Controller : NSObject

@end
13 changes: 13 additions & 0 deletions Arduino Helicopter Controller/Joysticks/Controller.m
@@ -0,0 +1,13 @@
//
// Controller.m
// ArduinoCopterS107
//
// Created by Tom Gallacher on 27/08/2011.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import "Controller.h"

@implementation Controller

@end
14 changes: 14 additions & 0 deletions Arduino Helicopter Controller/Joysticks/Xbox360Controller.h
@@ -0,0 +1,14 @@
//
// Xbox360Controller.h
// ArduinoCopterS107
//
// Created by Tom Gallacher on 27/08/2011.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Controller.h"

@interface Xbox360Controller : Controller

@end
16 changes: 16 additions & 0 deletions Arduino Helicopter Controller/Joysticks/Xbox360Controller.m
@@ -0,0 +1,16 @@
//
// Xbox360Controller.m
// ArduinoCopterS107
//
// Created by Tom Gallacher on 27/08/2011.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

// This will control the Xbox 360 Controller on the mac using the driver found at http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/OsxDriver
// This will work on lion.

#import "Xbox360Controller.h"

@implementation Xbox360Controller

@end
9 changes: 8 additions & 1 deletion Arduino Helicopter Controller/RemoteControl.h
Expand Up @@ -9,6 +9,7 @@
#import <Cocoa/Cocoa.h>
#import "SerialCommunication.h"
#import <DDHidLib/DDHidLib.h>
#import "Xbox360Controller.h"

@interface RemoteControl : NSViewController {
SerialCommunication *serialCommunication;
Expand All @@ -26,9 +27,15 @@
NSMutableArray * mJoystickButtons;
int mXAxis;
int mYAxis;

//Loading xbox controller to begin, will have an
//abstraction layer to be able to choose and
//possible a self configuration area when I can be arsed.

Xbox360Controller *controller;
}


@property (retain, nonatomic) Xbox360Controller *controller;
@property (retain, nonatomic) IBOutlet NSSegmentedControl *channelSelect;

- (NSArray *) joysticks;
Expand Down
5 changes: 3 additions & 2 deletions Arduino Helicopter Controller/RemoteControl.m
Expand Up @@ -21,7 +21,8 @@ - (void) setJoysticks: (NSArray *) theJoysticks;

@end

@synthesize channelSelect;
@synthesize channelSelect,
controller;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
Expand Down Expand Up @@ -159,7 +160,7 @@ - (void) ddhidJoystick: (DDHidJoystick *) joystick
valueChanged: (int) value;
{
// Somehow display values here
// NSLog(@"Stick: %d, other axis: %d, changed: %d", stick, otherAxis, value);
NSLog(@"Stick: %d, other axis: %d, changed: %d", stick, otherAxis, value);
switch(stick) {
case 2: // Triggers
switch (otherAxis) {
Expand Down
20 changes: 20 additions & 0 deletions ArduinoCopterS107.xcodeproj/project.pbxproj
Expand Up @@ -12,6 +12,8 @@
E22EF9E2140827DC00D6D70C /* RemoteControlView.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EF9E1140827DC00D6D70C /* RemoteControlView.m */; };
E22EFA1314088C2B00D6D70C /* DDHidLib.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = E22EFA1214088C2B00D6D70C /* DDHidLib.framework */; };
E22EFA1414088C8F00D6D70C /* DDHidLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E22EFA1214088C2B00D6D70C /* DDHidLib.framework */; };
E25D70DF1409558400A79FDD /* Xbox360Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = E25D70DE1409558400A79FDD /* Xbox360Controller.m */; };
E25D70E21409568800A79FDD /* Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = E25D70E11409568800A79FDD /* Controller.m */; };
E28273B41406D33100CD749E /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E28273B31406D33100CD749E /* Cocoa.framework */; };
E28273BE1406D33100CD749E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E28273BC1406D33100CD749E /* InfoPlist.strings */; };
E28273C01406D33100CD749E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E28273BF1406D33100CD749E /* main.m */; };
Expand Down Expand Up @@ -42,6 +44,10 @@
E22EF9E0140827DC00D6D70C /* RemoteControlView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteControlView.h; sourceTree = "<group>"; };
E22EF9E1140827DC00D6D70C /* RemoteControlView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RemoteControlView.m; sourceTree = "<group>"; };
E22EFA1214088C2B00D6D70C /* DDHidLib.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = DDHidLib.framework; sourceTree = "<group>"; };
E25D70DD1409558400A79FDD /* Xbox360Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Xbox360Controller.h; path = "Arduino Helicopter Controller/Joysticks/Xbox360Controller.h"; sourceTree = "<group>"; };
E25D70DE1409558400A79FDD /* Xbox360Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Xbox360Controller.m; path = "Arduino Helicopter Controller/Joysticks/Xbox360Controller.m"; sourceTree = "<group>"; };
E25D70E01409568800A79FDD /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Controller.h; path = "Arduino Helicopter Controller/Joysticks/Controller.h"; sourceTree = "<group>"; };
E25D70E11409568800A79FDD /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Controller.m; path = "Arduino Helicopter Controller/Joysticks/Controller.m"; sourceTree = "<group>"; };
E28273AF1406D33100CD749E /* ArduinoCopterS107.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ArduinoCopterS107.app; sourceTree = BUILT_PRODUCTS_DIR; };
E28273B31406D33100CD749E /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
E28273B61406D33100CD749E /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -74,9 +80,21 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
E25D70DB1409555100A79FDD /* Joysticks */ = {
isa = PBXGroup;
children = (
E25D70DD1409558400A79FDD /* Xbox360Controller.h */,
E25D70DE1409558400A79FDD /* Xbox360Controller.m */,
E25D70E01409568800A79FDD /* Controller.h */,
E25D70E11409568800A79FDD /* Controller.m */,
);
name = Joysticks;
sourceTree = "<group>";
};
E28273A41406D33000CD749E = {
isa = PBXGroup;
children = (
E25D70DB1409555100A79FDD /* Joysticks */,
E22EFA1214088C2B00D6D70C /* DDHidLib.framework */,
E28273B91406D33100CD749E /* ArduinoCopterS107 */,
E28273B21406D33100CD749E /* Frameworks */,
Expand Down Expand Up @@ -213,6 +231,8 @@
E28273D5140701FE00CD749E /* SerialCommunication.m in Sources */,
E22EF9DA1408257700D6D70C /* RemoteControl.m in Sources */,
E22EF9E2140827DC00D6D70C /* RemoteControlView.m in Sources */,
E25D70DF1409558400A79FDD /* Xbox360Controller.m in Sources */,
E25D70E21409568800A79FDD /* Controller.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Binary file not shown.
Expand Up @@ -106,7 +106,7 @@
endingLineNumber = "122">
</FileBreakpoint>
<FileBreakpoint
shouldBeEnabled = "No"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
isPathRelative = "1"
Expand Down

0 comments on commit db0443f

Please sign in to comment.