B. H. / Mbed 2 deprecated trolololol

Dependencies:   mbed

Committer:
znuh
Date:
Tue Nov 29 21:26:20 2011 +0000
Revision:
0:505207de8566

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
znuh 0:505207de8566 1 /* USBHID.h */
znuh 0:505207de8566 2 /* Human Interface Device (HID) class */
znuh 0:505207de8566 3 /* Copyright (c) 2011 ARM Limited. All rights reserved. */
znuh 0:505207de8566 4
znuh 0:505207de8566 5 #ifndef _USB_CLASS_HID_
znuh 0:505207de8566 6 #define _USB_CLASS_HID_
znuh 0:505207de8566 7
znuh 0:505207de8566 8 /* These headers are included for child class. */
znuh 0:505207de8566 9 #include "USBEndpoints.h"
znuh 0:505207de8566 10 #include "USBDescriptor.h"
znuh 0:505207de8566 11 #include "USBDevice_Types.h"
znuh 0:505207de8566 12
znuh 0:505207de8566 13 #include "USBHID_Types.h"
znuh 0:505207de8566 14 #include "USBDevice.h"
znuh 0:505207de8566 15
znuh 0:505207de8566 16
znuh 0:505207de8566 17
znuh 0:505207de8566 18 class USBHID: public USBDevice {
znuh 0:505207de8566 19 public:
znuh 0:505207de8566 20
znuh 0:505207de8566 21 /**
znuh 0:505207de8566 22 * Constructor
znuh 0:505207de8566 23 *
znuh 0:505207de8566 24 * @param vendor_id Your vendor_id
znuh 0:505207de8566 25 * @param product_id Your product_id
znuh 0:505207de8566 26 * @param product_release Your preoduct_release
znuh 0:505207de8566 27 */
znuh 0:505207de8566 28 USBHID(uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
znuh 0:505207de8566 29
znuh 0:505207de8566 30 /**
znuh 0:505207de8566 31 * Get the Report descriptor
znuh 0:505207de8566 32 *
znuh 0:505207de8566 33 * @return pointer to the report descriptor
znuh 0:505207de8566 34 */
znuh 0:505207de8566 35 virtual uint8_t * ReportDesc() {
znuh 0:505207de8566 36 return NULL;
znuh 0:505207de8566 37 };
znuh 0:505207de8566 38
znuh 0:505207de8566 39 /**
znuh 0:505207de8566 40 * Get the length of the report descriptor
znuh 0:505207de8566 41 *
znuh 0:505207de8566 42 * @return the length of the report descriptor
znuh 0:505207de8566 43 */
znuh 0:505207de8566 44 virtual uint16_t ReportDescLength();
znuh 0:505207de8566 45
znuh 0:505207de8566 46 /**
znuh 0:505207de8566 47 * Send a Report to a certain endpoint
znuh 0:505207de8566 48 *
znuh 0:505207de8566 49 * @param endpoint endpoint which will be sent the report
znuh 0:505207de8566 50 * @param report Report which will be sent (a report is defined by all data and the length)
znuh 0:505207de8566 51 * @return true if successful
znuh 0:505207de8566 52 */
znuh 0:505207de8566 53 bool USBHID_send(uint8_t endpoint, HID_REPORT *report);
znuh 0:505207de8566 54
znuh 0:505207de8566 55 /**
znuh 0:505207de8566 56 * Read a report from a certain endpoint. Warning: blocking
znuh 0:505207de8566 57 *
znuh 0:505207de8566 58 * @param endpoint endpoint which will be read
znuh 0:505207de8566 59 * @param report pointer to the report to fill
znuh 0:505207de8566 60 * @return true if successful
znuh 0:505207de8566 61 */
znuh 0:505207de8566 62 bool USBHID_read(uint8_t endpoint, HID_REPORT * report);
znuh 0:505207de8566 63
znuh 0:505207de8566 64 /**
znuh 0:505207de8566 65 * Read a report from a certain endpoint. Warning: non blocking
znuh 0:505207de8566 66 *
znuh 0:505207de8566 67 * @param endpoint endpoint which will be read
znuh 0:505207de8566 68 * @param report pointer to the report to fill
znuh 0:505207de8566 69 * @return true if successful
znuh 0:505207de8566 70 */
znuh 0:505207de8566 71 bool USBHID_readNB(uint8_t endpoint, HID_REPORT * report);
znuh 0:505207de8566 72
znuh 0:505207de8566 73 /**
znuh 0:505207de8566 74 * HID Report received by SET_REPORT request. Warning: Called in ISR context
znuh 0:505207de8566 75 * First byte of data will be the report ID
znuh 0:505207de8566 76 *
znuh 0:505207de8566 77 * @param report Data and length received
znuh 0:505207de8566 78 */
znuh 0:505207de8566 79 virtual void HID_callbackSetReport(HID_REPORT *report);
znuh 0:505207de8566 80
znuh 0:505207de8566 81 virtual void USBCallback_busReset(void);
znuh 0:505207de8566 82 virtual bool USBCallback_request();
znuh 0:505207de8566 83 virtual void USBCallback_requestCompleted();
znuh 0:505207de8566 84 virtual bool USBCallback_setConfiguration(uint8_t configuration);
znuh 0:505207de8566 85
znuh 0:505207de8566 86
znuh 0:505207de8566 87 /*
znuh 0:505207de8566 88 * Get string product descriptor
znuh 0:505207de8566 89 *
znuh 0:505207de8566 90 * @return pointer to the string product descriptor
znuh 0:505207de8566 91 */
znuh 0:505207de8566 92 virtual uint8_t * StringIproductDesc();
znuh 0:505207de8566 93
znuh 0:505207de8566 94 /*
znuh 0:505207de8566 95 * Get string interface descriptor
znuh 0:505207de8566 96 *
znuh 0:505207de8566 97 * @return pointer to the string interface descriptor
znuh 0:505207de8566 98 */
znuh 0:505207de8566 99 virtual uint8_t * StringIinterfaceDesc();
znuh 0:505207de8566 100
znuh 0:505207de8566 101 /*
znuh 0:505207de8566 102 * Get configuration descriptor
znuh 0:505207de8566 103 *
znuh 0:505207de8566 104 * @return pointer to the configuration descriptor
znuh 0:505207de8566 105 */
znuh 0:505207de8566 106 virtual uint8_t * ConfigurationDesc();
znuh 0:505207de8566 107
znuh 0:505207de8566 108 protected:
znuh 0:505207de8566 109 uint16_t reportLength;
znuh 0:505207de8566 110
znuh 0:505207de8566 111 private:
znuh 0:505207de8566 112 bool USBClass_HID_request(void);
znuh 0:505207de8566 113 void USBClass_HID_requestCompleted(void);
znuh 0:505207de8566 114 };
znuh 0:505207de8566 115
znuh 0:505207de8566 116 #endif