banner



How To Put Xbox One S In Sleep Mode

USB Host Library Rev. ii.0

The lawmaking is released under the GNU General Public License.


Summary

This is Revision ii.0 of MAX3421E-based USB Host Shield Library for AVR'southward.

Projection main spider web site is: https://chome.nerpa.tech/arduino_usb_host_shield_projects/.

Some information can likewise be found at: http://blog.tkjelectronics.dk/.

The shield can be purchased from TKJ Electronics: http://shop.tkjelectronics.dk/product_info.php?products_id=43.

USB Host Shield

For more than information virtually the hardware see the Hardware Manual.

Developed By

  • Oleg Mazurov - mazurov@gmail.com
  • Alexei Glushchenko - alex-gl@mail.ru
    • Developers of the USB Core, HID, FTDI, ADK, ACM, and PL2303 libraries
  • Kristian Sloth Lauszus - lauszus@gmail.com
    • Developer of the BTD, BTHID, SPP, PS5, PS4, PS3, Wii, Switch Pro, Xbox, and PSBuzz libraries
  • Andrew Kroll - xxxajk@gmail.com
    • Major correspondent to mass storage code
  • guruthree
    • Xbox Ane controller support
  • Yuuichi Akagawa - @YuuichiAkagawa
    • Developer of the MIDI library
  • Aran Vink - aranvink@gmail.com
    • Programmer of the amBX library

Table of Contents

  • How to include the library
    • Arduino Library Manager
    • Manual installation
  • How to use the library
    • Documentation
    • Enable debugging
    • Boards
    • Bluetooth libraries
    • BTHID library
    • SPP library
    • PS5 Library
    • PS4 Library
    • PS3 Library
    • Xbox Libraries
      • Xbox library
      • Xbox 360 Library
      • Xbox ONE Library
      • Xbox ONE S Library
    • Wii library
    • Switch Pro Library
    • PS Fizz Library
    • HID Libraries
    • MIDI Library
    • amBX Library
  • Interface modifications
  • FAQ

How to include the library

Arduino Library Manager

First install Arduino IDE version i.6.2 or newer, and then simply use the Arduino Library Managing director to install the library.

Please see the following page for instructions: http://www.arduino.cc/en/Guide/Libraries#toc3.

Manual installation

Outset download the library by clicking on the post-obit link: https://github.com/felis/USB_Host_Shield_2.0/archive/master.zip.

Then uncompress the nix folder and rename the directory to "USB_Host_Shield_20", every bit any special characters are not supported by the Arduino IDE.

Now open upwards the Arduino IDE and open "File>Preferences". There you lot will see the location of your sketchbook. Open that directory and create a directory called "libraries" inside that directory. Now move the "USB_Host_Shield_20" directory to the "libraries" directory.

The final structure should wait like this:

  • Arduino/
    • libraries/
      • USB_Host_Shield_20/

Now quit the Arduino IDE and reopen it.

Now you should be able to become open all the examples codes past navigating to "File>Examples>USB_Host_Shield_20" and then select the example y'all will like to open up.

For more information visit the following sites: http://arduino.cc/en/Guide/Libraries and https://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-apply.

How to use the library

Documentation

Documentation for the library can be found at the post-obit link: https://felis.github.io/USB_Host_Shield_2.0/.

Enable debugging

By default serial debugging is disabled. To turn it on just modify ENABLE_UHS_DEBUGGING to 1 in settings.h like and so:

#define              ENABLE_UHS_DEBUGGING              1            

Boards

