USB Composite support
Dependents: mbed_cdc_hid_composite
Fork of USBDevice by
USBInterface.h
00001 /* Copyright (c) 2010-2011 mbed.org, MIT License 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00004 * and associated documentation files (the "Software"), to deal in the Software without 00005 * restriction, including without limitation the rights to use, copy, modify, merge, publish, 00006 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 00007 * Software is furnished to do so, subject to the following conditions: 00008 * 00009 * The above copyright notice and this permission notice shall be included in all copies or 00010 * substantial portions of the Software. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00017 */ 00018 00019 #ifndef USINTERFACE_H 00020 #define USINTERFACE_H 00021 00022 #include "mbed.h" 00023 #include "USBDevice_Types.h" 00024 //#include "USBHAL.h" 00025 00026 class USBInterface { 00027 public: 00028 USBInterface(){} 00029 virtual ~USBInterface(){}; 00030 // virtual int *endpoints(); 00031 00032 /* 00033 * Called by USBDevice on Endpoint0 request. Warning: Called in ISR context 00034 * This is used to handle extensions to standard requests 00035 * and class specific requests 00036 * 00037 * @returns true if class handles this request 00038 */ 00039 virtual bool USBCallback_request() { return false; }; 00040 00041 /* 00042 * Called by USBDevice on Endpoint0 request completion 00043 * if the 'notify' flag has been set to true. Warning: Called in ISR context 00044 * 00045 * In this case it is used to indicate that a HID report has 00046 * been received from the host on endpoint 0 00047 * 00048 * @param buf buffer received on endpoint 0 00049 * @param length length of this buffer 00050 */ 00051 virtual void USBCallback_requestCompleted(uint8_t * buf, uint32_t length) {}; 00052 00053 /* 00054 * Get string interface descriptor 00055 * 00056 * @returns pointer to the string interface descriptor 00057 */ 00058 virtual uint8_t * stringIinterfaceDesc() { return (uint8_t *)NULL; } 00059 00060 /* 00061 * Get string product descriptor 00062 * 00063 * @returns pointer to the string product descriptor 00064 */ 00065 virtual uint8_t * stringIproductDesc() { return (uint8_t *)NULL; } 00066 00067 /* 00068 * Get configuration descriptor 00069 * 00070 * @returns pointer to the configuration descriptor 00071 */ 00072 virtual uint8_t * configurationDesc() { return (uint8_t *)NULL; } 00073 00074 /* 00075 * Called by USBDevice layer. Set configuration of the device. 00076 * For instance, you can add all endpoints that you need on this function. 00077 * 00078 * @param configuration Number of the configuration 00079 */ 00080 virtual bool USBCallback_setConfiguration(uint8_t configuration) { return false; }; 00081 00082 }; 00083 00084 #endif
Generated on Tue Jul 12 2022 20:44:58 by 1.7.2