summaryrefslogtreecommitdiff
path: root/include/usbh_driver_gp_xbox.h
diff options
context:
space:
mode:
authorAmir Hammad <amir.hammad@hotmail.com>2015-04-01 16:22:05 +0200
committerAmir Hammad <amir.hammad@hotmail.com>2015-04-01 16:22:05 +0200
commit7acc6fe474766788687a5257be21ac549bed77f3 (patch)
tree859e621840f9362e60fec116b7528ad16202871f /include/usbh_driver_gp_xbox.h
downloadsecure-hid-7acc6fe474766788687a5257be21ac549bed77f3.tar.gz
secure-hid-7acc6fe474766788687a5257be21ac549bed77f3.tar.bz2
secure-hid-7acc6fe474766788687a5257be21ac549bed77f3.zip
libusbhost: Open source USB host stack for embedded devices
First public version, date: 1.4.2015 Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
Diffstat (limited to 'include/usbh_driver_gp_xbox.h')
-rw-r--r--include/usbh_driver_gp_xbox.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/include/usbh_driver_gp_xbox.h b/include/usbh_driver_gp_xbox.h
new file mode 100644
index 0000000..8080f30
--- /dev/null
+++ b/include/usbh_driver_gp_xbox.h
@@ -0,0 +1,73 @@
+/*
+ * This file is part of the libusbhost library
+ * hosted at http://github.com/libusbhost/libusbhost
+ *
+ * Copyright (C) 2015 Amir Hammad <amir.hammad@hotmail.com>
+ *
+ *
+ * libusbhost is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef USBH_DRIVER_GP_XBOX_
+#define USBH_DRIVER_GP_XBOX_
+
+#include "usbh_hubbed.h"
+
+#include <stdint.h>
+
+BEGIN_DECLS
+
+#define GP_XBOX_DPAD_TOP (1 << 0)
+#define GP_XBOX_DPAD_LEFT (1 << 1)
+#define GP_XBOX_DPAD_BOTTOM (1 << 2)
+#define GP_XBOX_DPAD_RIGHT (1 << 3)
+#define GP_XBOX_BUTTON_X (1 << 4)
+#define GP_XBOX_BUTTON_Y (1 << 5)
+#define GP_XBOX_BUTTON_A (1 << 6)
+#define GP_XBOX_BUTTON_B (1 << 7)
+#define GP_XBOX_BUTTON_SELECT (1 << 8)
+#define GP_XBOX_BUTTON_START (1 << 9)
+#define GP_XBOX_BUTTON_LT (1 << 10)
+#define GP_XBOX_BUTTON_RT (1 << 11)
+#define GP_XBOX_BUTTON_XBOX (1 << 12)
+#define GP_XBOX_BUTTON_AXIS_LEFT (1 << 13)
+#define GP_XBOX_BUTTON_AXIS_RIGHT (1 << 14)
+
+struct _gp_xbox_packet {
+ uint32_t buttons;
+ int16_t axis_left_x;
+ int16_t axis_left_y;
+ int16_t axis_right_x;
+ int16_t axis_right_y;
+ uint8_t axis_rear_left;
+ uint8_t axis_rear_right;
+};
+typedef struct _gp_xbox_packet gp_xbox_packet_t;
+
+
+struct _gp_xbox_config {
+ void (*update)(uint8_t device_id, gp_xbox_packet_t data);
+ void (*notify_connected)(uint8_t device_id);
+ void (*notify_disconnected)(uint8_t device_id);
+};
+typedef struct _gp_xbox_config gp_xbox_config_t;
+
+void gp_xbox_driver_init(const gp_xbox_config_t *config);
+
+extern const usbh_dev_driver_t usbh_gp_xbox_driver;
+
+END_DECLS
+
+#endif