Currently the following boards are supported by the library:

  • All official Arduino AVR boards (Uno, Duemilanove, Mega, Mega 2560, Mega ADK, Leonardo etc.)
  • Arduino Due, Intel Galileo, Intel Galileo two, and Intel Edison
    • Annotation that the Intel Galileo uses pivot 2 and iii equally INT and SS pin respectively by default, so some modifications to the shield are needed. See the "Interface modifications" department in the hardware manual for more than data.
    • Note native USB host is not supported on any of these platforms. You will accept to employ the shield for now.
  • Teensy (Teensy++ i.0, Teensy 2.0, Teensy++ two.0, Teensy 3.x, Teensy LC and Teensy 4.x)
    • Note if y'all are using the Teensy 3.10 you lot should download this SPI library equally well: https://github.com/xxxajk/spi4teensy3. Y'all should then add together #include <spi4teensy3.h> to your .ino file.
  • Balanduino
  • Sanguino
  • Black Widdow
  • RedBearLab nRF51822
  • Adafruit Feather nRF52840 Express
  • Digilent chipKIT
    • Please see: https://chome.nerpa.tech/mcu/usb/running-usb-host-code-on-digilent-chipkit-board.
  • STM32F4
    • Currently the NUCLEO-F446RE is supported featuring the STM32F446. Take a expect at the following example code: https://github.com/Lauszus/Nucleo_F446RE_USBHost.
  • ESP8266 is supported using the ESP8266 Arduino core
    • Note information technology uses pivot fifteen and 5 for SS and INT respectively
    • Also please be enlightened that:
      • GPIO16 is Not usable, as it will be used for another purposes. For example, reset the SoC itself from sleep manner.
      • GPIO6 to 11 is also Not usable, as they are used to connect SPI flash chip and it is used for storing the executable binary content.
  • ESP32 is supported using the arduino-esp32
    • GPIO5 : SS, GPIO17 : INT, GPIO18 : SCK, GPIO19 : MISO, GPIO23 : MOSI

The following boards need to be activated manually in settings.h:

  • Arduino Mega ADK
    • If you lot are using Arduino one.v.5 or newer at that place is no need to activate the Arduino Mega ADK manually
  • Black Widdow

Simply fix the corresponding value to 1 instead of 0.

Bluetooth libraries

The BTD library is a general purpose library for an ordinary Bluetooth dongle. This library arrive easy to add support for dissimilar Bluetooth services like a PS3 or a Wii controller or SPP which is a virtual serial port via Bluetooth. Some different examples can exist plant in the example directory.

The BTD library also makes it possible to use multiple services at in one case, the post-obit instance sketch is an example of this: PS3SPP.ino.

BTHID library

The Bluetooth HID library allows yous to connect HID devices via Bluetooth to the USB Host Shield.

Currently HID mice and keyboards are supported.

It uses the standard Boot protocol by default, just it is likewise able to use the Study protocol too. You would simply have to telephone call setProtocolMode() and then parse HID_RPT_PROTOCOL as an statement. You will and so have to modify the parser for your device. Run into the example: BTHID.ino for more data.

The PS4 library also uses this class to handle all Bluetooth communication.

For information run across the following blog mail service: http://blog.tkjelectronics.dk/2013/12/bluetooth-hid-devices-now-supported-by-the-usb-host-library/.

SPP library

SPP stands for "Series Port Profile" and is a Bluetooth protocol that implements a virtual comport which allows you lot to send data back and forth from your reckoner/telephone to your Arduino via Bluetooth. It has been tested successfully on Windows, Mac Os X, Linux, and Android.

Take a await at the SPP.ino example for more information.

More information tin be institute at these web log posts:

  • http://chome.nerpa.tech/mcu/bluetooth-rfcommspp-service-support-for-usb-host-2-0-library-released
  • http://weblog.tkjelectronics.dk/2012/07/rfcommspp-library-for-arduino/

To implement the SPP protocol I used a Bluetooth sniffing tool called PacketLogger adult past Apple. It enables me to see the Bluetooth communication betwixt my Mac and any device.

PS5 Library

The PS5 library is split into the PS5BT and the PS5USB library. These allow you to utilize the Sony PS5 controller via Bluetooth and USB.

