Xbox 360 Wireless Controller for Windows library
Dependencies: USBHost USBHostXpad mbed
Fork of USBHostMSD_HelloWorld by
Xbox 360 Wireless Controller for Windows
Microsoftの XBOX 360 ワイヤレスコントローラーを、パソコン用のUSB接続型レシーバーで mbed に接続して使えるライブラリです。
ワイヤードのXBOX360コントローラーや、初代XBOXコントローラーのコードも含んでいますが未確認です。
USB Host 機能を使いますので mbed LPC1768 専用です。
たまに usb_thread could not read dev descr を出力して処理が停止する不具合があります。
Import libraryUSBHostXpad
Xbox 360 Wireless Controller for Windows library. sample: http://mbed.org/users/okini3939/code/USBHostXpad_HelloWorld/
Revision 1:473f339c54c1, committed 2013-03-12
- Comitter:
- samux
- Date:
- Tue Mar 12 17:30:04 2013 +0000
- Parent:
- 0:0d68fe822228
- Child:
- 2:3e3df7a79050
- Commit message:
- use latest USBHost
Changed in this revision
USBHost.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/USBHost.lib Wed Mar 06 17:06:56 2013 +0000 +++ b/USBHost.lib Tue Mar 12 17:30:04 2013 +0000 @@ -1,1 +1,1 @@ -https://mbed.org/users/mbed_official/code/USBHost/#a554658735bf +https://mbed.org/users/mbed_official/code/USBHost/#b320d68e98e7
--- a/main.cpp Wed Mar 06 17:06:56 2013 +0000 +++ b/main.cpp Tue Mar 12 17:30:04 2013 +0000 @@ -10,23 +10,30 @@ while(1) { - // try to connect a USB flash disk - while(!msd.connect()) + // try to connect a MSD device + while(!msd.connect()) { + Thread::wait(500); + } + + while(1) { + + FILE * fp = fopen("/usb/test1.txt", "a"); + + if (fp != NULL) { + fprintf(fp, "Hello fun SD Card World: %d!\r\n", i++); + printf("Goodbye World!\r\n"); + fclose(fp); + } else { + printf("FILE == NULL\r\n"); + } + Thread::wait(500); - FILE * fp = fopen("/usb/test.txt", "a"); - - if (fp != NULL) { - fprintf(fp, "Hello fun SD Card World: %d!\r\n", i++); - printf("Goodbye World!\r\n"); - fclose(fp); - } else { - printf("FILE == NULL\r\n"); + // if device disconnected, try to connect again + if (!msd.connected()) + break; } - - // wait until the msd disk is disconnected - while(msd.connected()) - Thread::wait(500); + } }