z ysaito / USBHost2

Dependencies:   FATFileSystem2 mbed-rtos

Fork of USBHost by mbed official

Embed: (wiki syntax)

« Back to documentation index

USBHostGamepad Class Reference

USBHostGamepad Class Reference

A class to communicate a USB MIDI device. More...

#include <USBHostGamepad.h>

Inherits IUSBEnumerator.

Public Member Functions

 USBHostGamepad ()
 Constructor.
bool connect ()
 Try to connect a gamepad device.
bool connected ()
 Check if a gamepad is connected.
void attachEvent (void(*ptr)(uint8_t btn00, uint8_t btn01, uint8_t btn02, uint8_t btn03, uint8_t btn04, uint8_t btn05, uint8_t btn06, uint8_t btn07, uint8_t btn08, uint8_t btn09, uint8_t btn10, uint8_t btn11, uint8_t btn12, uint8_t btn13, uint8_t btn14, uint8_t btn15, uint16_t gamePadVID, uint16_t gamePadPID))
 Attach a callback called when a gamepad event is received.
USB_TYPE getReportDescriptor (USBDeviceConnected *dev, uint8_t *buf, uint16_t max_len_buf, uint16_t *len_rep_descr=NULL)
 Request the HID report descriptor.

Detailed Description

A class to communicate a USB MIDI device.

Definition at line 44 of file USBHostGamepad.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 26 of file USBHostGamepad.cpp.


Member Function Documentation

void attachEvent ( void(*)(uint8_t btn00, uint8_t btn01, uint8_t btn02, uint8_t btn03, uint8_t btn04, uint8_t btn05, uint8_t btn06, uint8_t btn07, uint8_t btn08, uint8_t btn09, uint8_t btn10, uint8_t btn11, uint8_t btn12, uint8_t btn13, uint8_t btn14, uint8_t btn15, uint16_t gamePadVID, uint16_t gamePadPID)  ptr )

Attach a callback called when a gamepad event is received.

Parameters:
ptrfunction pointer

Definition at line 71 of file USBHostGamepad.h.

bool connect (  )

Try to connect a gamepad device.

Returns:
true if connection was successful

Definition at line 67 of file USBHostGamepad.cpp.

bool connected (  )

Check if a gamepad is connected.

Returns:
true if a gamepad is connected

Definition at line 63 of file USBHostGamepad.cpp.

USB_TYPE getReportDescriptor ( USBDeviceConnected dev,
uint8_t *  buf,
uint16_t  max_len_buf,
uint16_t *  len_rep_descr = NULL 
)

Request the HID report descriptor.

Parameters:
devrequest the device descriptor on this device
bufbuffer to store the device descriptor
max_len_bufmaximum size of buf
len_dev_descrpointer to store the length of the packet transferred

Definition at line 210 of file USBHostGamepad.cpp.