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.
Diff: USBDevice/USBHID/.svn/text-base/RawHID.h.svn-base
- Revision:
- 0:505207de8566
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice/USBHID/.svn/text-base/RawHID.h.svn-base Tue Nov 29 21:26:20 2011 +0000
@@ -0,0 +1,70 @@
+/* RawHID.h */
+/* USB device example: send and receive raw HID data */
+/* Copyright (c) 2011 ARM Limited. All rights reserved. */
+
+#ifndef _USB_RAWHID_
+#define _USB_RAWHID_
+
+#include "USBHID.h"
+
+class RawHID: public USBHID {
+public:
+
+ /**
+ * Constructor
+ *
+ * @param vendor_id Your vendor_id (default: 0x1234)
+ * @param product_id Your product_id (default: 0x0001)
+ * @param product_release Your preoduct_release (default: 0x0001)
+ *
+ */
+ RawHID(uint16_t vendor_id = 0x1234, uint16_t product_id = 0x0006, uint16_t product_release = 0x0001): USBHID(vendor_id, product_id, product_release) {};
+
+ /**
+ * Send a packet of 64 bytes maximum
+ *
+ * @param buf packet to be sent
+ * @return true if successful
+ */
+ bool send(uint8_t * buf, uint8_t length);
+
+ /**
+ * Receive a packet of 64 bytes maximum. Warning: blocking
+ *
+ * @param report report containing data (report.data) and the length (report.length)
+ * @return true if successful
+ */
+ bool recv(HID_REPORT& report);
+
+ /**
+ * Receive a packet of 64 bytes maximum. Warning: non blocking
+ *
+ * @param report report containing data (report.data) and the length (report.length)
+ * @return true if successful
+ */
+ bool recvNB(HID_REPORT& report);
+
+ /**
+ * To define the report descriptor. Warning: this method has to store the length of the report descriptor in reportLength.
+ *
+ * @return pointer to the report descriptor
+ */
+ virtual uint8_t * ReportDesc();
+
+ /**
+ * To define the Configuration descriptor. (Here we have 2 endpoints in the interface descriptor)
+ *
+ * @return pointer to the configuration descriptor
+ */
+ virtual uint8_t * ConfigurationDesc();
+
+ /*
+ * Called by USBDevice layer. Set configuration of the device.
+ * For instance, you can add all endpoints that you need on this function. Here, we enable EPINT_IN and EPINT_OUT
+ *
+ * @param configuration Number of the configuration
+ */
+ virtual bool USBCallback_setConfiguration(uint8_t configuration);
+};
+
+#endif