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 USBHostXpad by
Diff: USBHostXpad.h
- Revision:
- 1:5bb153989f33
- Parent:
- 0:bd0f6bf72a8b
- Child:
- 2:2749f4e649db
diff -r bd0f6bf72a8b -r 5bb153989f33 USBHostXpad.h --- a/USBHostXpad.h Tue Dec 10 06:50:37 2013 +0000 +++ b/USBHostXpad.h Wed Dec 11 04:11:04 2013 +0000 @@ -15,14 +15,14 @@ #include "USBHost.h" -#define XPAD_HAT_TOP 0x0001 -#define XPAD_HAT_BOTTOM 0x0002 +#define XPAD_HAT_UP 0x0001 +#define XPAD_HAT_DOWN 0x0002 #define XPAD_HAT_LEFT 0x0004 #define XPAD_HAT_RIGHT 0x0008 #define XPAD_START 0x0010 #define XPAD_BACK 0x0020 -#define XPAD_ANALOG_L 0x0040 -#define XPAD_ANALOG_R 0x0080 +#define XPAD_STICK_L 0x0040 +#define XPAD_STICK_R 0x0080 #define XPAD_PAD_LB 0x0100 #define XPAD_PAD_RB 0x0200 #define XPAD_XLOGO 0x0400 @@ -31,6 +31,20 @@ #define XPAD_PAD_X 0x4000 #define XPAD_PAD_Y 0x8000 +#define XPAD_LED_OFF 0x00 +#define XPAD_LED_BLINK 0x01 +#define XPAD_LED1_FLASH 0x02 +#define XPAD_LED2_FLASH 0x03 +#define XPAD_LED3_FLASH 0x04 +#define XPAD_LED4_FLASH 0x05 +#define XPAD_LED1_ON 0x06 +#define XPAD_LED2_ON 0x07 +#define XPAD_LED3_ON 0x08 +#define XPAD_LED4_ON 0x09 +#define XPAD_LED_ROTATE 0x0a +#define XPAD_LED_ALTERNATE 0x0d + + /** * A class to communicate a USB flash disk */ @@ -68,9 +82,10 @@ } } - bool effect(uint8_t strong, uint8_t weak); + bool led(int cmd); + bool rumble(uint8_t large, uint8_t small); - void poll (); + void restart (); protected: //From IUSBEnumerator @@ -97,7 +112,7 @@ void rxHandler(); void (*onUpdate)(int buttons, int stick_lx, int stick_ly, int stick_rx, int stick_ry, int trigger_l, int trigger_r); void init(); - bool probe(int val1, int val2, int val3, int val4); + bool send(int val1, int val2, int val3, int val4); };