USB Composite support

Dependents:   mbed_cdc_hid_composite

Fork of USBDevice by mbed official

Committer:
steeven
Date:
Sun May 31 15:36:50 2015 +0000
Revision:
55:7c559fcb1d17
Make USBDevice support Composite

Who changed what in which revision?

UserRevisionLine numberNew contents of line
steeven 55:7c559fcb1d17 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
steeven 55:7c559fcb1d17 2 *
steeven 55:7c559fcb1d17 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
steeven 55:7c559fcb1d17 4 * and associated documentation files (the "Software"), to deal in the Software without
steeven 55:7c559fcb1d17 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
steeven 55:7c559fcb1d17 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
steeven 55:7c559fcb1d17 7 * Software is furnished to do so, subject to the following conditions:
steeven 55:7c559fcb1d17 8 *
steeven 55:7c559fcb1d17 9 * The above copyright notice and this permission notice shall be included in all copies or
steeven 55:7c559fcb1d17 10 * substantial portions of the Software.
steeven 55:7c559fcb1d17 11 *
steeven 55:7c559fcb1d17 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
steeven 55:7c559fcb1d17 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
steeven 55:7c559fcb1d17 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
steeven 55:7c559fcb1d17 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
steeven 55:7c559fcb1d17 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
steeven 55:7c559fcb1d17 17 */
steeven 55:7c559fcb1d17 18
steeven 55:7c559fcb1d17 19 #ifndef USINTERFACE_H
steeven 55:7c559fcb1d17 20 #define USINTERFACE_H
steeven 55:7c559fcb1d17 21
steeven 55:7c559fcb1d17 22 #include "mbed.h"
steeven 55:7c559fcb1d17 23 #include "USBDevice_Types.h"
steeven 55:7c559fcb1d17 24 //#include "USBHAL.h"
steeven 55:7c559fcb1d17 25
steeven 55:7c559fcb1d17 26 class USBInterface {
steeven 55:7c559fcb1d17 27 public:
steeven 55:7c559fcb1d17 28 USBInterface(){}
steeven 55:7c559fcb1d17 29 virtual ~USBInterface(){};
steeven 55:7c559fcb1d17 30 // virtual int *endpoints();
steeven 55:7c559fcb1d17 31
steeven 55:7c559fcb1d17 32 /*
steeven 55:7c559fcb1d17 33 * Called by USBDevice on Endpoint0 request. Warning: Called in ISR context
steeven 55:7c559fcb1d17 34 * This is used to handle extensions to standard requests
steeven 55:7c559fcb1d17 35 * and class specific requests
steeven 55:7c559fcb1d17 36 *
steeven 55:7c559fcb1d17 37 * @returns true if class handles this request
steeven 55:7c559fcb1d17 38 */
steeven 55:7c559fcb1d17 39 virtual bool USBCallback_request() { return false; };
steeven 55:7c559fcb1d17 40
steeven 55:7c559fcb1d17 41 /*
steeven 55:7c559fcb1d17 42 * Called by USBDevice on Endpoint0 request completion
steeven 55:7c559fcb1d17 43 * if the 'notify' flag has been set to true. Warning: Called in ISR context
steeven 55:7c559fcb1d17 44 *
steeven 55:7c559fcb1d17 45 * In this case it is used to indicate that a HID report has
steeven 55:7c559fcb1d17 46 * been received from the host on endpoint 0
steeven 55:7c559fcb1d17 47 *
steeven 55:7c559fcb1d17 48 * @param buf buffer received on endpoint 0
steeven 55:7c559fcb1d17 49 * @param length length of this buffer
steeven 55:7c559fcb1d17 50 */
steeven 55:7c559fcb1d17 51 virtual void USBCallback_requestCompleted(uint8_t * buf, uint32_t length) {};
steeven 55:7c559fcb1d17 52
steeven 55:7c559fcb1d17 53 /*
steeven 55:7c559fcb1d17 54 * Get string interface descriptor
steeven 55:7c559fcb1d17 55 *
steeven 55:7c559fcb1d17 56 * @returns pointer to the string interface descriptor
steeven 55:7c559fcb1d17 57 */
steeven 55:7c559fcb1d17 58 virtual uint8_t * stringIinterfaceDesc() { return (uint8_t *)NULL; }
steeven 55:7c559fcb1d17 59
steeven 55:7c559fcb1d17 60 /*
steeven 55:7c559fcb1d17 61 * Get string product descriptor
steeven 55:7c559fcb1d17 62 *
steeven 55:7c559fcb1d17 63 * @returns pointer to the string product descriptor
steeven 55:7c559fcb1d17 64 */
steeven 55:7c559fcb1d17 65 virtual uint8_t * stringIproductDesc() { return (uint8_t *)NULL; }
steeven 55:7c559fcb1d17 66
steeven 55:7c559fcb1d17 67 /*
steeven 55:7c559fcb1d17 68 * Get configuration descriptor
steeven 55:7c559fcb1d17 69 *
steeven 55:7c559fcb1d17 70 * @returns pointer to the configuration descriptor
steeven 55:7c559fcb1d17 71 */
steeven 55:7c559fcb1d17 72 virtual uint8_t * configurationDesc() { return (uint8_t *)NULL; }
steeven 55:7c559fcb1d17 73
steeven 55:7c559fcb1d17 74 /*
steeven 55:7c559fcb1d17 75 * Called by USBDevice layer. Set configuration of the device.
steeven 55:7c559fcb1d17 76 * For instance, you can add all endpoints that you need on this function.
steeven 55:7c559fcb1d17 77 *
steeven 55:7c559fcb1d17 78 * @param configuration Number of the configuration
steeven 55:7c559fcb1d17 79 */
steeven 55:7c559fcb1d17 80 virtual bool USBCallback_setConfiguration(uint8_t configuration) { return false; };
steeven 55:7c559fcb1d17 81
steeven 55:7c559fcb1d17 82 };
steeven 55:7c559fcb1d17 83
steeven 55:7c559fcb1d17 84 #endif