Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Nucleo_Ex04_USBPAD by
main.cpp
00001 // Pins connections: 5V-Vbus | GND-GND | Data+-PA_12 | Data--PA_11 00002 // Cannot establish connection with full speed devices, why??? 00003 00004 #include "mbed.h" 00005 #include "USBHostGamepad.h" 00006 00007 USBHostGamepad *pad; 00008 00009 Serial serial(SERIAL_TX, SERIAL_RX); 00010 00011 // LED 00012 DigitalOut led(LED1, 0); // Create the LED object and setup OFF 00013 00014 int main() 00015 { 00016 // USB Gamepad Initialize 00017 pad = new USBHostGamepad(); 00018 if (!pad->connect()) { 00019 serial.printf("USB Connection failed\r\n"); 00020 while(1); 00021 } 00022 else 00023 { 00024 led = 1; 00025 serial.printf("USB Connection stablished\r\n"); 00026 } 00027 00028 while(1) 00029 { 00030 USBHost::poll(); 00031 00032 serial.printf("%02x %02x %02x %02x %02x %02x %02x %02x\r\n", pad->report[0],pad->report[1],pad->report[2],pad->report[3],pad->report[4],pad->report[5],pad->report[6],pad->report[7]); 00033 wait_ms(16); 00034 } 00035 }
Generated on Thu Jul 14 2022 22:16:22 by
1.7.2
