Skip to content

moyuchin/WiiRemote_on_Arduino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

This is Arduino library for WiiRemote Bluetooth stack which supports minimum HCI and L2CAP layer for HID profile.

== First of all ==
This program is based on <wiiblue.pde> which is developed by Richard Ibbotson.
This program also needs MAX3421E and USB libraries for Arduino written by Oleg Mazurov.
The source codes can be grabbed from <https://github.com/felis/USB_Host_Shield>.


== Hardware Requirement ==
    * Arduino
    * USB Host Shield
    * USB Bluetooth Device


== Software Requirement ==
    * MAX3421E and USB library for Arduino written by Oleg Mazurov


== GNU GPL ==
WiiRemote Bluetooth stack on Arduino with USB Host Shield
Copyright (C) 2010 Tomo Tanaka

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.


== Files ==
    WiiRemote/
        +- WiiRemote.h
        +- WiiRemote.cpp
        +- keywords.txt
        |
        +- Max3421e_constants.h // written by Oleg
        +- Max3421e.h           // written by Oleg
        +- Max3421e.cpp         // written by Oleg
        +- ch9.h                // written by Oleg
        +- Usb.h                // written by Oleg
        +- Usb.cpp              // written by Oleg
        |
        +- examples/
            +- SteeringWii/
                +- SteeringWii.pde


== Usage ==

=== Modify USB Device Descriptors ===
The values of CSR_VID and CSR_PID described in WiiRemote.h need to be modified
to match descriptors of USB Bluetooth Device to be used.


== WiiRemote Class ==

=== Methods ===
    * void init(void)

    * void task(void (*pFunc)(void))

    * uint8_t getStatus(void)
            This returns unsigned int as the status of USB Bluetooth Device and
            WiiRemote connection. Bit field shows as follows:
            bit 0:  WIIREMOTE_STATE_USB_AUTHORIZED
                    USB BT Device is authorized as the library expects.
            bit 1:  WIIREMOTE_STATE_USB_CONFIGURED
                    USB BT Device is plugged into the USB port on the Shield.
            bit 2:  WIIREMOTE_STATE_CONNECTED
                    WiiRemote has been connected to USB BT Device.
            bit 3:  WIIREMOTE_STATE_RUNNING
                    WiiRemote has been established L2CAP connection.

    * void setBDAddress(uint8_t *bdaddr, int size)

    * void setBDAddressMode(eBDAddressMode mode)
            This selects how to acquire BD_ADDR to establish HCI connection.
            The mode can be set:
                BD_ADDR_FIXED:    Use specified BD_ADDR set by setBDAddress().
                BD_ADDR_INQUIRY:  Discover BD_ADDR of WiiRemote to be connected.

    * void getBDAddress(uint8_t *bdaddr, int size)

    * uint8_t setLED(uint8_t led)
            This turns on/off LEDs of WiiRemote. setLED(0x0) turns off all LEDs,
            setLED(0x10) turns on LED1 and setLED(0xf0) turns o all LEDs.
            These enum can be used:
                WIIREMOTE_LED1 = 0x10,
                WIIREMOTE_LED2 = 0x20,
                WIIREMOTE_LED3 = 0x40,
                WIIREMOTE_LED4 = 0x80,

    * bool buttonPressed(uint16_t button)
            This returns the state of WiiRemote button specified in the call.
            True if the button pressed. Buttons are:
                WIIREMOTE_LEFT  = 0x0001,
                WIIREMOTE_RIGHT = 0x0002,
                WIIREMOTE_DOWN  = 0x0004,
                WIIREMOTE_UP    = 0x0008,
                WIIREMOTE_PLUS  = 0x0010,
                WIIREMOTE_TWO   = 0x0100,
                WIIREMOTE_ONE   = 0x0200,
                WIIREMOTE_B     = 0x0400,
                WIIREMOTE_A     = 0x0800,
                WIIREMOTE_MINUS = 0x1000,
                WIIREMOTE_HOME  = 0x8000,

    * bool buttonClicked(uint16_t button)
            This checkes whether a specified WiiRemote button is clicked.
            True if the button clicked. Buttons are the same as above.

=== Member Variables ===
    * Report_t Report


== Hint ==
Hints from PS3 and Wiimote game controllers thread in Circuit@Home.
    - Bluetooth 1.x seems not work on this library.


== ACKNOWLEDGEMENT ==
I appreciate the gread codes developed by Richard and Oleg :-)

About

Wii Remote, Arduino, USB Host Shield, Circuit at home

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published