From f676812f84b3212779365b9950927a01209e4045 Mon Sep 17 00:00:00 2001 From: Kristian Lauszus Date: Mon, 30 Dec 2013 16:19:34 +0100 Subject: [PATCH] Code for the Wii IR camera needs to be activated in settings.h now Also cleaned up README.md a bit --- README.md | 17 +++++++++++----- Wii.h | 5 +---- WiiCameraReadme.md | 2 +- .../Bluetooth/WiiIRCamera/WiiIRCamera.ino | 2 +- settings.h | 20 ++++++++++++++----- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 59c98caf..95ba475a 100644 --- a/README.md +++ b/README.md @@ -86,8 +86,8 @@ The [BTD library](BTD.cpp) is a general purpose library for an ordinary Bluetoot This library make it easy to add support for different Bluetooth services like a PS3 or a Wii controller or SPP which is a virtual serial port via Bluetooth. Some different examples can be found in the [example directory](examples/Bluetooth). -The BTD library will also make it possible to use multiple services at once, the following example sketch is an example of this: -. +The BTD library also makes it possible to use multiple services at once, the following example sketch is an example of this: +[PS3SPP.ino](examples/Bluetooth/PS3SPP/PS3SPP.ino). ### [BTHID library](BTHID.cpp) @@ -95,13 +95,15 @@ The [Bluetooth HID library](BTHID.cpp) allows you to connect HID devices via Blu Currently HID mice and keyboards are supported. -It uses the standard Boot protocol by default, but it is also able to use the Report protocol as well. You would simply have to call ```setProtocolMode()``` and then parse ```HID_RPT_PROTOCOL``` as an argument. You will then have to modify the parser for your device. See the example: for more information. +It uses the standard Boot protocol by default, but it is also able to use the Report protocol as well. You would simply have to call ```setProtocolMode()``` and then parse ```HID_RPT_PROTOCOL``` as an argument. You will then have to modify the parser for your device. See the example: [BTHID.ino](examples/Bluetooth/BTHID/BTHID.ino) for more information. ### [SPP library](SPP.cpp) SPP stands for "Serial Port Profile" and is a Bluetooth protocol that implements a virtual comport which allows you to send data back and forth from your computer/phone to your Arduino via Bluetooth. It has been tested successfully on Windows, Mac OS X, Linux, and Android. +Take a look at the [SPP.ino](examples/Bluetooth/SPP/SPP.ino) example for more information. + More information can be found at these blog posts: * @@ -116,7 +118,7 @@ These libraries consist of the [PS3BT](PS3BT.cpp) and [PS3USB](PS3USB.cpp). Thes In order to use your Playstation controller via Bluetooth you have to set the Bluetooth address of the dongle internally to your PS3 Controller. This can be achieved by plugging the controller in via USB and letting the library set it automatically. -__Note:__ To obtain the address you have to plug in the Bluetooth dongle before connecting the controller, or alternatively you could set it in code like so: . +__Note:__ To obtain the address you have to plug in the Bluetooth dongle before connecting the controller, or alternatively you could set it in code like so: [PS3BT.ino#L20](examples/Bluetooth/PS3BT/PS3BT.ino#L20). For more information about the PS3 protocol see the official wiki: . @@ -195,12 +197,17 @@ WII Wii(&Btd); Then just press any button on the Wiimote and it will then connect to the dongle. -Take a look at the example for more information: . +Take a look at the example for more information: [Wii.ino](examples/Bluetooth/Wii/Wii.ino). Also take a look at the blog post: * +The Wii IR camera can also be used, but you will have to activate the code for it manually as it is quite large. Simply set ```ENABLE_WII_IR_CAMERA``` to 1 in [settings.h](settings.h). + +The [WiiIRCamera.ino](examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino) example shows how it can be used. + + All the information about the Wii controllers are from these sites: * diff --git a/Wii.h b/Wii.h index 427242bb..26c81fe5 100755 --- a/Wii.h +++ b/Wii.h @@ -23,9 +23,6 @@ #include "BTD.h" #include "controllerEnums.h" -/** You will have to uncomment this to use the IR camera */ -//#define WIICAMERA - /* Wii event flags */ #define WII_FLAG_MOTION_PLUS_CONNECTED 0x01 #define WII_FLAG_NUNCHUCK_CONNECTED 0x02 @@ -281,7 +278,7 @@ public: #ifdef WIICAMERA /** @name Wiimote IR camera functions - * You will have to uncomment #WIICAMERA in Wii.h to use the IR camera. + * You will have to set ENABLE_WII_IR_CAMERA in settings.h to 1 in order use the IR camera. */ /** Initialises the camera as per the steps from: http://wiibrew.org/wiki/Wiimote#IR_Camera */ void IRinitialize(); diff --git a/WiiCameraReadme.md b/WiiCameraReadme.md index d3fc11ae..2309b4f9 100644 --- a/WiiCameraReadme.md +++ b/WiiCameraReadme.md @@ -2,7 +2,7 @@ Please see for the complete capabili This library is large, if you run into memory problems when uploading to the Arduino, disable serial debugging. -To enable the IR camera code, uncomment \#define WIICAMERA in Wii.h. +To enable the IR camera code, simply set ```ENABLE_WII_IR_CAMERA``` to 1 in [settings.h](settings.h). This library implements the following settings: diff --git a/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino b/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino index 5e49fad1..e7ca456b 100644 --- a/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino +++ b/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino @@ -19,7 +19,7 @@ Otherwise, wire up a IR LED yourself. #endif #ifndef WIICAMERA // Used to check if WIICAMERA is defined -#error "Uncomment WIICAMERA in Wii.h to use this example" +#error "Please set ENABLE_WII_IR_CAMERA to 1 in settings.h" #endif USB Usb; diff --git a/settings.h b/settings.h index f7914b2a..424a5bcf 100644 --- a/settings.h +++ b/settings.h @@ -37,6 +37,13 @@ /* Set this to a one to use the xmem2 lock. This is needed for multitasking and threading */ #define USE_XMEM_SPI_LOCK 0 +//////////////////////////////////////////////////////////////////////////////// +// Wii IR camera +//////////////////////////////////////////////////////////////////////////////// + +/* Set this to 1 to activate code for the Wii IR camera */ +#define ENABLE_WII_IR_CAMERA 0 + //////////////////////////////////////////////////////////////////////////////// // MASS STORAGE //////////////////////////////////////////////////////////////////////////////// @@ -47,7 +54,6 @@ #define MASS_MAX_SUPPORTED_LUN 8 #endif - //////////////////////////////////////////////////////////////////////////////// // Set to 1 to use the faster spi4teensy3 driver. //////////////////////////////////////////////////////////////////////////////// @@ -62,10 +68,6 @@ // No user serviceable parts below this line. // DO NOT change anything below here unless you are a developer! -#if !defined(DEBUG_USB_HOST) && ENABLE_UHS_DEBUGGING -#define DEBUG_USB_HOST -#endif - // When will we drop support for the older bug-ridden stuff? #if defined(ARDUINO) && ARDUINO >=100 #include @@ -93,6 +95,14 @@ #endif #endif +#if !defined(DEBUG_USB_HOST) && ENABLE_UHS_DEBUGGING +#define DEBUG_USB_HOST +#endif + +#if !defined(WIICAMERA) && ENABLE_WII_IR_CAMERA +#define WIICAMERA +#endif + #if USE_XMEM_SPI_LOCK | defined(USE_MULTIPLE_APP_API) #include #else