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/USBHID.h.svn-base
- Revision:
- 0:505207de8566
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice/USBHID/.svn/text-base/USBHID.h.svn-base Tue Nov 29 21:26:20 2011 +0000
@@ -0,0 +1,116 @@
+/* USBHID.h */
+/* Human Interface Device (HID) class */
+/* Copyright (c) 2011 ARM Limited. All rights reserved. */
+
+#ifndef _USB_CLASS_HID_
+#define _USB_CLASS_HID_
+
+/* These headers are included for child class. */
+#include "USBEndpoints.h"
+#include "USBDescriptor.h"
+#include "USBDevice_Types.h"
+
+#include "USBHID_Types.h"
+#include "USBDevice.h"
+
+
+
+class USBHID: public USBDevice {
+public:
+
+ /**
+ * Constructor
+ *
+ * @param vendor_id Your vendor_id
+ * @param product_id Your product_id
+ * @param product_release Your preoduct_release
+ */
+ USBHID(uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
+
+ /**
+ * Get the Report descriptor
+ *
+ * @return pointer to the report descriptor
+ */
+ virtual uint8_t * ReportDesc() {
+ return NULL;
+ };
+
+ /**
+ * Get the length of the report descriptor
+ *
+ * @return the length of the report descriptor
+ */
+ virtual uint16_t ReportDescLength();
+
+ /**
+ * Send a Report to a certain endpoint
+ *
+ * @param endpoint endpoint which will be sent the report
+ * @param report Report which will be sent (a report is defined by all data and the length)
+ * @return true if successful
+ */
+ bool USBHID_send(uint8_t endpoint, HID_REPORT *report);
+
+ /**
+ * Read a report from a certain endpoint. Warning: blocking
+ *
+ * @param endpoint endpoint which will be read
+ * @param report pointer to the report to fill
+ * @return true if successful
+ */
+ bool USBHID_read(uint8_t endpoint, HID_REPORT * report);
+
+ /**
+ * Read a report from a certain endpoint. Warning: non blocking
+ *
+ * @param endpoint endpoint which will be read
+ * @param report pointer to the report to fill
+ * @return true if successful
+ */
+ bool USBHID_readNB(uint8_t endpoint, HID_REPORT * report);
+
+ /**
+ * HID Report received by SET_REPORT request. Warning: Called in ISR context
+ * First byte of data will be the report ID
+ *
+ * @param report Data and length received
+ */
+ virtual void HID_callbackSetReport(HID_REPORT *report);
+
+ virtual void USBCallback_busReset(void);
+ virtual bool USBCallback_request();
+ virtual void USBCallback_requestCompleted();
+ virtual bool USBCallback_setConfiguration(uint8_t configuration);
+
+
+ /*
+ * Get string product descriptor
+ *
+ * @return pointer to the string product descriptor
+ */
+ virtual uint8_t * StringIproductDesc();
+
+ /*
+ * Get string interface descriptor
+ *
+ * @return pointer to the string interface descriptor
+ */
+ virtual uint8_t * StringIinterfaceDesc();
+
+ /*
+ * Get configuration descriptor
+ *
+ * @return pointer to the configuration descriptor
+ */
+ virtual uint8_t * ConfigurationDesc();
+
+protected:
+ uint16_t reportLength;
+
+private:
+ bool USBClass_HID_request(void);
+ void USBClass_HID_requestCompleted(void);
+};
+
+#endif