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.
USBGamepad Class Reference
USBJoystick example. More...
#include <USBGamepad.h>
Inherited by MyUSBGamepad.
Public Member Functions | |
| USBGamepad (uint16_t vendor_id=0x1234, uint16_t product_id=0x0100, uint16_t product_release=0x0001, int waitForConnect=true) | |
| Constructor. | |
| bool | update (uint32_t buttons) |
| Write a state of the USBGamepad. | |
| bool | update () |
| Write a state of the USBGamepad. | |
| bool | buttons (uint32_t buttons) |
| Press one or several buttons. | |
Detailed Description
USBJoystick example.
#include "mbed.h" #include "USBJoystick.h" USBJoystick joystick; int main(void) { while (1) { joystick.move(20, 0); wait(0.5); } }
#include "mbed.h" #include "USBJoystick.h" #include <math.h> USBJoystick joystick; int main(void) { while (1) { // Basic Joystick joystick.update(tx, y, z, buttonBits); wait(0.001); } }
Definition at line 78 of file USBGamepad.h.
Constructor & Destructor Documentation
| USBGamepad | ( | uint16_t | vendor_id = 0x1234, |
| uint16_t | product_id = 0x0100, |
||
| uint16_t | product_release = 0x0001, |
||
| int | waitForConnect = true |
||
| ) |
Constructor.
- Parameters:
-
vendor_id Your vendor_id (default: 0x1234) product_id Your product_id (default: 0x0002) product_release Your product_release (default: 0x0001)
Definition at line 88 of file USBGamepad.h.
Member Function Documentation
| bool buttons | ( | uint32_t | buttons ) |
Press one or several buttons.
- Parameters:
-
buttons button state, as a bitwise combination of JOY_Bn values
- Returns:
- true if there is no error, false otherwise
Definition at line 61 of file USBGamepad.cpp.
| bool update | ( | uint32_t | buttons ) |
Write a state of the USBGamepad.
- Parameters:
-
buttons buttons state, as a bit mask (combination with '|' of JOY_Bn values)
- Returns:
- true if there is no error, false otherwise
Definition at line 26 of file USBGamepad.cpp.
| bool update | ( | ) |
Write a state of the USBGamepad.
- Returns:
- true if there is no error, false otherwise
Definition at line 33 of file USBGamepad.cpp.
Generated on Fri Jul 15 2022 06:19:56 by
1.7.2