The PS5BT.ino and PS5USB.ino examples shows how to easily read the buttons, joysticks, touchpad and IMU on the controller via Bluetooth and USB respectively. It is also possible to control the rumble, lightbar, microphone LED and actor LEDs on the controller. Furthermore the new haptic trigger furnishings are also supported.

To pair with the PS5 controller via Bluetooth you need create the PS5BT example like so: PS5BT PS5(&Btd, PAIR); and and so hold downwardly the Create button so hold down the PS without releasing the Create button. The PS5 controller will then start to glimmer bluish indicating that it is in pairing mode.

It should then automatically pair the dongle with your controller. This only accept to exist washed in one case.

Thanks to Joseph Duchesne for the initial USB lawmaking.

The driver is based on the official Sony driver for Linux: https://patchwork.kernel.org/project/linux-input/cover/20201219062336.72568-ane-roderick@gaikai.com/.

Also thanks to Ludwig Füchsl's https://github.com/Ohjurot/DualSense-Windows for his piece of work on the haptic triggers.

PS4 Library

The PS4 library is divide into the PS4BT and the PS4USB library. These allow you to use the Sony PS4 controller via Bluetooth and USB.

The PS4BT.ino and PS4USB.ino examples shows how to easily read the buttons, joysticks, touchpad and IMU on the controller via Bluetooth and USB respectively. Information technology is too possible to control the rumble and low-cal on the controller and go the battery level.

Before you lot can use the PS4 controller via Bluetooth you will need to pair with it.

Simply create the PS4BT instance like so: PS4BT PS4(&Btd, PAIR); and so hold down the Share push button and then hold down the PS without releasing the Share button. The PS4 controller will and so start to glimmer rapidly indicating that it is in pairing manner.

It should then automatically pair the dongle with your controller. This only accept to be done in one case.

For information run into the following blog post: http://blog.tkjelectronics.dk/2014/01/ps4-controller-now-supported-by-the-usb-host-library/.

Also check out this excellent Wiki past Frank Zhao almost the PS4 controller: http://eleccelerator.com/wiki/index.php?title=DualShock_4 and this Linux driver: https://github.com/chrippa/ds4drv.

Several guides on how to use the PS4 library has been written by Dr. James E. Barger and are bachelor at the following link: https://sites.google.com/view/crosswaystation/ps4-tutorials.

PS3 Library

These libraries consist of the PS3BT and PS3USB. These libraries allows yous to use a Dualshock iii, Navigation or a Motion controller with the USB Host Shield both via Bluetooth and USB.

In social club to utilise your Playstation controller via Bluetooth you accept to set the Bluetooth address of the dongle internally to your PS3 Controller. This can exist accomplished by offset plugging in the Bluetooth dongle and await a few seconds. Now plug in the controller via USB and look until the LEDs first to flash. The library has now written the Bluetooth address of the dongle to the PS3 controller.

Finally simply plug in the Bluetooth dongle again and press PS on the PS3 controller. Later on a few seconds it should be continued to the dongle and set up to employ.

Annotation: You volition have to plug in the Bluetooth dongle before connecting the controller, every bit the library needs to read the address of the dongle. Alternatively you could set it in code like and then: PS3BT.ino#L20.

For more than data about the PS3 protocol run into the official wiki: https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information.

Also take a look at the blog posts:

  • http://blog.tkjelectronics.dk/2012/01/ps3-controller-bt-library-for-arduino/
  • http://chome.nerpa.tech/mcu/sony-ps3-controller-support-added-to-usb-host-library
  • http://chome.nerpa.tech/mcu/arduino/interfacing-ps3-controllers-via-usb

A special thanks go to the post-obit people:

  1. Richard Ibbotson who fabricated this excellent guide: http://chome.nerpa.tech/mcu/ps3-and-wiimote-game-controllers-on-the-arduino-host-shield-role
  2. Tomoyuki Tanaka for releasing his lawmaking for the Arduino USB Host shield connected to the wiimote: http://chome.nerpa.tech/mcu/rc-car-controlled-by-wii-remote-on-arduino

