Skip to content

Commit f676812

Browse files
committed
Code for the Wii IR camera needs to be activated in settings.h now
Also cleaned up README.md a bit
1 parent fcdf6ab commit f676812

File tree

5 files changed

+30
-16
lines changed

5 files changed

+30
-16
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,24 @@ The [BTD library](BTD.cpp) is a general purpose library for an ordinary Bluetoot
8686
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.
8787
Some different examples can be found in the [example directory](examples/Bluetooth).
8888

89-
The BTD library will also make it possible to use multiple services at once, the following example sketch is an example of this:
90-
<https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3SPP/PS3SPP.ino>.
89+
The BTD library also makes it possible to use multiple services at once, the following example sketch is an example of this:
90+
[PS3SPP.ino](examples/Bluetooth/PS3SPP/PS3SPP.ino).
9191

9292
### [BTHID library](BTHID.cpp)
9393

9494
The [Bluetooth HID library](BTHID.cpp) allows you to connect HID devices via Bluetooth to the USB Host Shield.
9595

9696
Currently HID mice and keyboards are supported.
9797

98-
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: <https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/BTHID/BTHID.ino> for more information.
98+
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.
9999

100100
### [SPP library](SPP.cpp)
101101

102102
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.
103103
It has been tested successfully on Windows, Mac OS X, Linux, and Android.
104104

105+
Take a look at the [SPP.ino](examples/Bluetooth/SPP/SPP.ino) example for more information.
106+
105107
More information can be found at these blog posts:
106108

107109
* <http://www.circuitsathome.com/mcu/bluetooth-rfcommspp-service-support-for-usb-host-2-0-library-released>
@@ -116,7 +118,7 @@ These libraries consist of the [PS3BT](PS3BT.cpp) and [PS3USB](PS3USB.cpp). Thes
116118

117119
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.
118120

119-
__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: <https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3BT/PS3BT.ino#L15>.
121+
__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).
120122

121123
For more information about the PS3 protocol see the official wiki: <https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information>.
122124

@@ -195,12 +197,17 @@ WII Wii(&Btd);
195197

196198
Then just press any button on the Wiimote and it will then connect to the dongle.
197199

198-
Take a look at the example for more information: <https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/Wii/Wii.ino>.
200+
Take a look at the example for more information: [Wii.ino](examples/Bluetooth/Wii/Wii.ino).
199201

200202
Also take a look at the blog post:
201203

202204
* <http://blog.tkjelectronics.dk/2012/08/wiimote-added-to-usb-host-library/>
203205

206+
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).
207+
208+
The [WiiIRCamera.ino](examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino) example shows how it can be used.
209+
210+
204211
All the information about the Wii controllers are from these sites:
205212

206213
* <http://wiibrew.org/wiki/Wiimote>

Wii.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
#include "BTD.h"
2424
#include "controllerEnums.h"
2525

26-
/** You will have to uncomment this to use the IR camera */
27-
//#define WIICAMERA
28-
2926
/* Wii event flags */
3027
#define WII_FLAG_MOTION_PLUS_CONNECTED 0x01
3128
#define WII_FLAG_NUNCHUCK_CONNECTED 0x02
@@ -281,7 +278,7 @@ class WII : public BluetoothService {
281278

282279
#ifdef WIICAMERA
283280
/** @name Wiimote IR camera functions
284-
* You will have to uncomment #WIICAMERA in Wii.h to use the IR camera.
281+
* You will have to set ENABLE_WII_IR_CAMERA in settings.h to 1 in order use the IR camera.
285282
*/
286283
/** Initialises the camera as per the steps from: http://wiibrew.org/wiki/Wiimote#IR_Camera */
287284
void IRinitialize();

WiiCameraReadme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Please see <http://wiibrew.org/wiki/Wiimote#IR_Camera> for the complete capabili
22

33
This library is large, if you run into memory problems when uploading to the Arduino, disable serial debugging.
44

5-
To enable the IR camera code, uncomment \#define WIICAMERA in Wii.h.
5+
To enable the IR camera code, simply set ```ENABLE_WII_IR_CAMERA``` to 1 in [settings.h](settings.h).
66

77
This library implements the following settings:
88

examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Otherwise, wire up a IR LED yourself.
1919
#endif
2020

2121
#ifndef WIICAMERA // Used to check if WIICAMERA is defined
22-
#error "Uncomment WIICAMERA in Wii.h to use this example"
22+
#error "Please set ENABLE_WII_IR_CAMERA to 1 in settings.h"
2323
#endif
2424

2525
USB Usb;

settings.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737
/* Set this to a one to use the xmem2 lock. This is needed for multitasking and threading */
3838
#define USE_XMEM_SPI_LOCK 0
3939

40+
////////////////////////////////////////////////////////////////////////////////
41+
// Wii IR camera
42+
////////////////////////////////////////////////////////////////////////////////
43+
44+
/* Set this to 1 to activate code for the Wii IR camera */
45+
#define ENABLE_WII_IR_CAMERA 0
46+
4047
////////////////////////////////////////////////////////////////////////////////
4148
// MASS STORAGE
4249
////////////////////////////////////////////////////////////////////////////////
@@ -47,7 +54,6 @@
4754
#define MASS_MAX_SUPPORTED_LUN 8
4855
#endif
4956

50-
5157
////////////////////////////////////////////////////////////////////////////////
5258
// Set to 1 to use the faster spi4teensy3 driver.
5359
////////////////////////////////////////////////////////////////////////////////
@@ -62,10 +68,6 @@
6268
// No user serviceable parts below this line.
6369
// DO NOT change anything below here unless you are a developer!
6470

65-
#if !defined(DEBUG_USB_HOST) && ENABLE_UHS_DEBUGGING
66-
#define DEBUG_USB_HOST
67-
#endif
68-
6971
// When will we drop support for the older bug-ridden stuff?
7072
#if defined(ARDUINO) && ARDUINO >=100
7173
#include <Arduino.h>
@@ -93,6 +95,14 @@
9395
#endif
9496
#endif
9597

98+
#if !defined(DEBUG_USB_HOST) && ENABLE_UHS_DEBUGGING
99+
#define DEBUG_USB_HOST
100+
#endif
101+
102+
#if !defined(WIICAMERA) && ENABLE_WII_IR_CAMERA
103+
#define WIICAMERA
104+
#endif
105+
96106
#if USE_XMEM_SPI_LOCK | defined(USE_MULTIPLE_APP_API)
97107
#include <xmem.h>
98108
#else

0 commit comments

Comments
 (0)