2015-08-20 23:38:52 -04:00
|
|
|
#ifndef USBPAD_H__
|
|
|
|
#define USBPAD_H__
|
|
|
|
|
2015-12-06 23:13:43 -05:00
|
|
|
#include "gamepads.h"
|
2015-10-17 17:21:22 -04:00
|
|
|
#include "usb.h"
|
|
|
|
|
2016-10-10 14:19:58 -04:00
|
|
|
#define USBPAD_REPORT_SIZE 15
|
|
|
|
|
|
|
|
struct usbpad {
|
|
|
|
volatile unsigned char gamepad_vibrate; // output
|
|
|
|
unsigned char vibration_on, force_vibrate;
|
|
|
|
unsigned char constant_force;
|
|
|
|
unsigned char periodic_magnitude;
|
|
|
|
|
|
|
|
unsigned char _FFB_effect_index;
|
|
|
|
#define LOOP_MAX 0xFFFF
|
|
|
|
unsigned int _loop_count;
|
|
|
|
|
|
|
|
unsigned char gamepad_report0[USBPAD_REPORT_SIZE];
|
|
|
|
unsigned char hid_report_data[8]; // Used for force feedback
|
|
|
|
};
|
|
|
|
|
|
|
|
void usbpad_init(struct usbpad *pad);
|
2015-08-20 23:38:52 -04:00
|
|
|
int usbpad_getReportSize(void);
|
2016-10-10 14:19:58 -04:00
|
|
|
unsigned char *usbpad_getReportBuffer(struct usbpad *pad);
|
2015-10-17 17:21:22 -04:00
|
|
|
|
2016-10-10 14:19:58 -04:00
|
|
|
void usbpad_update(struct usbpad *pad, const gamepad_data *pad_data);
|
|
|
|
char usbpad_mustVibrate(struct usbpad *pad);
|
|
|
|
void usbpad_forceVibrate(struct usbpad *pad, char force);
|
2015-10-17 17:21:22 -04:00
|
|
|
|
2016-10-10 14:19:58 -04:00
|
|
|
uint8_t usbpad_hid_set_report(struct usbpad *pad, const struct usb_request *rq, const uint8_t *data, uint16_t len);
|
|
|
|
uint16_t usbpad_hid_get_report(struct usbpad *pad, struct usb_request *rq, const uint8_t **dat);
|
2015-08-20 23:38:52 -04:00
|
|
|
|
2015-08-22 00:44:51 -04:00
|
|
|
// For mappings. ID starts at 0.
|
|
|
|
#define USB_BTN(id) (0x0001 << (id))
|
|
|
|
|
2015-08-20 23:38:52 -04:00
|
|
|
#endif // USBPAD_H__
|