As well a big thank you all the people behind these sites nigh the Motion controller:

  • http://thp.io/2010/psmove/
  • http://www.copenhagengamecollective.org/unimove/
  • https://github.com/thp/psmoveapi
  • http://code.google.com/p/moveonpc/

Xbox Libraries

The library supports both the original Xbox controller via USB and the Xbox 360 controller both via USB and wirelessly.

Xbox library

The XBOXOLD class implements support for the original Xbox controller via USB.

All the information are from the following sites:

  • https://github.com/torvalds/linux/blob/master/Documentation/input/xpad.txt
  • https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c
  • http://euc.jp/periphs/xbox-controller.ja.html
  • https://github.com/Grumbel/xboxdrv/hulk/master/PROTOCOL#L15

Xbox 360 Library

The library support ane Xbox 360 via USB or upwardly to four Xbox 360 controllers wirelessly by using a Xbox 360 wireless receiver.

To utilize it via USB use the XBOXUSB library or to employ it wirelessly use the XBOXRECV library.

Note that a Wireless controller tin NOT be used via USB!

Examples code can be found in the examples directory.

Likewise see the following blog posts:

  • http://chome.nerpa.tech/mcu/xbox360-controller-support-added-to-usb-host-shield-2-0-library
  • http://blog.tkjelectronics.dk/2012/07/xbox-360-controller-support-added-to-the-usb-host-library/
  • http://web log.tkjelectronics.dk/2012/12/xbox-360-receiver-added-to-the-usb-host-library/

All the information regarding the Xbox 360 controller protocol are form these sites:

  • http://tattiebogle.internet/index.php/ProjectRoot/Xbox360Controller/UsbInfo
  • http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/WirelessUsbInfo
  • https://github.com/Grumbel/xboxdrv/blob/master/PROTOCOL

Xbox I Library

A Xbox I controller is supported via USB in the XBOXONE grade. It is heavily based on the 360 library higher up. In improver to cross referencing the above, information on the protocol was found at:

  • https://github.com/quantus/xbox-one-controller-protocol
  • https://github.com/torvalds/linux/blob/principal/drivers/input/joystick/xpad.c
  • https://github.com/kylelemons/xbox/hulk/main/xbox.go

Xbox ONE South Library

A Xbox Ane controller is supported via Bluetooth in the XBOXONESBT class.

Special thanks to HisashiKato for his help: #252 (comment).

Wii library

The Wii library support the Wiimote, simply also the Nunchuch and Move Plus extensions via Bluetooth. The Wii U Pro Controller and Wii Balance Board are also supported via Bluetooth.

Get-go yous have to pair with the controller, this is done automatically by the library if yous create the case like so:

And and then press 1 & 2 at once on the Wiimote or the SYNC buttons if you are using a Wii U Pro Controller or a Wii Balance Board.

Later on that you tin simply create the instance like then:

And then just press any push button on the Wiimote and it volition then connect to the dongle.

Take a look at the example for more than information: Wii.ino.

Besides take a expect at the web log post:

  • http://weblog.tkjelectronics.dk/2012/08/wiimote-added-to-usb-host-library/

The Wii IR photographic camera can likewise be used, just you will accept to activate the code for it manually as it is quite large. Simply set ENABLE_WII_IR_CAMERA to 1 in settings.h.

The WiiIRCamera.ino instance shows how it tin exist used.

All the information almost the Wii controllers are from these sites:

  • http://wiibrew.org/wiki/Wiimote
  • http://wiibrew.org/wiki/Wiimote/Extension_Controllers
  • http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck
  • http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Wii_Motion_Plus
  • http://wiibrew.org/wiki/Wii_Balance_Board
  • The old library created by Tomoyuki Tanaka: https://github.com/moyuchin/WiiRemote_on_Arduino as well helped a lot.

