Code for the Wii IR camera needs to be activated in settings.h now

Also cleaned up README.md a bit
This commit is contained in:
Kristian Lauszus 2013-12-30 16:19:34 +01:00
parent fcdf6abfa0
commit f676812f84
5 changed files with 30 additions and 16 deletions

View file

@ -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:
<https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3SPP/PS3SPP.ino>.
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: <https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/BTHID/BTHID.ino> 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:
* <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
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: <https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3BT/PS3BT.ino#L15>.
__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: <https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information>.
@ -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: <https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/Wii/Wii.ino>.
Take a look at the example for more information: [Wii.ino](examples/Bluetooth/Wii/Wii.ino).
Also take a look at the blog post:
* <http://blog.tkjelectronics.dk/2012/08/wiimote-added-to-usb-host-library/>
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:
* <http://wiibrew.org/wiki/Wiimote>

5
Wii.h
View file

@ -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();

View file

@ -2,7 +2,7 @@ Please see <http://wiibrew.org/wiki/Wiimote#IR_Camera> 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:

View file

@ -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;

View file

@ -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 <Arduino.h>
@ -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 <xmem.h>
#else