Switch Pro Library

The Switch Pro library is dissever up into the SwitchProBT and the SwitchProUSB library. These let you to use the Nintendo Switch Pro controller via Bluetooth and USB.

The SwitchProBT.ino and SwitchProUSB.ino examples shows how to easily read the buttons, joysticks and IMU on the controller via Bluetooth and USB respectively. It is also possible to command the rumble and LEDs on the controller.

To pair with the Switch Pro controller via Bluetooth y'all need create the SwitchProBT instance similar so: SwitchProBT SwitchPro(&Btd, PAIR); and and so press the Sync button next to the USB connector to put the controller into pairing mode.

Information technology should so automatically pair the dongle with your controller. This only have to be done once.

All the information about the controller are from these sites:

  • https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering
  • https://github.com/Dan611/hid-procon

PS Buzz Library

This library implements support for the Playstation Buzz controllers via USB.

It is essentially simply a wrapper around the HIDUniversal which takes care of the initializing and reading of the controllers. The PSBuzz course merely inherits this and parses the data, and so information technology is easy for users to read the buttons and turn the big red button on the controllers on and off.

The example PSBuzz.ino shows how one can do this with only a few lines of code.

More than information almost the controller can be found at the following sites:

  • http://www.developerfusion.com/article/84338/making-usb-c-friendly/
  • https://github.com/torvalds/linux/hulk/master/drivers/hid/hid-sony.c

HID Libraries

HID devices are also supported by the library. All the same these require you lot to write your own driver. A few example are provided in the examples/HID directory. Including an example for the SteelSeries SRW-S1 Steering Cycle.

MIDI Library

The library support MIDI devices. You can convert USB MIDI keyboard to legacy serial MIDI.

  • USB_MIDI_converter.ino
  • USB_MIDI_converter_multi.ino

For more information see : https://github.com/YuuichiAkagawa/USBH_MIDI.

amBX Library

This library back up Philips amBX lights. You tin ready the colors of the lights individually or all at once. The rumble pad and fans are not supported.

  • AMBX.ino

Interface modifications

The shield is using SPI for communicating with the MAX3421E USB host controller. It uses the SCK, MISO and MOSI pins via the ICSP on your board.

Note this means that it uses pivot xiii, 12, xi on an Arduino Uno, so these pins tin not exist used for anything else than SPI advice!

Furthermore it uses one pin equally SS and one INT pivot. These are by default located on pin 10 and 9 respectively. They tin can easily be reconfigured in case y'all need to use them for something else by cutting the jumper on the shield and and then solder a wire from the pad to the new pin.

Later on that you need alter the following entry in UsbCore.h:

              typedef              MAX3421e<P10, P9> MAX3421E;

For example if you lot accept rerouted SS to pin 7 it should read:

              typedef              MAX3421e<P7, P9> MAX3421E;

See the "Interface modifications" section in the hardware manual for more information.

FAQ

When I plug my device into the USB connector zip happens?

  • Try to connect a external ability supply to the Arduino - this solves the trouble in most cases.
  • You can likewise apply a powered hub between the device and the USB Host Shield. You should then include the USB hub library: #include <usbhub.h> and create the instance like so: USBHub Hub1(&Usb);.

When I connecting my PS3 controller I get a output like this:

              Dualshock iii Controller Enabled  LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0                          
  • This means that your dongle does non support 2.0+EDR, then you will demand some other dongle. Delight see the post-obit listing for tested working dongles.

When compiling I am getting the following error: "fatal mistake: SPI.h: No such file or directory".

  • Delight brand sure to include the SPI library similar so: #include <SPI.h> in your .ino file.

Source: https://github.com/felis/USB_Host_Shield_2.0

Posted by: johnsablessairse.blogspot.com

0 Response to "How To Put Xbox One S In Sleep Mode"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel